public class ECMASupport extends Object
Constructor and Description |
---|
ECMASupport() |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Boolean l,
Boolean r)
Implement equality of booleans - see ECMA 262 3d Edition, section 11.9.3
|
static boolean |
equals(Number l,
Number r)
Implement equality of numbers - see ECMA 262 3d Edition, section 11.9.3
|
static boolean |
equals(Object l,
Object r)
Implement the Abstract Equality Comparison algorithm - see ECMA 262 3d Edition, section 11.9.3
|
static boolean |
equals(String l,
String r)
Implement equality of strings - see ECMA 262 3d Edition, section 11.9.3
|
static boolean |
greaterThan(Number l,
Number r)
ECMA greater-than - ECMA 262 3rd edition, section 11.8.2
|
static boolean |
greaterThan(Object l,
Object r)
ECMA greater-than - ECMA 262 3rd edition, section 11.8.2
|
static boolean |
greaterThanEquals(Number l,
Number r)
ECMA greater-than-or-equal operator - ECMA 262 3rd edition, section 11.8.4
|
static boolean |
greaterThanEquals(Object l,
Object r)
ECMA greater-than-or-equal operator - ECMA 262 3rd edition, section 11.8.4
|
static boolean |
isNan(double number)
Determines is a specific floating poing number is Nan
|
static int |
leftShiftOperation(Number left,
Number right)
The Left Shift Operator ( << ) performs a bitwise left shift operation on
the left operand by the amount specified by the right operand.
|
static boolean |
lessThan(Number l,
Number r)
ECMA less-than operator - ECMA 262 3rd edition, section 11.8.1
|
static boolean |
lessThan(Object l,
Object r)
ECMA less-than operator - ECMA 262 3rd edition, section 11.8.1
|
static boolean |
lessThanEquals(Number l,
Number r)
ECMA less-than-or-equal operator - ECMA 262 3rd edition, section 11.8.3
|
static boolean |
lessThanEquals(Object l,
Object r)
ECMA less-than-or-equal operator - ECMA 262 3rd edition, section 11.8.3
|
static <T> T |
logicalAnd(T left,
T right)
Performs the logical and (&&) operation on two objects.
|
static <T> boolean |
logicalNot(T e)
Perform the logical not (!)
|
static <T> T |
logicalOr(T left,
T right)
Performs the logical or (||) operation on two objects. is evaluated as
follows:
Let lref be the result of evaluating LogicalANDExpression.
|
static int |
signedRightShiftOperation(Number left,
Number right)
Performs a sign-filling bitwise right shift operation on the left operand
by the amount specified by the right operand.
|
static boolean |
strictEquals(Object l,
Object r)
Implement the strict equality comparison algorithm - see ECMA 262 3d Edition, section 11.9.6
Used for '===', '!
|
static boolean |
toBoolean(Number value)
Converts a Number to boolean using ECMA algorithm The following rules
apply:
If number is zero, return false
If number is Nan, return false
Otherwise, return true
|
static boolean |
toBoolean(String value)
Converts a String to boolean using ECMA algorithm The following rules
apply:
If value is empty, return false
Otherwise, return true
|
static <T> boolean |
toBoolean(T value)
Converts "anything" to boolean using ECMA algorithm
|
static int |
toInt32(double number)
The abstract operation ToInt32 converts its argument to one of 2^32
integer values in the range -2^31 through 2^31-1, inclusive.
|
static int |
toInt32(Number number) |
static int |
toInt32(Object value) |
static double |
toInteger(double number)
The abstract operation ToInteger converts its argument to an integral
numeric value.
|
static <T> Number |
toNumeric(T value)
Implement the ECMA ToNumber (ECMA 262, 3rd Edition section 9.3) algorithm.
|
static String |
toString(Boolean b)
Specialized toString for booleans - ECMA 262 3rd edition, section 9.8
|
static String |
toString(Double d)
Implement the ECMA ToString algorithm - ECMA 262 3rd edition, section 9.8.1
|
static String |
toString(Integer i)
Specialized toString for ints - ECMA 262 3rd edition, section 9.8.1
|
static String |
toString(Long i)
Specialized toString for uint's - ECMA 262 3rd edition, section 9.8.1
|
static String |
toString(Object o)
Implement the ECMA ToString algorithm - ECMA 262 3rd edition, section 9.8
|
static long |
toUInt32(double number)
The abstract operation ToUInt32 converts its argument to one of 2^32
integer values in the range 0 through 2^32-1, inclusive.
|
static long |
toUInt32(Number value)
Version of toUInt32 that operates on Number
|
static long |
toUInt32(Object value)
Version of toUInt32 that operates on Object
|
static long |
unsignedRightShiftOperation(Number left,
Number right)
Performs a zero-filling bitwise right shift operation on the left operand
by the amount specified by the right operand.
|
public static int toInt32(double number)
number
be the result of calling ToNumber on the input
argument.number
is NaN, +0, -0, positive infinity, or negative
infinity, return +0.posInt
be sign(number) * floor(abs(number))
.int32bit
be posInt modulo 2^ 32
; that is, a
finite integer value k of Number type with positive sign and less than
2^32 in magnitude such that the mathematical difference of posInt and k
is mathematically an integer multiple of 2^32.int32bit
is greater than or equal to 2^31, return
int32bit - 2^32
, otherwise return int32bit
.ToInt32
:
number
- IEEE number.public static int toInt32(Number number)
public static int toInt32(Object value)
public static long toUInt32(double number)
number
be the result of calling ToNumber on the input
argument.number
is NaN, +0, -0, positive infinity, or negative
infinity, return +0.posInt
be sign(number) x floor(abs(number))
.int32bit
be posInt modulo 2^ 32
; that is, a
finite integer value k of Number type with positive sign and less than
2^32 in magnitude such that the mathematical difference of posInt and k
is mathematically an integer multiple of 2^32.int32bit
.ToInt32
:
toUInt32(double)
and
toInt32(double)
.number
- IEEE number.public static long toUInt32(Number value)
public static long toUInt32(Object value)
public static double toInteger(double number)
number
be the result of calling ToNumber on the input
argument.number
is NaN, return +0.number
is +0, -0, positive infinity, or negative infinity,
return number
.sign(number) x floor(abs(number))
.number
- IEEE number.public static <T> boolean toBoolean(T value)
T
- - Number or Stringpublic static boolean toBoolean(Number value)
public static boolean toBoolean(String value)
public static boolean isNan(double number)
public static int leftShiftOperation(Number left, Number right)
ShiftExpression : ShiftExpression << AdditiveExpression
is
evaluated as follows:
left
- Value of the left operand.right
- Value of the right operand.public static int signedRightShiftOperation(Number left, Number right)
ShiftExpression : ShiftExpression >> AdditiveExpression
is
evaluated as follows:
left
- Value of the left operand.right
- Value of the right operand.public static long unsignedRightShiftOperation(Number left, Number right)
ShiftExpression : ShiftExpression >>> AdditiveExpression
is
evaluated as follows:
left
- Value of the left operand.right
- Value of the right operand.public static <T> T logicalAnd(T left, T right)
LogicalANDExpression : LogicalANDExpression && BitwiseORExpression
is evaluated as follows:
T
- is the numeric type of the operands, and the return typeleft
- Value of the left operandright
- Value of the right operandpublic static <T> T logicalOr(T left, T right)
T
- is the numeric type of the operands, and the return typeleft
- Value of the left operandright
- Value of the right operandpublic static <T> boolean logicalNot(T e)
T
- is the numeric type of the operande
- is the operandpublic static <T> Number toNumeric(T value)
value
- the value to convertpublic static boolean equals(Number l, Number r)
l
- the left numberr
- the right numberpublic static boolean equals(String l, String r)
l
- the left stringr
- the right stringpublic static boolean equals(Boolean l, Boolean r)
l
- the left booleanr
- the right booleanpublic static boolean equals(Object l, Object r)
l
- the left valuer
- the right valuepublic static boolean strictEquals(Object l, Object r)
l
- the left valuer
- the right valuepublic static boolean lessThan(Number l, Number r)
public static boolean lessThan(Object l, Object r)
public static boolean lessThanEquals(Number l, Number r)
public static boolean lessThanEquals(Object l, Object r)
public static boolean greaterThan(Number l, Number r)
public static boolean greaterThan(Object l, Object r)
public static boolean greaterThanEquals(Number l, Number r)
public static boolean greaterThanEquals(Object l, Object r)
public static String toString(Object o)
o
- the value to convert to a Stringpublic static String toString(Double d)
public static String toString(Integer i)
public static String toString(Long i)
Copyright © 2016 The Apache Software Foundation. All rights reserved.