本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.NUM_LONG属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.NUM_LONG属性的具体用法?Java TokenTypes.NUM_LONG怎么用?Java TokenTypes.NUM_LONG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.NUM_LONG属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.NUM_DOUBLE,
TokenTypes.NUM_FLOAT,
TokenTypes.NUM_INT,
TokenTypes.NUM_LONG,
TokenTypes.IDENT,
TokenTypes.COMMENT_CONTENT,
TokenTypes.STRING_LITERAL,
TokenTypes.CHAR_LITERAL,
};
}
示例2: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.NUM_DOUBLE,
TokenTypes.NUM_FLOAT,
TokenTypes.NUM_INT,
TokenTypes.NUM_LONG,
};
}
示例3: getDefaultTokens
@Override
public int[] getDefaultTokens() {
return new int[] {
TokenTypes.EXPR,
TokenTypes.IDENT,
TokenTypes.NUM_DOUBLE,
TokenTypes.NUM_FLOAT,
TokenTypes.NUM_INT,
TokenTypes.NUM_LONG,
TokenTypes.STRING_LITERAL,
TokenTypes.LITERAL_NULL,
TokenTypes.LITERAL_FALSE,
TokenTypes.LITERAL_TRUE,
TokenTypes.ASSIGN,
TokenTypes.BAND_ASSIGN,
TokenTypes.BOR_ASSIGN,
TokenTypes.BSR_ASSIGN,
TokenTypes.BXOR_ASSIGN,
TokenTypes.DIV_ASSIGN,
TokenTypes.MINUS_ASSIGN,
TokenTypes.MOD_ASSIGN,
TokenTypes.PLUS_ASSIGN,
TokenTypes.SL_ASSIGN,
TokenTypes.SR_ASSIGN,
TokenTypes.STAR_ASSIGN,
TokenTypes.LAMBDA,
};
}
示例4: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.EXPR,
TokenTypes.IDENT,
TokenTypes.NUM_DOUBLE,
TokenTypes.NUM_FLOAT,
TokenTypes.NUM_INT,
TokenTypes.NUM_LONG,
TokenTypes.STRING_LITERAL,
TokenTypes.LITERAL_NULL,
TokenTypes.LITERAL_FALSE,
TokenTypes.LITERAL_TRUE,
TokenTypes.ASSIGN,
TokenTypes.BAND_ASSIGN,
TokenTypes.BOR_ASSIGN,
TokenTypes.BSR_ASSIGN,
TokenTypes.BXOR_ASSIGN,
TokenTypes.DIV_ASSIGN,
TokenTypes.MINUS_ASSIGN,
TokenTypes.MOD_ASSIGN,
TokenTypes.PLUS_ASSIGN,
TokenTypes.SL_ASSIGN,
TokenTypes.SR_ASSIGN,
TokenTypes.STAR_ASSIGN,
TokenTypes.LAMBDA,
};
}
示例5: parseDouble
/**
* Returns the value represented by the specified string of the specified
* type. Returns 0 for types other than float, double, int, and long.
* @param text the string to be parsed.
* @param type the token type of the text. Should be a constant of
* {@link TokenTypes}.
* @return the double value represented by the string argument.
*/
public static double parseDouble(String text, int type) {
String txt = UNDERSCORE_PATTERN.matcher(text).replaceAll("");
double result = 0;
switch (type) {
case TokenTypes.NUM_FLOAT:
case TokenTypes.NUM_DOUBLE:
result = Double.parseDouble(txt);
break;
case TokenTypes.NUM_INT:
case TokenTypes.NUM_LONG:
int radix = BASE_10;
if (txt.startsWith("0x") || txt.startsWith("0X")) {
radix = BASE_16;
txt = txt.substring(2);
}
else if (txt.charAt(0) == '0') {
radix = BASE_8;
txt = txt.substring(1);
}
if (CommonUtils.endsWithChar(txt, 'L') || CommonUtils.endsWithChar(txt, 'l')) {
txt = txt.substring(0, txt.length() - 1);
}
if (!txt.isEmpty()) {
if (type == TokenTypes.NUM_INT) {
result = parseInt(txt, radix);
}
else {
result = parseLong(txt, radix);
}
}
break;
default:
break;
}
return result;
}
示例6: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final UpperEllCheck checkObj = new UpperEllCheck();
final int[] expected = {TokenTypes.NUM_LONG};
assertArrayEquals("Default required tokens are invalid",
expected, checkObj.getRequiredTokens());
}
示例7: testAcceptableTokens
@Test
public void testAcceptableTokens() {
final int[] expected = {TokenTypes.NUM_LONG };
final UpperEllCheck check = new UpperEllCheck();
final int[] actual = check.getAcceptableTokens();
assertEquals("Invalid size of tokens", 1, actual.length);
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例8: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {TokenTypes.NUM_LONG};
}