ch.uzh.ifi.attempto.chartparser
Class Category

java.lang.Object
  extended by ch.uzh.ifi.attempto.chartparser.Category
Direct Known Subclasses:
Nonterminal, Terminal

public abstract class Category
extends java.lang.Object

This class represents a grammatical category.

Author:
Tobias Kuhn

Constructor Summary
Category(java.lang.String name)
          Creates a new category.
 
Method Summary
 Category deepCopy()
          Creates a deep copy of this category.
 Category deepCopy(java.util.HashMap<java.lang.Integer,ch.uzh.ifi.attempto.chartparser.StringEntity> entities)
          Creates a deep copy of this category using the given string entities.
 boolean equals(java.lang.Object obj)
           
 StringRef getFeature(java.lang.String featureName)
          Returns a feature value.
 java.lang.String getName()
          Returns the name of the category.
 void setFeature(java.lang.String featureName, StringRef featureValue)
          Sets a feature.
 void skolemize()
          Skolemizes the feature values of this category.
 java.lang.String toString()
           
 void tryToUnify(Category category)
          Tries to unify this category with another category.
 void unify(Category category)
          Unifies this category with another category.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Category

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

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

getName

public java.lang.String getName()
Returns the name of the category.

Returns:
The name of the category.

setFeature

public void setFeature(java.lang.String featureName,
                       StringRef featureValue)
Sets a feature.

Parameters:
featureName - The feature name
featureValue -

getFeature

public StringRef getFeature(java.lang.String featureName)
Returns a feature value.

Parameters:
featureName - The name of the feature.
Returns:
The value of the feature.

unify

public void unify(Category category)
           throws UnificationFailedException
Unifies this category with another category. Two categories can unify if and only if they have the same names 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.

Parameters:
category - The category to be unified with this category.
Throws:
UnificationFailedException - If unification fails.

tryToUnify

public void tryToUnify(Category category)
                throws UnificationFailedException
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.

Parameters:
category - The category to be unified with this category.
Throws:
UnificationFailedException - If unification fails.

skolemize

public void skolemize()
Skolemizes the feature values of this category.


deepCopy

public Category deepCopy()
Creates a deep copy of this category.

Returns:
A deep copy.

deepCopy

public Category deepCopy(java.util.HashMap<java.lang.Integer,ch.uzh.ifi.attempto.chartparser.StringEntity> entities)
Creates a deep copy of this category using the given string entities. This method is usually called form another deepCopy-method.

Parameters:
entities - The string entities to be used.
Returns:
A deep copy.

equals

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

toString

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


Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch)