Class JSType
java.lang.Object
com.oracle.js.parser.JSType
Representation for ECMAScript types - this maps directly to the ECMA script standard
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisRepresentableAsInt(double number) Returns true if double number can be represented as an int.static booleanisRepresentableAsLong(double number) Returns true if double number can be represented as a long.static booleanisStrictlyRepresentableAsInt(double number) Returns true if double number can be represented as an int.static booleanisStrictlyRepresentableAsLong(double number) Returns true if double number can be represented as a long.
-
Method Details
-
isRepresentableAsInt
public static boolean isRepresentableAsInt(double number) Returns true if double number can be represented as an int. Note that it returns true for negative zero. If you need to exclude negative zero, useisStrictlyRepresentableAsInt(double).- Parameters:
number- a double to inspect- Returns:
- true for int representable doubles
-
isStrictlyRepresentableAsInt
public static boolean isStrictlyRepresentableAsInt(double number) Returns true if double number can be represented as an int. Note that it returns false for negative zero. If you don't need to distinguish negative zero, useisRepresentableAsInt(double).- Parameters:
number- a double to inspect- Returns:
- true for int representable doubles
-
isRepresentableAsLong
public static boolean isRepresentableAsLong(double number) Returns true if double number can be represented as a long. Note that it returns true for negative zero. If you need to exclude negative zero, useisStrictlyRepresentableAsLong(double).- Parameters:
number- a double to inspect- Returns:
- true for long representable doubles
-
isStrictlyRepresentableAsLong
public static boolean isStrictlyRepresentableAsLong(double number) Returns true if double number can be represented as a long. Note that it returns false for negative zero. If you don't need to distinguish negative zero, useisRepresentableAsLong(double).- Parameters:
number- a double to inspect- Returns:
- true for long representable doubles
-