public class Assignment extends Function
expressions, maxOperandsfactory, type| Constructor and Description |
|---|
Assignment()
Creates a default Assignment.
|
Assignment(java.lang.String name)
Creates a named Assignment.
|
Assignment(java.lang.String name,
java.lang.String type)
Creates a named and typed Assignment.
|
| Modifier and Type | Method and Description |
|---|---|
Assignment |
addExpression(Expression expression)
Adds an expression as an operand to this Assignment expression.
|
java.lang.Object |
evaluate()
Executes this Assignment on its operands.
|
protected void |
nameCheck()
Checks the operator name of this Assignment expression and sets the
maximum number of operands to two.
|
void |
rebind()
Rebinds the unbound operands of this Assignment.
|
void |
rebind(java.lang.Object result)
Rebinds the unbound operands of this Assignment, so that it yields the
given (null) result.
|
Assignment |
setType(java.lang.String type)
Sets the type of this Assignment.
|
protected void |
typeCheck()
Checks that the operand types of this Assignment are consistent, and
the result type is Void.
|
assign, equals, getExpressions, getType, hashCode, isAssignable, isBound, operand, resolve, setName, toString, unbindgetName, isBottom, isOrderedsafeEquals, safeHashCode, semanticErrorpublic Assignment()
public Assignment(java.lang.String name)
name - the operator name.public Assignment(java.lang.String name,
java.lang.String type)
name - the assignment operator name.type - the type of the assignment, "Void".protected void nameCheck()
protected void typeCheck()
throws SemanticError
typeCheck in class FunctionSemanticError - if a type inconsistency is detected.public Assignment setType(java.lang.String type)
setType in class Expressiontype - the type to set.public Assignment addExpression(Expression expression)
addExpression in class Functionexpression - the operand expression.public java.lang.Object evaluate()
evaluate in class Expressionpublic void rebind()
public void rebind(java.lang.Object result)
rebind in class Expressionresult - the desired bound value.