com.puppycrawl.tools.checkstyle.checks
Class CheckUtils
public final class CheckUtils
Contains utility methods for the checks.
static FullIdent | createFullType(DetailAST aTypeAST) - Creates
FullIdent for given type node.
|
static DetailAST | getFirstNode(DetailAST aNode) - Finds sub-node for given node minimal (line, column) pair.
|
static List | getTypeParameterNames(DetailAST aNode) - Retrieves the names of the type parameters to the node.
|
static List | getTypeParameters(DetailAST aNode) - Retrieves the type parameters to the node.
|
static boolean | isElseIf(DetailAST aAST) - Returns whether a token represents an ELSE as part of an ELSE / IF set.
|
static boolean | isEqualsMethod(DetailAST aAST) - Tests whether a method definition AST defines an equals covariant.
|
static double | parseDouble(String aText, int aType) - Returns the value represented by the specified string of the specified
type.
|
static double | parseFloat(String aText, int aType) - Returns the value represented by the specified string of the specified
type.
|
static int | parseInt(String aText, int aRadix) - Parses the string argument as a signed integer in the radix specified by
the second argument.
|
static long | parseLong(String aText, int aRadix) - Parses the string argument as a signed long in the radix specified by
the second argument.
|
createFullType
public static FullIdent createFullType(DetailAST aTypeAST)
Creates FullIdent
for given type node.
FullIdent
for given type.
getFirstNode
public static DetailAST getFirstNode(DetailAST aNode)
Finds sub-node for given node minimal (line, column) pair.
aNode
- the root of tree for search.
- sub-node with minimal (line, column) pair.
getTypeParameterNames
public static List getTypeParameterNames(DetailAST aNode)
Retrieves the names of the type parameters to the node.
aNode
- the parameterised AST node
- a list of type parameter names
getTypeParameters
public static List getTypeParameters(DetailAST aNode)
Retrieves the type parameters to the node.
aNode
- the parameterised AST node
- a list of type parameter names
isElseIf
public static boolean isElseIf(DetailAST aAST)
Returns whether a token represents an ELSE as part of an ELSE / IF set.
aAST
- the token to check
isEqualsMethod
public static boolean isEqualsMethod(DetailAST aAST)
Tests whether a method definition AST defines an equals covariant.
aAST
- the method definition AST to test.
Precondition: aAST is a TokenTypes.METHOD_DEF node.
- true if aAST defines an equals covariant.
parseDouble
public static double parseDouble(String aText,
int aType)
Returns the value represented by the specified string of the specified
type. Returns 0 for types other than float, double, int, and long.
aText
- the string to be parsed.aType
- the token type of the text. Should be a constant of
TokenTypes
.
- the double value represented by the string argument.
parseFloat
public static double parseFloat(String aText,
int aType)
Returns the value represented by the specified string of the specified
type. Returns 0 for types other than float, double, int, and long.
aText
- the string to be parsed.aType
- the token type of the text. Should be a constant of
TokenTypes
.
- the float value represented by the string argument.
parseInt
public static int parseInt(String aText,
int aRadix)
Parses the string argument as a signed integer in the radix specified by
the second argument. The characters in the string must all be digits of
the specified radix. Handles negative values, which method
java.lang.Integer.parseInt(String, int) does not.
aText
- the String containing the integer representation to be
parsed. Precondition: aText contains a parsable int.aRadix
- the radix to be used while parsing aText.
- the integer represented by the string argument in the specified
radix.
parseLong
public static long parseLong(String aText,
int aRadix)
Parses the string argument as a signed long in the radix specified by
the second argument. The characters in the string must all be digits of
the specified radix. Handles negative values, which method
java.lang.Integer.parseInt(String, int) does not.
aText
- the String containing the integer representation to be
parsed. Precondition: aText contains a parsable int.aRadix
- the radix to be used while parsing aText.
- the long represented by the string argument in the specified
radix.