torero.model
Class AttributeMap

java.lang.Object
  |
  +--torero.model.AttributeMap
All Implemented Interfaces:
Serializable

public class AttributeMap
extends Object
implements Serializable

The AttributeMap is a collection used for creation and lookup of Attributes for a specific grammar. It ensures the uniqueness of the Attributes defined in it.

See Also:
Serialized Form

Constructor Summary
AttributeMap()
           
 
Method Summary
 boolean contains(String attribname)
          Returns true if an Attribute or Traversal with that name exists.
 Collection getAttributes()
          Returns all Attributes in this AttributeMap as Collection.
 Collection getAttributesAndTraversals()
          Returns all Attributes and Traversals in this AttributeMap as Collection.
 int getAttributeSize()
          Returns the number of Attributes and Traversals in this AttributeMap.
 Collection getTraversals()
          Returns all Traversals in this AttributeMap as Collection.
 Attribute obtainAttribute(String name)
          If an Attribute with the given name already exists its given back - otherwhise a new one is created and given back.
 Traversal obtainTraversal(String name)
          If a Traversal with the given name already exists its given back - otherwhise a new one is created and given back.
 void removeAttribute(Attribute attribute)
          This method removes the given Attribute from the AttributeMap.
protected  void updateEntry(Attribute attrib, String oldname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeMap

public AttributeMap()
Method Detail

obtainAttribute

public Attribute obtainAttribute(String name)
If an Attribute with the given name already exists its given back - otherwhise a new one is created and given back. If a Traversal with the given name already exists null is returned.
Parameters:
name - takes the Name of the Attribute that should be obtained.
Returns:
an Attribute or null

obtainTraversal

public Traversal obtainTraversal(String name)
If a Traversal with the given name already exists its given back - otherwhise a new one is created and given back. If an Attribute with the given name already exists null is returned.
Parameters:
name - takes the Name of the Traversal that should be obtained.
Returns:
a Traversal or null

contains

public boolean contains(String attribname)
Returns true if an Attribute or Traversal with that name exists.
Returns:
returns true if an Attribute or Traversal with that name exists

updateEntry

protected void updateEntry(Attribute attrib,
                           String oldname)

getAttributeSize

public int getAttributeSize()
Returns the number of Attributes and Traversals in this AttributeMap.
Returns:
returns the number of Attributes and Traversals in this AttributeMap

getAttributesAndTraversals

public Collection getAttributesAndTraversals()
Returns all Attributes and Traversals in this AttributeMap as Collection.
Returns:
returns all Attributes and Traversals in this AttributeMap as Collection

getAttributes

public Collection getAttributes()
Returns all Attributes in this AttributeMap as Collection.
Returns:
returns all Attributes in this AttributeMap as Collection

getTraversals

public Collection getTraversals()
Returns all Traversals in this AttributeMap as Collection.
Returns:
returns all Traversals in this AttributeMap as Collection

removeAttribute

public void removeAttribute(Attribute attribute)
This method removes the given Attribute from the AttributeMap.
Parameters:
attribute - takes the Attribute to remove from the AttributeMap