ch.uzh.ifi.attempto.chartparser
Class BackrefCategory

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

public class BackrefCategory
extends Nonterminal

This class stands for backward refernces. In contrast to all other categories, backward references can have multiple feature maps. They have one or more "positive" feature maps and zero or more "negative" feature maps.

Author:
Tobias Kuhn

Field Summary
protected  java.util.List<FeatureMap> negFeatureMaps
          The negative feature maps of the backward reference.
protected  java.util.List<FeatureMap> posFeatureMaps
          The positive feature maps of the backward reference.
 
Fields inherited from class ch.uzh.ifi.attempto.chartparser.Category
featureMap, name, specialCategories
 
Constructor Summary
BackrefCategory()
          Creates a new backward reference.
 
Method Summary
 void addNegFeatureMap(FeatureMap fm)
          Adds a negative feature map in the case of backward references, or does nothing for all other categories.
 void addPosFeatureMap(FeatureMap fm)
          Adds a positive feature map in the case of backward references, or does nothing for all other categories.
 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.
 java.util.List<FeatureMap> getNegFeatureMaps()
          This method returns the list of negative feature maps for backward references, or null for all other categories.
 java.util.List<FeatureMap> getPosFeatureMaps()
          This method returns the list of positive feature maps for backward references, or null for all other categories.
protected  java.lang.String getType()
          This method returns the type of the category.
 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.Nonterminal
setFeatureMap
 
Methods inherited from class ch.uzh.ifi.attempto.chartparser.Category
canUnify, deepCopy, equals, getFeature, getFeatureMap, getName, isSpecialCategory, setFeature, setFeature
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

posFeatureMaps

protected java.util.List<FeatureMap> posFeatureMaps
The positive feature maps of the backward reference.


negFeatureMaps

protected java.util.List<FeatureMap> negFeatureMaps
The negative feature maps of the backward reference.

Constructor Detail

BackrefCategory

public BackrefCategory()
Creates a new backward reference. Positive and negative feature maps have to be added by using the respective methods.

Method Detail

getPosFeatureMaps

public java.util.List<FeatureMap> getPosFeatureMaps()
Description copied from class: Category
This method returns the list of positive feature maps for backward references, or null for all other categories.

Overrides:
getPosFeatureMaps in class Category
Returns:
The list of positive feature maps in the case of backward references.

getNegFeatureMaps

public java.util.List<FeatureMap> getNegFeatureMaps()
Description copied from class: Category
This method returns the list of negative feature maps for backward references, or null for all other categories.

Overrides:
getNegFeatureMaps in class Category
Returns:
The list of negative feature maps in the case of backward references.

addPosFeatureMap

public void addPosFeatureMap(FeatureMap fm)
Description copied from class: Category
Adds a positive feature map in the case of backward references, or does nothing for all other categories.

Overrides:
addPosFeatureMap in class Category
Parameters:
fm - The positive feature map to be added.

addNegFeatureMap

public void addNegFeatureMap(FeatureMap fm)
Description copied from class: Category
Adds a negative feature map in the case of backward references, or does nothing for all other categories.

Overrides:
addNegFeatureMap in class Category
Parameters:
fm - The negative feature map to be added.

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.

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.

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.

Overrides:
getType in class Nonterminal
Returns:
The type of the category.

toString

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


Copyright 2008-2012, AceWiki developers