notio.translators
Class DefiningLabelTable

java.lang.Object
  |
  +--notio.translators.SimpleInfoUnit
        |
        +--notio.translators.DefiningLabelTable
All Implemented Interfaces:
java.io.Serializable, TranslationInfoUnit

public class DefiningLabelTable
extends SimpleInfoUnit

A TranslationInfoUnit that serves as a symbol table relating defining labels to defining concepts and coreference sets. This table allows stack-like operations for maintaining label scope.

See Also:
Serialized Form

Inner Class Summary
 class DefiningLabelTable.TableEntry
          An inner class used to hold table entries.
 
Constructor Summary
DefiningLabelTable()
          Constructs a new DefiningLabelTable.
DefiningLabelTable(DefiningLabelTable orgTable)
          Constructs a new DefiningLabelTable by copying the specified table.
 
Method Summary
 void addBoundConcept(java.lang.String newLabel, Concept newBoundConcept)
          Adds an entry to the table that relates the specified label to the specified bound concept.
 void addCoreferenceSet(java.lang.String definingLabel, CoreferenceSet corefSet)
          Adds an entry to the table that relates the specified label to the specified coreference set.
 void addDefiningConcept(java.lang.String newLabel, Concept newDefConcept)
          Adds an entry to the table that relates the specified label to the specified defining concept.
 void clearDefiningLabelToCoreferenceSetMapping()
          Clears all existing mappings between coreference labels and coreference sets.
 void clearDefiningLabelToDefiningConceptMapping()
          Clears all existing mappings between defining concepts and defining labels.
 TranslationInfoUnit copyUnit()
          Returns a duplicate of this information unit that is distinct from the original.
 DefiningLabelTable.TableEntry findDefiningEntryByLabel(java.lang.String label)
          Finds the first (topmost) defining entry corresponding to the specified label.
 DefiningLabelTable.TableEntry findEntryByConcept(Concept concept)
          Finds the entry corresponding to the specified Concept.
 DefiningLabelTable.TableEntry findEntryByCoreferenceSet(CoreferenceSet corefSet)
          Finds the entry corresponding to the specified CoreferenceSet.
 DefiningLabelTable.TableEntry findEntryByDefiningConcept(Concept defConcept)
          Finds the entry corresponding to the specified defining Concept.
 DefiningLabelTable.TableEntry findFirstEntryByLabel(java.lang.String label)
          Finds the first (topmost) entry corresponding to the specified label.
 DefiningLabelTable.TableEntry findLocalEntryByLabel(java.lang.String label)
          Finds an entry in the current context corresponding to the specified label.
 int getCurrentContextLevel()
          Returns the current context level of this table.
 java.lang.String getLastDefiningLabel()
          Returns the last defining label generated by this context or null if no labels have generated.
 java.lang.String getNextAvailableDefiningLabel()
          Returns a new defining label that is not already present in the defining label/coreference set mapping.
 void popContext()
          Pops a context off the stack.
 void pushContext()
          Pushes a new context onto the stack.
 void resetAvailableDefiningLabel()
          Resets the generator for defining labels so that it starts again.
 void resetUnit()
          Resets this information unit to its initial state.
 
Methods inherited from class notio.translators.SimpleInfoUnit
getUnitName, setUnitName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefiningLabelTable

public DefiningLabelTable()
Constructs a new DefiningLabelTable.

DefiningLabelTable

public DefiningLabelTable(DefiningLabelTable orgTable)
Constructs a new DefiningLabelTable by copying the specified table.
Parameters:
orgTable - the table to be copied.
Method Detail

pushContext

public final void pushContext()
Pushes a new context onto the stack. Any entries added to this table after the push will be removed when a corresponding pop is called.

popContext

public final void popContext()
Pops a context off the stack. Any entries added to this table since the corresponding the push will be removed.

findEntryByConcept

public final DefiningLabelTable.TableEntry findEntryByConcept(Concept concept)
Finds the entry corresponding to the specified Concept.
Parameters:
concept - the concept to be found.
Returns:
the entry, or null.

findEntryByDefiningConcept

public final DefiningLabelTable.TableEntry findEntryByDefiningConcept(Concept defConcept)
Finds the entry corresponding to the specified defining Concept. This returns null if the concept is not in the table or is not a defining concept.
Parameters:
defConcept - the defining concept to be found.
Returns:
the entry, or null.

