org.onemind.jxp
Class Evaluator

java.lang.Object
  extended by org.onemind.jxp.Evaluator

public final class Evaluator
extends java.lang.Object

The evaluator implements several arithmetic operations on objects

Author:
TiongHiang Lee (thlee@onemindsoft.org)

Field Summary
private static short DOUBLE_PRECISION
          the precision of parameters *
private static short FLOAT_PRECISION
          the precision of parameters *
private static short INT_PRECISION
          the precision of parameters *
private static short LONG_PRECISION
          the precision of parameters *
 
Constructor Summary
private Evaluator()
          Constructor
 
Method Summary
static java.lang.Object bitwiseAnd(java.lang.Object a1, java.lang.Object a2)
          Bitwise-and operation
static java.lang.Object bitwiseComplement(java.lang.Object o)
          Bitwise complement operation
static java.lang.Object bitwiseOr(java.lang.Object a1, java.lang.Object a2)
          Bitwise-or operation
static java.lang.Object bitwiseXOr(java.lang.Object a1, java.lang.Object a2)
          Bitwise-XOR operation
static java.lang.Object divide(java.lang.Object a1, java.lang.Object a2)
          Divide operation
static java.lang.Boolean eq(java.lang.Object a1, java.lang.Object a2)
          Equality operation
static java.lang.Boolean ge(java.lang.Object a1, java.lang.Object a2)
          Greater than or equal operation
private static short getPrecision(java.lang.Number n1, java.lang.Number n2)
          Get the higest precision among the two number
static java.lang.Boolean gt(java.lang.Object a1, java.lang.Object a2)
          Greater than operation
static java.lang.Boolean le(java.lang.Object a1, java.lang.Object a2)
          Less than or equal operation
static java.lang.Object leftShift(java.lang.Object a1, java.lang.Object a2)
          Left-shift operation
static java.lang.Boolean lt(java.lang.Object a1, java.lang.Object a2)
          Less than operation
static java.lang.Object minus(java.lang.Object a1, java.lang.Object a2)
          Minus operation
static java.lang.Object multiply(java.lang.Object a1, java.lang.Object a2)
          Multiply operation
static java.lang.Boolean ne(java.lang.Object a1, java.lang.Object a2)
          Inequality operation
static java.lang.Object negate(java.lang.Object a1)
          Negation operation
static java.lang.Object plus(java.lang.Object a1, java.lang.Object a2)
          Plus operation
static java.lang.Object remainder(java.lang.Object a1, java.lang.Object a2)
          Remainder operation
static java.lang.Object rightSignedShift(java.lang.Object a1, java.lang.Object a2)
          right-signed-shift operation
static java.lang.Object rightUnsignedShift(java.lang.Object a1, java.lang.Object a2)
          Right-unsigned-shift operation
static java.lang.Boolean toBoolean(java.lang.Object o)
          Cast the given object to boolean type
private static java.lang.Number toNumber(java.lang.Object o)
          Cast the object to a number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INT_PRECISION

private static final short INT_PRECISION
the precision of parameters *

See Also:
Constant Field Values

FLOAT_PRECISION

private static final short FLOAT_PRECISION
the precision of parameters *

See Also:
Constant Field Values

LONG_PRECISION

private static final short LONG_PRECISION
the precision of parameters *

See Also:
Constant Field Values

DOUBLE_PRECISION

private static final short DOUBLE_PRECISION
the precision of parameters *

See Also:
Constant Field Values
Constructor Detail

Evaluator

private Evaluator()
Constructor

Method Detail

plus

public static java.lang.Object plus(java.lang.Object a1,
                                    java.lang.Object a2)
Plus operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

getPrecision

private static short getPrecision(java.lang.Number n1,
                                  java.lang.Number n2)
Get the higest precision among the two number

Parameters:
n1 - the first number
n2 - the second numbe r
Returns:
the highest precision

toNumber

private static java.lang.Number toNumber(java.lang.Object o)
Cast the object to a number

Parameters:
o - the object
Returns:
a number object

minus

public static java.lang.Object minus(java.lang.Object a1,
                                     java.lang.Object a2)
Minus operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

multiply

public static java.lang.Object multiply(java.lang.Object a1,
                                        java.lang.Object a2)
Multiply operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

divide

public static java.lang.Object divide(java.lang.Object a1,
                                      java.lang.Object a2)
Divide operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

remainder

public static java.lang.Object remainder(java.lang.Object a1,
                                         java.lang.Object a2)
Remainder operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

negate

public static java.lang.Object negate(java.lang.Object a1)
Negation operation

Parameters:
a1 - the first arg
Returns:
the result

eq

public static java.lang.Boolean eq(java.lang.Object a1,
                                   java.lang.Object a2)
Equality operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

ne

public static java.lang.Boolean ne(java.lang.Object a1,
                                   java.lang.Object a2)
Inequality operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

lt

public static java.lang.Boolean lt(java.lang.Object a1,
                                   java.lang.Object a2)
Less than operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

le

public static java.lang.Boolean le(java.lang.Object a1,
                                   java.lang.Object a2)
Less than or equal operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

gt

public static java.lang.Boolean gt(java.lang.Object a1,
                                   java.lang.Object a2)
Greater than operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

ge

public static java.lang.Boolean ge(java.lang.Object a1,
                                   java.lang.Object a2)
Greater than or equal operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

toBoolean

public static java.lang.Boolean toBoolean(java.lang.Object o)
Cast the given object to boolean type

Parameters:
o - the object
Returns:
boolean type

bitwiseComplement

public static java.lang.Object bitwiseComplement(java.lang.Object o)
Bitwise complement operation

Parameters:
o - the object
Returns:
the result

leftShift

public static java.lang.Object leftShift(java.lang.Object a1,
                                         java.lang.Object a2)
Left-shift operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

rightSignedShift

public static java.lang.Object rightSignedShift(java.lang.Object a1,
                                                java.lang.Object a2)
right-signed-shift operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

rightUnsignedShift

public static java.lang.Object rightUnsignedShift(java.lang.Object a1,
                                                  java.lang.Object a2)
Right-unsigned-shift operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

bitwiseAnd

public static java.lang.Object bitwiseAnd(java.lang.Object a1,
                                          java.lang.Object a2)
Bitwise-and operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

bitwiseOr

public static java.lang.Object bitwiseOr(java.lang.Object a1,
                                         java.lang.Object a2)
Bitwise-or operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result

bitwiseXOr

public static java.lang.Object bitwiseXOr(java.lang.Object a1,
                                          java.lang.Object a2)
Bitwise-XOR operation

Parameters:
a1 - the first arg
a2 - the second arg
Returns:
the result