public class Assignment extends Function
expressions, maxOperands
factory, 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, unbind
getName, isBottom, isOrdered
safeEquals, safeHashCode, semanticError
public 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 Function
SemanticError
- if a type inconsistency is detected.public Assignment setType(java.lang.String type)
setType
in class Expression
type
- the type to set.public Assignment addExpression(Expression expression)
addExpression
in class Function
expression
- the operand expression.public java.lang.Object evaluate()
evaluate
in class Expression
public void rebind()
public void rebind(java.lang.Object result)
rebind
in class Expression
result
- the desired bound value.