findEntryByCoreferenceSet

public final DefiningLabelTable.TableEntry findEntryByCoreferenceSet(CoreferenceSet corefSet)
Finds the entry corresponding to the specified CoreferenceSet.
Parameters:
corefSet - the coreference set to be found.
Returns:
the entry, or null.

findLocalEntryByLabel

public final DefiningLabelTable.TableEntry findLocalEntryByLabel(java.lang.String label)
Finds an entry in the current context corresponding to the specified label.
Parameters:
label - the label to be found.
Returns:
the entry, or null.

findDefiningEntryByLabel

public final DefiningLabelTable.TableEntry findDefiningEntryByLabel(java.lang.String label)
Finds the first (topmost) defining entry corresponding to the specified label.
Parameters:
label - the label to be found.
Returns:
the entry, or null.

findFirstEntryByLabel

public final DefiningLabelTable.TableEntry findFirstEntryByLabel(java.lang.String label)
Finds the first (topmost) entry corresponding to the specified label.
Parameters:
label - the label to be found.
Returns:
the entry, or null.

addDefiningConcept

public final void addDefiningConcept(java.lang.String newLabel,
                                     Concept newDefConcept)
Adds an entry to the table that relates the specified label to the specified defining concept. If the defining concept has an associated coreference set, that set will also be included in the entry.
Parameters:
newLabel - the label to be be added.
newDefConcept - the defining concept to be added.

addBoundConcept

public final void addBoundConcept(java.lang.String newLabel,
                                  Concept newBoundConcept)
Adds an entry to the table that relates the specified label to the specified bound concept.
Parameters:
newLabel - the label to be be added.
newBoundConcept - the bound concept to be added.

addCoreferenceSet

public void addCoreferenceSet(java.lang.String definingLabel,
                              CoreferenceSet corefSet)
Adds an entry to the table that relates the specified label to the specified coreference set. If the coreference set is already associated with the label, nothing will done. If the coreference set has an associated defining concept, that concept will also be included in the entry.
Parameters:
definingLabel - the defining label being mapped.
corefSet - the coreference set being mapped.
Throws:
java.lang.IllegalArgumentException - if the label is already associated with some other coreference set, or if it is associated with a defining concept other than the one in the coreference set.

clearDefiningLabelToCoreferenceSetMapping

public void clearDefiningLabelToCoreferenceSetMapping()
Clears all existing mappings between coreference labels and coreference sets.

clearDefiningLabelToDefiningConceptMapping

public void clearDefiningLabelToDefiningConceptMapping()
Clears all existing mappings between defining concepts and defining labels.

getNextAvailableDefiningLabel

public java.lang.String getNextAvailableDefiningLabel()
Returns a new defining label that is not already present in the defining label/coreference set mapping. There are no constraints on the form of the label other than that they conform to a valid CGIF identifier. Otherwise, labels' forms are determined by the underlying implementation.
Returns:
a new, unique, and unused defining label.

resetAvailableDefiningLabel

public void resetAvailableDefiningLabel()
Resets the generator for defining labels so that it starts again. This method would typically be called after clearing the defining label - coreference set mapping so that labels may be reused in a new translation, if possible. Implementations are not required to honour this although they should silently do nothing rather than throwing an exception. If possible, implementations should reset their label generators so that they produce a sequence of labels as if this were a newly constructed context.

getCurrentContextLevel

public int getCurrentContextLevel()
Returns the current context level of this table. This is the number of contexts sitting on the stack minus one. It is never less than 0.
Returns:
the current context level of this table.

getLastDefiningLabel

public java.lang.String getLastDefiningLabel()
Returns the last defining label generated by this context or null if no labels have generated. Note that this method does not generated any new labels.
Returns:
the last defining label generated by this context or null.

resetUnit

public void resetUnit()
Resets this information unit to its initial state. This method can be called by translators in order to ensure that a unit contains no information relating to earlier translation sessions. This causes all contexts to be emptied and popped and fresh initial context pushed.

copyUnit

public TranslationInfoUnit copyUnit()
Returns a duplicate of this information unit that is distinct from the original. This means that changes to the original will not affect the duplicate and vice versa.
Returns:
a duplicate of this unit.


Copyright 1998-2001 Finnegan Southey