Class FeatureSet

java.lang.Object
  extended byjava.util.AbstractMap
      extended byAssociationList
          extended byFeatureSet
All Implemented Interfaces:
java.util.Map

public class FeatureSet
extends AssociationList

A FeatureSet is a set of name/value pairs representing the features of a constituent. The names are Symbols. The values are Unifiables (Symbol, Variable, or Expression).

Implementation note: The traditional implementation of this is an alist, so we use an AssociationList. Since feature set unification is the most important thing we do, it might make sense to pick a better data structure. For example, since we call entrySet() on each call to unifyWith(), we should probably avoid the cost of allocating those items over and over and just keep the names and values in parallel lists (which would be linear time to lookup but no extra cost to iterate over, and anyway the feature sets are small).


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractMap
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class AssociationList
entries
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
FeatureSet()
           
 
Method Summary
 FeatureSet copyWithBindings(BindingSet bindings)
          Returns a copy of this FeatureSet with the given bindings applied.
 Unifiable getFeatureValue(Symbol name)
          returns the value of the given feature in this FeatureSet.
 void setFeatureValue(Symbol name, Unifiable value)
          Set the value of the given feature in this FeatureSet.
 java.lang.String toString()
          Returns the String representation of this FeatureSet.
 boolean unifyWith(FeatureSet other, BindingSet bindings)
          Returns true if this FeatureSet unifies with the given one, and puts the unifying substitution in the given BindingSet.
 
Methods inherited from class AssociationList
entrySet, put
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values
 

Constructor Detail

FeatureSet

public FeatureSet()
Method Detail

setFeatureValue

public void setFeatureValue(Symbol name,
                            Unifiable value)
Set the value of the given feature in this FeatureSet.


getFeatureValue

public Unifiable getFeatureValue(Symbol name)
returns the value of the given feature in this FeatureSet.


toString

public java.lang.String toString()
Returns the String representation of this FeatureSet.


unifyWith

public boolean unifyWith(FeatureSet other,
                         BindingSet bindings)
Returns true if this FeatureSet unifies with the given one, and puts the unifying substitution in the given BindingSet. Two FeatureSets unify if the values of features present in both sets unify (features in only one set don't need to be checked).


copyWithBindings

public FeatureSet copyWithBindings(BindingSet bindings)
Returns a copy of this FeatureSet with the given bindings applied.