com.huguesjohnson.tiamat
Class AttributeCollection

java.lang.Object
  extended by com.huguesjohnson.tiamat.AttributeCollection

public class AttributeCollection
extends java.lang.Object

AttributeCollection - used to store a collection of attributes

Author:
Hugues Johnson

Constructor Summary
AttributeCollection()
          Default constructor, uses default pathDelimiter.
AttributeCollection(Attribute[] attributes)
          Create a new AttributeCollection based off an array of Attributes with a the default path delimiter.
AttributeCollection(Attribute[] attributes, java.lang.String pathDelimiter)
          Create a new AttributeCollection based off an array of Attributes with a custom path delimiter.
AttributeCollection(java.lang.String pathDelimiter)
          Create a new AttributeCollection with a custom path delimiter.
 
Method Summary
 Attribute[] getAll()
          Returns an array representing all Attributes in the collection.
 Attribute getAttribute(java.lang.String path)
          Return the Attribute with the specified path if it exists, otherwise null.
 int getCount()
          Returns the total number of Attributes in the collection.
 boolean removeAttribute(java.lang.String path)
          Remove the Attribute with the specified path.
 void setAttribute(java.lang.String path, Attribute attribute)
          Sets the Attribute with the given path, adds it if it doesn’t exist.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeCollection

public AttributeCollection()
Default constructor, uses default pathDelimiter.


AttributeCollection

public AttributeCollection(java.lang.String pathDelimiter)
Create a new AttributeCollection with a custom path delimiter.

Parameters:
pathDelimiter - The new path delimiter to use.

AttributeCollection

public AttributeCollection(Attribute[] attributes)
Create a new AttributeCollection based off an array of Attributes with a the default path delimiter.

Parameters:
attributes - The initial set of attributes to add to the collection.

AttributeCollection

public AttributeCollection(Attribute[] attributes,
                           java.lang.String pathDelimiter)
Create a new AttributeCollection based off an array of Attributes with a custom path delimiter.

Parameters:
attributes - The initial set of attributes to add to the collections.
pathDelimiter - The new path delimiter to use.
Method Detail

setAttribute

public void setAttribute(java.lang.String path,
                         Attribute attribute)
Sets the Attribute with the given path, adds it if it doesn’t exist.

Parameters:
path - The path to this Attribute.
attribute - The Attribute to store.

removeAttribute

public boolean removeAttribute(java.lang.String path)
Remove the Attribute with the specified path.

Parameters:
path - The path to the Attribute to remove.
Returns:
The success of this operation.

getAttribute

public Attribute getAttribute(java.lang.String path)
Return the Attribute with the specified path if it exists, otherwise null.

Parameters:
path - The path to the Attribute to get.
Returns:
The Attribute if it's found otherwise null.

getCount

public int getCount()
Returns the total number of Attributes in the collection.

Returns:
The total number of Attributes in the collection.

getAll

public Attribute[] getAll()
Returns an array representing all Attributes in the collection.

Returns:
An array representing all Attributes in the collection.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.


Copyright © 2004-2006 Hugues Johnson