org.jfree.formula.lvalues

Class Term

Implemented Interfaces:
Cloneable, LValue, Serializable

public class Term
extends AbstractLValue

An term is a list of LValues connected by operators. For the sake of efficiency, this is not stored as tree. We store the term as a list in the following format: (headValue)(OP value)* ...
Author:
Thomas Morgner

Constructor Summary

Term(LValue headValue)

Method Summary

void
add(InfixOperator operator, LValue operand)
Object
clone()
TypeValuePair
evaluate()
LValue[]
getChildValues()
Returns any dependent lvalues (parameters and operands, mostly).
LValue
getHeadValue()
InfixOperator[]
getOperands()
LValue[]
getOperators()
LValue
getOptimizedHeadValue()
Allows access to the post optimized head value note that without the optimization, it's difficult to traverse libformula's object model.
LValue[]
getOptimizedOperands()
Allows access to the post optimized operand array
InfixOperator[]
getOptimizedOperators()
Allows access to the post optimized operator array
void
initialize(FormulaContext context)
boolean
isConstant()
Checks, whether the LValue is constant.
String
toString()

Methods inherited from class org.jfree.formula.lvalues.AbstractLValue

clone, getChildValues, getContext, getValueType, initialize

Constructor Details

Term

public Term(LValue headValue)

Method Details

add

public void add(InfixOperator operator,
                LValue operand)

clone

public Object clone()
            throws CloneNotSupportedException
Specified by:
clone in interface LValue
Overrides:
clone in interface AbstractLValue

evaluate

public TypeValuePair evaluate()
            throws EvaluationException
Specified by:
evaluate in interface LValue

getChildValues

public LValue[] getChildValues()
Returns any dependent lvalues (parameters and operands, mostly).
Specified by:
getChildValues in interface LValue
Overrides:
getChildValues in interface AbstractLValue
Returns:

getHeadValue

public LValue getHeadValue()

getOperands

public InfixOperator[] getOperands()

getOperators

public LValue[] getOperators()

getOptimizedHeadValue

public LValue getOptimizedHeadValue()
Allows access to the post optimized head value note that without the optimization, it's difficult to traverse libformula's object model.
Returns:
optimized head value

getOptimizedOperands

public LValue[] getOptimizedOperands()
Allows access to the post optimized operand array
Returns:
optimized operand array

getOptimizedOperators

public InfixOperator[] getOptimizedOperators()
Allows access to the post optimized operator array
Returns:
optimized operator array

initialize

public void initialize(FormulaContext context)
            throws EvaluationException
Specified by:
initialize in interface LValue
Overrides:
initialize in interface AbstractLValue

isConstant

public boolean isConstant()
Checks, whether the LValue is constant. Constant lvalues always return the same value.
Specified by:
isConstant in interface LValue
Returns:

toString

public String toString()