ix.util.match
Class MatchEnv
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
ix.util.match.MatchEnv
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map
public class MatchEnv
- extends java.util.HashMap
A root class for objects that contain the bindings that result
from pattern-matching.
MatchEnvs are not used automatically in MatchTable-based matching;
they are merely available in case they are useful. For instance, a
MatchCase tryMatch method might construct a MatchEnv while matching
and return it if the match succeeds. It would then be passed to
the MatchCase's ifSelected method by the MatchTable.
- See Also:
MatchTable
,
MatchCase
,
Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Method Summary |
java.lang.Object |
checkedPut(java.lang.Object key,
java.lang.Object value)
|
java.util.Map |
getVariableBindings(java.lang.Class variableClass)
Returns a Map containing any variable-to-value pairs specified
by this MatchEnv for instances of the specified variable class. |
java.lang.Object |
instantiate(java.lang.Object obj,
Function1 ifUnbound)
|
java.lang.Object |
instantiateTree(java.lang.Object tree,
Function1 ifUnbound)
|
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
MatchEnv
public MatchEnv()
MatchEnv
public MatchEnv(java.util.Map t)
checkedPut
public java.lang.Object checkedPut(java.lang.Object key,
java.lang.Object value)
getVariableBindings
public java.util.Map getVariableBindings(java.lang.Class variableClass)
- Returns a Map containing any variable-to-value pairs specified
by this MatchEnv for instances of the specified variable class.
- Returns:
- a nonEmpty Map if any variable bindings were specified,
otherwise null.
instantiate
public java.lang.Object instantiate(java.lang.Object obj,
Function1 ifUnbound)
instantiateTree
public java.lang.Object instantiateTree(java.lang.Object tree,
Function1 ifUnbound)