ch.uzh.ifi.attempto.chartparser
Class Terminal

java.lang.Object
  extended by ch.uzh.ifi.attempto.chartparser.Category
      extended by ch.uzh.ifi.attempto.chartparser.Terminal

public class Terminal
extends Category

This class stands for a terminal category. Terminal categories consists only of a name and cannot have features. The names of terminal categories correspond to the tokens in the text to be parsed.

Author:
Tobias Kuhn

Field Summary
 
Fields inherited from class ch.uzh.ifi.attempto.chartparser.Category
featureMap, name, specialCategories
 
Constructor Summary
Terminal(java.lang.String name)
          Creates a new terminal category.
 
Method Summary
 boolean canUnify(Category c)
          This method detects whether this category can unify with the given category.
 Category deepCopy()
          Creates a deep copy of this category.
 boolean equals(java.lang.Object obj)
           
 java.util.Set<java.lang.String> getFeatureNames()
          Returns the used feature names within the feature map.
 java.util.Collection<StringRef> getFeatureValues()
          Returns the used feature values within the feature map.
protected  java.lang.String getType()
          This method returns the type of the category.
 int hashCode()
           
 boolean isSimilar(Category c)
          This methods checks whether two categories are similar.
 void skolemize()
          Skolemizes the feature values of this category.
 boolean subsumes(Category c)
          This method returns true if this category subsumes (in other words "is more general than") the given category, or false otherwise.
 java.lang.String toString()
           
 void tryToUnify(Category c)
          Tries to unify this category with another category.
 void unify(Category c)
          Unifies this category with another category.
 
Methods inherited from class ch.uzh.ifi.attempto.chartparser.Category
addNegFeatureMap, addPosFeatureMap, getFeature, getFeatureMap, getName, getNegFeatureMaps, getPosFeatureMaps, isSpecialCategory, setFeature, setFeature
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Terminal

public Terminal(java.lang.String name)
Creates a new terminal category.

Parameters:
name - The name of the terminal category.
Method Detail

getType

protected java.lang.String getType()
Description copied from class: Category
This method returns the type of the category. For example, "term" is returned for terminal categories and "nonterm" for non-terminal ones.

Specified by:
getType in class Category
Returns:
The type of the category.

unify

public void unify(Category c)
           throws UnificationFailedException
Description copied from class: Category
Unifies this category with another category. Two categories can unify if and only if they have the same names and the same types and they have no features with conflicting values. If the unification fails, a UnificationFailedException is thrown. In this case, the two categories remain partly unified, i.e. no backtracking is done. Thus, this operation should be perfomed only if it is certain that the unification succeeds, or if the operation is performed on copies of objects that are not used anymore afterwards.

Overrides:
unify in class Category
Parameters:
c - The category to be unified with this category.
Throws:
UnificationFailedException - If unification fails.

tryToUnify

public void tryToUnify(Category c)
                throws UnificationFailedException
Description copied from class: Category
Tries to unify this category with another category. If unification is not possible, an exception is thrown. In the case unification would be possible, the unification is not performed completely. In any case the two categories remain in an unconsistent state afterwards. Thus, this operation should be performed only on copies of objects that are not used anymore afterwards.

Overrides:
tryToUnify in class Category
Parameters:
c - The category to be unified with this category.
Throws:
UnificationFailedException - If unification fails.

canUnify

public boolean canUnify(Category c)
Description copied from class: Category
This method detects whether this category can unify with the given category. Neither of the two categories are changed.

Overrides:
canUnify in class Category
Parameters:
c - The category for the unification check.
Returns:
true if the two categories can unify.

isSimilar

public boolean isSimilar(Category c)
Description copied from class: Category
This methods checks whether two categories are similar. Two categories are similar if and only if the categories have the same name and the same type and no feature with the same name is present in both categories with values that do not unify locally. Two categories that are unifiable are always similar, but not necessarily vice versa. This check for similarity is computationally less expensive than the check for unification.

Overrides:
isSimilar in class Category
Parameters:
c - The category for which similarity with this category should be checked.
Returns:
true if the two categories are similar.

subsumes

public boolean subsumes(Category c)
Description copied from class: Category
This method returns true if this category subsumes (in other words "is more general than") the given category, or false otherwise.

Overrides:
subsumes in class Category
Parameters:
c - The category for which it is checked whether this category subsumes it.
Returns:
true if this category subsumes the given category.

skolemize

public void skolemize()
Description copied from class: Category
Skolemizes the feature values of this category.

Overrides:
skolemize in class Category

getFeatureNames

public java.util.Set<java.lang.String> getFeatureNames()
Description copied from class: Category
Returns the used feature names within the feature map.

Overrides:
getFeatureNames in class Category
Returns:
The used feature names.

getFeatureValues

public java.util.Collection<StringRef> getFeatureValues()
Description copied from class: Category
Returns the used feature values within the feature map.

Overrides:
getFeatureValues in class Category
Returns:
The used feature values.

deepCopy

public Category deepCopy()
Description copied from class: Category
Creates a deep copy of this category.

Overrides:
deepCopy in class Category
Returns:
A deep copy.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Category

toString

public java.lang.String toString()
Specified by:
toString in class Category


Copyright 2008-2012, AceWiki developers