|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.christopherschultz.evaluator.Expression net.christopherschultz.evaluator.ConstantExpression
public class ConstantExpression
An Expression which represents a fixed value (a constant).
Constructor Summary | |
---|---|
ConstantExpression(Object value)
Creates a new ConstantExpression with the given value. |
Method Summary | |
---|---|
void |
acceptVisitor(ExpressionVisitor visitor)
Accepts an ExpressionVisitor. |
boolean |
equals(Object o)
Returns true if the specified object is equal to
this one. |
Object |
evaluate(EvaluationContext ec)
Evaluates this Expression by returning its constant value. |
List |
getSubExpressions()
Returns a list containing a single element: this ConstantExpression. |
Object |
getValue()
Gets the value of this constant Expression. |
int |
hashCode()
Returns the hash code for this ConstantExpression. |
String |
toString()
Returns a String representation of this Expression. |
Methods inherited from class net.christopherschultz.evaluator.Expression |
---|
getParent, setParent |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConstantExpression(Object value)
value
- The value of the new ConstantExpressions.
IllegalArgumentException
- If the value is null
.Method Detail |
---|
public Object evaluate(EvaluationContext ec) throws EvaluationException
evaluate
in class Expression
ec
- The EvaluationContext in which this expression should
be evaluated.
EvaluationException
- If there is an error evaluating
this Expression.public List getSubExpressions()
getSubExpressions
in class Expression
public Object getValue()
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public boolean equals(Object o)
true
if the specified object is equal to
this one.
equals
in class Object
o
- The object to test for equality.
true
if the specified object is equal to
this one, false
otherwise.public void acceptVisitor(ExpressionVisitor visitor)
Expression
acceptVisitor
in class Expression
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |