## com.puppycrawl.tools.checkstyle.checks
Class CheckUtils

    java.lang.Object
      com.puppycrawl.tools.checkstyle.checks.CheckUtils

    public final class CheckUtils

extends Object

Contains utility methods for the checks.

Author:
  Oliver Burn, Simon Harris, o_sukhodolsky

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### isEqualsMethod

    public static boolean isEqualsMethod(DetailAST aAST)

  Tests whether a method definition AST defines an equals covariant.

  Parameters:
    `aAST` - the method definition AST to test. Precondition: aAST is a TokenTypes.METHOD_DEF node.
  Returns:
    true if aAST defines an equals covariant.

### isElseIf

    public static boolean isElseIf(DetailAST aAST)

  Returns whether a token represents an ELSE as part of an ELSE / IF set.

  Parameters:
    `aAST` - the token to check
  Returns:
    whether it is

### createFullType

    public static FullIdent createFullType(DetailAST aTypeAST)

  Creates `FullIdent` for given type node.

  Parameters:
    `aTypeAST` - a type node.
  Returns:
    `FullIdent` for given type.

### 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.

  Parameters:
    `aText` - the string to be parsed.
    `aType` - the token type of the text. Should be a constant of `TokenTypes`.
  Returns:
    the double 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.

  Parameters:
    `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.
  Returns:
    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.

  Parameters:
    `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.
  Returns:
    the long represented by the string argument in the specified radix.

### 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.

  Parameters:
    `aText` - the string to be parsed.
    `aType` - the token type of the text. Should be a constant of `TokenTypes`.
  Returns:
    the float value represented by the string argument.

### getFirstNode

    public static DetailAST getFirstNode(DetailAST aNode)

  Finds sub-node for given node minimal (line, column) pair.

  Parameters:
    `aNode` - the root of tree for search.
  Returns:
    sub-node with minimal (line, column) pair.

### getTypeParameterNames

    public static List getTypeParameterNames(DetailAST aNode)

  Retrieves the names of the type parameters to the node.

  Parameters:
    `aNode` - the parameterised AST node
  Returns:
    a list of type parameter names

### getTypeParameters

    public static List getTypeParameters(DetailAST aNode)

  Retrieves the type parameters to the node.

  Parameters:
    `aNode` - the parameterised AST node
  Returns:
    a list of type parameter names

Back to the Checkstyle Home Page