public class UnaryOperation extends Operation<UnaryOperator>
Constructor and Description |
---|
UnaryOperation(UnaryOperator operator,
Expression operand)
Creates a new unary operation.
|
Modifier and Type | Method and Description |
---|---|
Object |
accept(ExpressionVisitor visitor)
Accepts to visit the given expression visitor.
|
Value |
evaluate()
Evaluates the expression and returns the result.
|
Expression |
getOperand()
Returns the operand.
|
String |
toString() |
getOperator
public UnaryOperation(UnaryOperator operator, Expression operand)
operator
- the unary operatoroperand
- the operandpublic Value evaluate() throws IllegalValueTypeException
Expression
IllegalValueTypeException
- if a value of an unexpected type was
encountered when evaluating the expressionpublic Expression getOperand()
public Object accept(ExpressionVisitor visitor)
Expression
visitor
- the visitor