|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.sns.tools.formula.OperatorFactory
OperatorFactory provides all of the operators that the formula interpreter uses. This
set includes the standard arithmetic operators, logical operators along with an operator
that wraps function calls and an operator that pushes Value instances onto the value stack.
OperatorFactory is a factory class and should not be instantiated.
The operators are fetched as the formula is being parsed during formula compilation. During
formula evaluation, each operator executes its operate
method.
Operator
,
UnaryOperator
,
BinaryOperator
,
ValueOperator
,
FunctionOperator
,
FormulaGrammarBase.compile(java.lang.String)
,
FormulaGrammarBase#evaluate
Constructor Summary | |
protected |
OperatorFactory()
Creates a new instance of OperatorFactory. |
Method Summary | |
static gov.sns.tools.formula.Operator |
additionOperator()
Get an operator that implements addition. |
static gov.sns.tools.formula.Operator |
andOperator()
Get an operator that implements the logical and operation. |
static gov.sns.tools.formula.Operator |
divisionOperator()
Get an operator that implements division. |
static gov.sns.tools.formula.Operator |
functionOperator(Function function,
int numArgs)
Get an operator that wraps a function operation. |
static gov.sns.tools.formula.Operator |
multiplicationOperator()
Get an operator that implements multiplication. |
static gov.sns.tools.formula.Operator |
orOperator()
Get an operator that implements the logical or operation. |
static gov.sns.tools.formula.Operator |
powerOperator()
Get an operator that implements the power operator, e.g. |
static gov.sns.tools.formula.Operator |
subtractionOperator()
Get an operator that implements subtraction. |
static gov.sns.tools.formula.Operator |
unaryMinusOperator()
Get an operator that implements the unary minus operation. |
static gov.sns.tools.formula.Operator |
valueOperator(gov.sns.tools.formula.Value value)
Get an operator that can push a value onto the value stack. |
static gov.sns.tools.formula.Operator |
xorOperator()
Get an operator that implements the logical xor operation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected OperatorFactory()
Method Detail |
public static gov.sns.tools.formula.Operator unaryMinusOperator()
public static gov.sns.tools.formula.Operator additionOperator()
public static gov.sns.tools.formula.Operator subtractionOperator()
public static gov.sns.tools.formula.Operator multiplicationOperator()
public static gov.sns.tools.formula.Operator divisionOperator()
public static gov.sns.tools.formula.Operator powerOperator()
x**y
reading "x to the y power".
public static gov.sns.tools.formula.Operator andOperator()
and
operation.
public static gov.sns.tools.formula.Operator orOperator()
or
operation.
public static gov.sns.tools.formula.Operator xorOperator()
xor
operation.
public static gov.sns.tools.formula.Operator functionOperator(Function function, int numArgs)
function
- The function to wrapnumArgs
- Number of arguments to provide to the function
public static gov.sns.tools.formula.Operator valueOperator(gov.sns.tools.formula.Value value)
value
- The value to push onto the stack.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |