|
||||||||||
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.UnaryMinusExpression
public class UnaryMinusExpression
An Expression to perform an arithmetic sign inversion (unary minus) of a sub-expression.
Constructor Summary | |
---|---|
UnaryMinusExpression(Expression subExpression)
Creates a new UnaryMinusExpression with the given sub-expression. |
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 the logical negation of the sub-expression. |
Expression |
getSubExpression()
Gets the Expression which is being sign inverted by this one. |
List |
getSubExpressions()
Returns a list containing this UnaryMinusExpression and the expression to be sign inverted (in that order). |
int |
hashCode()
Returns the hash code for this UnaryMinusExpression. |
String |
toString()
Returns a String representation of this UnaryMinusExpression. |
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 UnaryMinusExpression(Expression subExpression) throws EvaluationException
subExpression
- The expression whose result will be sign inverted
when evaluated.
IllegalArgumentException
- If the sub expression is null.
EvaluationException
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 the sub-expression fails evaluation,
or does not return a Boolean value.public Expression getSubExpression()
public List getSubExpressions()
getSubExpressions
in class Expression
public void acceptVisitor(ExpressionVisitor visitor)
Expression
acceptVisitor
in class Expression
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |