opennlp.grok.unify
Class GSubstitution

java.lang.Object
  |
  +--gnu.trove.THash
        |
        +--gnu.trove.TObjectHash
              |
              +--gnu.trove.THashMap
                    |
                    +--opennlp.grok.unify.GSubstitution
All Implemented Interfaces:
java.util.Map, java.io.Serializable, opennlp.common.unify.Substitution, gnu.trove.TObjectHashingStrategy

public class GSubstitution
extends gnu.trove.THashMap
implements opennlp.common.unify.Substitution

Implementation of Substitution interface which ensures that all the categories it contains are updated as new substitutions are made.

Version:
$Revision: 1.7 $, $Date: 2003/02/07 16:53:56 $
Author:
Jason Baldridge
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.trove.THashMap
_values
 
Fields inherited from class gnu.trove.TObjectHash
_set, REMOVED
 
Fields inherited from class gnu.trove.THash
_free, _loadFactor, _maxSize, _size, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR
 
Constructor Summary
GSubstitution()
           
 
Method Summary
 void addIndexedObject(int index, java.lang.Object o)
           
 void addReindex(int oldIndex, int newIndex)
           
 void condense()
           
 java.lang.Object getIndexedObject(int index)
           
 int getUpdatedIndex(int oldIndex)
           
 java.lang.Object getValue(opennlp.common.unify.Variable var)
          Try to get the value of a variable from this Substitution.
 int makeNewIndex(int fs1Index, int fs2Index)
           
 java.lang.Object makeSubstitution(opennlp.common.unify.Variable var, java.lang.Object u)
          Request the Substitution to identify a variable with an object.
 java.lang.String toString()
           
 java.util.Iterator varIterator()
           
 
Methods inherited from class gnu.trove.THashMap
clear, containsKey, containsValue, entrySet, equals, forEachEntry, forEachKey, forEachValue, get, keySet, put, putAll, rehash, remove, removeAt, retainEntries, setUp, transformValues, values
 
Methods inherited from class gnu.trove.TObjectHash
capacity, computeHashCode, contains, equals, forEach, index, insertionIndex
 
Methods inherited from class gnu.trove.THash
compact, ensureCapacity, isEmpty, postInsertHook, size, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
hashCode, isEmpty, size
 

Constructor Detail

GSubstitution

public GSubstitution()
Method Detail

makeSubstitution

public java.lang.Object makeSubstitution(opennlp.common.unify.Variable var,
                                         java.lang.Object u)
                                  throws opennlp.common.unify.UnifyFailure
Request the Substitution to identify a variable with an object. Automagically condenses the Substitution so that all other values in this Substitution get the new value for the variable if they contain it.

Specified by:
makeSubstitution in interface opennlp.common.unify.Substitution
Parameters:
var - the variable whose value has been determined
Returns:
the Object identified with the variable, which has potentially undergone further unifications as a result of making the substitution
Throws:
throws - UnifyFailure if the Object cannot be unified with a previous value substituted for the Variable.
opennlp.common.unify.UnifyFailure

getValue

public java.lang.Object getValue(opennlp.common.unify.Variable var)
Try to get the value of a variable from this Substitution. Returns null if the variable is unknown to the Substitution.

Specified by:
getValue in interface opennlp.common.unify.Substitution
Parameters:
var - the variable whose value after unification is desired
Returns:
the Object which this variable has been unified with

varIterator

public java.util.Iterator varIterator()
Specified by:
varIterator in interface opennlp.common.unify.Substitution

makeNewIndex

public int makeNewIndex(int fs1Index,
                        int fs2Index)

addReindex

public void addReindex(int oldIndex,
                       int newIndex)

getUpdatedIndex

public int getUpdatedIndex(int oldIndex)

addIndexedObject

public void addIndexedObject(int index,
                             java.lang.Object o)

getIndexedObject

public java.lang.Object getIndexedObject(int index)

condense

public void condense()
              throws opennlp.common.unify.UnifyFailure
opennlp.common.unify.UnifyFailure

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003 Jason Baldridge and Gann Bierner. All Rights Reserved.