public class Manipulation extends Function
expressions, maxOperandsfactory, type| Constructor and Description |
|---|
Manipulation()
Creates a default Manipulation expression.
|
Manipulation(java.lang.String name)
Creates a named Manipulation expression.
|
Manipulation(java.lang.String name,
java.lang.String type)
Creates a named and typed Manipulation expression.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
evaluate()
Executes this Manipulation on its operands.
|
java.lang.String |
getType()
Returns the result type of this Manipulation.
|
protected java.lang.Object |
insert(java.lang.Object collection,
java.lang.Object value)
Returns a new collection in which the value has been inserted.
|
protected java.lang.Object |
insertAll(java.lang.Object first,
java.lang.Object second)
Returns a new collection containing all of the first and second
collections.
|
protected java.lang.Object |
insertAt(java.lang.Object collection,
java.lang.Object key,
java.lang.Object value)
Returns a new collection, in which a value is inserted opposite a key
or index.
|
protected void |
nameCheck()
Checks the name of this Manipulation expression and sets the expected
number of operands.
|
void |
rebind(java.lang.Object result)
Rebinds the unbound operands of this Manipulation expression, so that it
yields the given expected result.
|
protected java.lang.Object |
remove(java.lang.Object collection,
java.lang.Object value)
Returns a new collection in which the value has been removed.
|
protected java.lang.Object |
removeAll(java.lang.Object first,
java.lang.Object second)
Returns a new collection containing those elements from the first,
which were not present in the second collection.
|
protected java.lang.Object |
removeAt(java.lang.Object collection,
java.lang.Object key)
Returns a new collection, in which a value is removed opposite a key
or index.
|
protected java.lang.Object |
replaceAt(java.lang.Object collection,
java.lang.Object key,
java.lang.Object value)
Returns a new collection, in which a value is replaced opposite a key
or index.
|
protected java.lang.Object |
searchAt(java.lang.Object collection,
java.lang.Object key)
Searches a collection and returns the object found opposite a given
key or index.
|
protected java.lang.Integer |
size(java.lang.Object collection)
Returns the size or cardinality of a collection.
|
protected void |
typeCheck()
Checks that the operand and result types are consistent.
|
addExpression, assign, equals, getExpressions, hashCode, isAssignable, isBound, operand, rebind, resolve, setName, toString, unbindgetName, isBottom, isOrdered, setTypesafeEquals, safeHashCode, semanticErrorpublic Manipulation()
public Manipulation(java.lang.String name)
name - the set-theoretic operator name.public Manipulation(java.lang.String name,
java.lang.String type)
name - the name of the set-theoretic operator.type - the result type of the expression.protected void nameCheck()
protected void typeCheck()
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.lang.Integer size(java.lang.Object collection)
collection - the collection.protected java.lang.Object insert(java.lang.Object collection,
java.lang.Object value)
collection - the input collection.value - the value to insert.protected java.lang.Object remove(java.lang.Object collection,
java.lang.Object value)
collection - the input collection.value - the value to remove.protected java.lang.Object insertAll(java.lang.Object first,
java.lang.Object second)
first - the first collection.second - the second collection.protected java.lang.Object removeAll(java.lang.Object first,
java.lang.Object second)
first - the first collection.second - the second collection.protected java.lang.Object insertAt(java.lang.Object collection,
java.lang.Object key,
java.lang.Object value)
collection - the input Map or List.key - a key or Integer index.value - the value to insert.protected java.lang.Object removeAt(java.lang.Object collection,
java.lang.Object key)
collection - the input Map or List.key - a key or Integer index.protected java.lang.Object replaceAt(java.lang.Object collection,
java.lang.Object key,
java.lang.Object value)
collection - the input Map or List.key - a key or Integer index.value - the value to replace.protected java.lang.Object searchAt(java.lang.Object collection,
java.lang.Object key)
collection - the input Map or List.key - a key or Integer index.public void rebind(java.lang.Object result)
rebind in class Expressionresult - the expected result of this Manipulation expression.