Class MatchEnv

  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by 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 Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
Constructor Summary
MatchEnv(java.util.Map t)
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

Constructor Detail


public MatchEnv()


public MatchEnv(java.util.Map t)
Method Detail


public java.lang.Object checkedPut(java.lang.Object key,
                                   java.lang.Object value)


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.

a nonEmpty Map if any variable bindings were specified, otherwise null.


public java.lang.Object instantiate(java.lang.Object obj,
                                    Function1 ifUnbound)


public java.lang.Object instantiateTree(java.lang.Object tree,
                                        Function1 ifUnbound)