ptolemy.actor.gt.data
Class MatchResult

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by ptolemy.actor.gt.data.TwoWayHashMap<K,V>
              extended by ptolemy.actor.gt.data.SequentialTwoWayHashMap<java.lang.Object,java.lang.Object>
                  extended by ptolemy.actor.gt.data.MatchResult
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class MatchResult
extends SequentialTwoWayHashMap<java.lang.Object,java.lang.Object>

A two-way hash map data structure to store matches found in a pattern matching.

Since:
Ptolemy II 8.0
Version:
$Id: MatchResult.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Field Summary
private  SequentialTwoWayHashMap<ValueIterator,Token> _parameterValues
          The assignment of values to the parameters.
 
Constructor Summary
MatchResult()
          Construct an empty match result.
MatchResult(SequentialTwoWayHashMap<ValueIterator,Token> parameterValues)
          Construct an empty match result and tag it to be obtained by a specific assignment to the parameters.
 
Method Summary
 java.lang.Object clone()
          Clone this match result and return the clone.
 SequentialTwoWayHashMap<ValueIterator,Token> getParameterValues()
          Get the parameter assignment.
 java.lang.String toString()
          Generate a string describing this match result, ignoring the matches between objects that are not instances of NamedObj.
 java.lang.String toString(boolean allMatches)
          Generate a string describing this match result.
 
Methods inherited from class ptolemy.actor.gt.data.SequentialTwoWayHashMap
clear, keys, put, remove, removeLast, retain
 
Methods inherited from class ptolemy.actor.gt.data.TwoWayHashMap
containsValue, getKey, values
 
Methods inherited from class java.util.HashMap
containsKey, entrySet, get, isEmpty, keySet, putAll, size
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

_parameterValues

private SequentialTwoWayHashMap<ValueIterator,Token> _parameterValues
The assignment of values to the parameters.

Constructor Detail

MatchResult

public MatchResult()
Construct an empty match result.


MatchResult

public MatchResult(SequentialTwoWayHashMap<ValueIterator,Token> parameterValues)
Construct an empty match result and tag it to be obtained by a specific assignment to the parameters.

Parameters:
parameterValues - The two-way hash map specifying the assignment to the parameters. In this case, values may be the same for some keys because the reverse hash map is never used.
Method Detail

clone

public java.lang.Object clone()
Clone this match result and return the clone.

Overrides:
clone in class SequentialTwoWayHashMap<java.lang.Object,java.lang.Object>
Returns:
The clone.

getParameterValues

public SequentialTwoWayHashMap<ValueIterator,Token> getParameterValues()
Get the parameter assignment.

Returns:
The two-way hash map for the assignment.

toString

public java.lang.String toString()
Generate a string describing this match result, ignoring the matches between objects that are not instances of NamedObj.

Overrides:
toString in class java.util.AbstractMap<java.lang.Object,java.lang.Object>
Returns:
The string.

toString

public java.lang.String toString(boolean allMatches)
Generate a string describing this match result. If allMatches is false, the matches between objects that are not instances of NamedObj are ignored. Otherwise, those matches are also included in the string.

Parameters:
allMatches - Whether the matches between objects that are not instances of NamedObj are included.
Returns:
The string.