public class Projection extends Function
expressions, maxOperandsfactory, type| Constructor and Description |
|---|
Projection()
Creates a default Projection.
|
Projection(java.lang.String name)
Creates a Projection with the given operator name.
|
Projection(java.lang.String name,
java.lang.String type)
Creates a Projection with the given operator name and result type.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
evaluate()
Evaluates this Projection expression.
|
protected java.lang.Object |
first(java.lang.Object pair)
Returns the first projection from an ordered pair.
|
java.lang.String |
getType()
Returns the result type of this Projection.
|
protected void |
nameCheck()
Checks the name of this Projection expression and sets the number
of operands to one for a projection and two for a pair construction.
|
protected java.util.Map.Entry<java.lang.Object,java.lang.Object> |
pair(java.lang.Object first,
java.lang.Object second)
Returns a new ordered pair, consisting of the first and second objects.
|
void |
rebind(java.lang.Object result)
Rebinds the unbound parameters in this Projection expression, so that
it yields the given expected result.
|
protected java.lang.Object |
second(java.lang.Object pair)
Returns the second projection from an ordered pair.
|
protected void |
typeCheck()
Checks that the types of the operands and result are consistent.
|
addExpression, assign, equals, getExpressions, hashCode, isAssignable, isBound, operand, rebind, resolve, setName, toString, unbindgetName, isBottom, isOrdered, setTypesafeEquals, safeHashCode, semanticErrorpublic Projection()
public Projection(java.lang.String name)
name - the projection operator name.public Projection(java.lang.String name,
java.lang.String type)
name - the projection operator name.type - the result type of this operator.protected void nameCheck()
throws SemanticError
nameCheck in class FunctionSemanticError - if the name is illegal.protected void typeCheck()
throws SemanticError
typeCheck in class FunctionSemanticError - if a type inconsistency is detected.public java.lang.String getType()
getType in class FunctionSemanticError - if no type can be inferred.public java.lang.Object evaluate()
evaluate in class Expressionprotected java.util.Map.Entry<java.lang.Object,java.lang.Object> pair(java.lang.Object first,
java.lang.Object second)
first - the first projection.second - the second projection.protected java.lang.Object first(java.lang.Object pair)
pair - the ordered pair.protected java.lang.Object second(java.lang.Object pair)
pair - the ordered pair.public void rebind(java.lang.Object result)
rebind in class Expressionresult - the desired bound value.