本文整理汇总了Java中org.eclipse.jdt.internal.compiler.impl.LongConstant类的典型用法代码示例。如果您正苦于以下问题:Java LongConstant类的具体用法?Java LongConstant怎么用?Java LongConstant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LongConstant类属于org.eclipse.jdt.internal.compiler.impl包,在下文中一共展示了LongConstant类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeValue
import org.eclipse.jdt.internal.compiler.impl.LongConstant; //导入依赖的package包/类
private void computeValue(char[] token, int tokenLength, int radix, int j) {
int digitValue;
long computedValue = 0;
while (j < tokenLength) {
if ((digitValue = ScannerHelper.digit(token[j++],radix)) < 0) {
return; /*constant stays null*/
}
computedValue = (computedValue * radix) + digitValue ;
}
this.constant = LongConstant.fromValue(computedValue);
}
示例2: getConstantValue
import org.eclipse.jdt.internal.compiler.impl.LongConstant; //导入依赖的package包/类
@Nullable
private Object getConstantValue(@Nullable Object value) {
if (value instanceof Constant) {
if (value == Constant.NotAConstant) {
return null;
}
if (value instanceof StringConstant) {
return ((StringConstant) value).stringValue();
} else if (value instanceof IntConstant) {
return ((IntConstant) value).intValue();
} else if (value instanceof BooleanConstant) {
return ((BooleanConstant) value).booleanValue();
} else if (value instanceof FloatConstant) {
return ((FloatConstant) value).floatValue();
} else if (value instanceof LongConstant) {
return ((LongConstant) value).longValue();
} else if (value instanceof DoubleConstant) {
return ((DoubleConstant) value).doubleValue();
} else if (value instanceof ShortConstant) {
return ((ShortConstant) value).shortValue();
} else if (value instanceof CharConstant) {
return ((CharConstant) value).charValue();
} else if (value instanceof ByteConstant) {
return ((ByteConstant) value).byteValue();
}
} else if (value instanceof Object[]) {
Object[] array = (Object[]) value;
if (array.length > 0) {
List<Object> list = Lists.newArrayListWithExpectedSize(array.length);
for (Object element : array) {
list.add(getConstantValue(element));
}
// Pick type of array. Annotations are limited to Strings, Classes
// and Annotations
if (!list.isEmpty()) {
Object first = list.get(0);
if (first instanceof String) {
//noinspection SuspiciousToArrayCall
return list.toArray(new String[list.size()]);
} else if (first instanceof java.lang.annotation.Annotation) {
//noinspection SuspiciousToArrayCall
return list.toArray(new Annotation[list.size()]);
} else if (first instanceof Class) {
//noinspection SuspiciousToArrayCall
return list.toArray(new Class[list.size()]);
}
}
return list.toArray();
}
} else if (value instanceof AnnotationBinding) {
return new EcjResolvedAnnotation((AnnotationBinding) value);
}
return value;
}