com.eteks.jeks
Class JeksInterpreter
java.lang.Object
|
+--com.eteks.parser.DoubleInterpreter
|
+--com.eteks.parser.WrapperInterpreter
|
+--com.eteks.jeks.JeksInterpreter
- All Implemented Interfaces:
- Interpreter
- public class JeksInterpreter
- extends WrapperInterpreter
Interpreter used to compute cell values. This interpreter interprets null
cell values as 0.
- Since:
- Jeks 1.0
- Version:
- 1.0
- Author:
- Emmanuel Puybaret
Method Summary |
java.lang.Object |
getBinaryOperatorValue(java.lang.Object binaryOperatorKey,
java.lang.Object param1,
java.lang.Object param2)
Returns the value of the operation of the binary operator binaryOperatorKey applied on
the two operands operand1 and operand2 . |
java.lang.Object |
getCommonFunctionValue(java.lang.Object commonFunctionKey,
java.lang.Object param)
Returns the value of the common function commonFunctionKey with
the parameter param . |
java.lang.Object |
getParameterValue(java.lang.Object parameter)
Returns parameter if it's null an instance of Number ,
String , Character , Boolean , Date or
Object [][] . |
java.lang.Object |
getUnaryOperatorValue(java.lang.Object unaryOperatorKey,
java.lang.Object param)
Returns the value of the operation of the unary operator unaryOperatorKey applied
on the operand operand . |
boolean |
isTrue(java.lang.Object param)
Returns true if param is an instance of Number
different of 0, or if param is a true Boolean object.
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NULL_VALUE
public static final java.lang.Object NULL_VALUE
JeksInterpreter
public JeksInterpreter()
- Creates an interpreter.
isTrue
public boolean isTrue(java.lang.Object param)
- Returns
true
if param
is an instance of Number
different of 0, or if param
is a true Boolean
object.
If param
is null
, this method returns false
.
- Overrides:
isTrue
in class WrapperInterpreter
- Following copied from class:
com.eteks.parser.WrapperInterpreter
- Parameters:
condition
- the value to test (instance of Boolean
).- Returns:
- the boolean value of
condition
.
getParameterValue
public java.lang.Object getParameterValue(java.lang.Object parameter)
- Returns
parameter
if it's null
an instance of Number
,
String
, Character
, Boolean
, Date
or
Object [][]
.
- Overrides:
getParameterValue
in class WrapperInterpreter
- Parameters:
parameter
- the computed parameter to evaluate.- Throws:
java.lang.IllegalArgumentException
- if parameter
class isn't allowed.
getUnaryOperatorValue
public java.lang.Object getUnaryOperatorValue(java.lang.Object unaryOperatorKey,
java.lang.Object param)
- Description copied from class:
WrapperInterpreter
- Returns the value of the operation of the unary operator
unaryOperatorKey
applied
on the operand operand
. unaryOperatorKey
must be the key
of an unary operator of Syntax
(one of OPERATOR_POSITIVE
,
OPERATOR_OPPOSITE
, OPERATOR_LOGICAL_NOT
, OPERATOR_BITWISE_NOT
).
- Overrides:
getUnaryOperatorValue
in class WrapperInterpreter
- Following copied from class:
com.eteks.parser.WrapperInterpreter
- Parameters:
unaryOperatorKey
- the key of an unary operator of Syntax
.operand
- the operand.- Returns:
- the result of the operation. The returned value is an instance of
Double
,
Long
or Boolean
. - Throws:
java.lang.IllegalArgumentException
- if operand
isn't of the good type for the requested
operator or if unaryOperatorKey
isn't the key of an unary
operator of Syntax
.
getBinaryOperatorValue
public java.lang.Object getBinaryOperatorValue(java.lang.Object binaryOperatorKey,
java.lang.Object param1,
java.lang.Object param2)
- Description copied from class:
WrapperInterpreter
- Returns the value of the operation of the binary operator
binaryOperatorKey
applied on
the two operands operand1
and operand2
. binaryOperatorKey
must be the key of a binary operator of Syntax
(one of OPERATOR_ADD
,
OPERATOR_SUBSTRACT
, OPERATOR_MULTIPLY
, OPERATOR_DIVIDE
,...).
- Overrides:
getBinaryOperatorValue
in class WrapperInterpreter
- Following copied from class:
com.eteks.parser.WrapperInterpreter
- Parameters:
binaryOperatorKey
- the key of a binary operator of Syntax
.operand1
- the first operand.operand2
- the second operand.- Returns:
- the result of the operation. The returned value is an instance of
Double
,
Long
, Boolean
or String
. - Throws:
java.lang.IllegalArgumentException
- if operand1
and operand2
aren't of
the good type for requested operator or if binaryOperatorKey
isn't the key
of a binary operator of Syntax
.
getCommonFunctionValue
public java.lang.Object getCommonFunctionValue(java.lang.Object commonFunctionKey,
java.lang.Object param)
- Description copied from class:
WrapperInterpreter
- Returns the value of the common function
commonFunctionKey
with
the parameter param
. commonFunctionKey
must be the key
of a commomon function of Syntax
(one of FUNCTION_LN
,
FUNCTION_LOG
, FUNCTION_EXP
, FUNCTION_SQR
,...).
- Overrides:
getCommonFunctionValue
in class WrapperInterpreter
- Following copied from class:
com.eteks.parser.WrapperInterpreter
- Parameters:
commonFunctionKey
- the key of a common function of Syntax
.param
- the parameter of the function.- Returns:
- the result of the function. The returned value is an instance of
Double
,
Long
or Boolean
. - Throws:
java.lang.IllegalArgumentException
- if param
isn't of the good type for the
requested function or if commonFunctionKey
isn't the key of a
commomon function of Syntax
.