com.cafesoft.cams.attr
Class StandardAttributeSet

java.lang.Object
  |
  +--com.cafesoft.cams.attr.StandardAttributeSet
All Implemented Interfaces:
AttributeSet

public class StandardAttributeSet
extends Object
implements AttributeSet

StandardAttributeSet is the standard implementation of AttributeSet, which represents a collection zero or more unique Attribute instances.

Since:
5/21/2004

Nested Class Summary
 class StandardAttributeSet.ImmutableAttributeIterator
          ImmutableAttributeIterator iterates over the category Maps and the Attribute Sets within them to provide access all all Attribute instances within an AttributeSet.
 
Constructor Summary
StandardAttributeSet()
          Create a new, empty StandardAttributeSet.
StandardAttributeSet(List attrList)
          Create a new StandardAttributeSet with Attributes from a List.
 
Method Summary
 void add(Attribute attr)
          Add an Attribute.
 void clear()
          Clear all Attributes.
 boolean containsAttributeCategory(URI attrCategory)
          Returns true if the specified attribute category is represented in in this AttributeSet.
 List get(URI attrCategory, URI type, URI id)
          Get all Attributes by category, type, and identifier.
 Iterator getAttributeCategories()
          Returns the attribute categories represented in this collection.
 int getAttributeCategoryCount()
          Returns the number of attribute categories.
 int getAttributeCountByCategory(URI attrCategory)
          Returns the number of attributes in the specified category.
 Iterator getAttributes()
          Get all Attributes.
 Iterator getAttributesByCategory(URI attrCategory)
          Get all Attributes by category.
 Attribute getOneAndOnly(URI attrCategory, URI type, URI id)
          Get a one and only Attribute.
 void remove(Attribute attr)
          Remove an Attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardAttributeSet

public StandardAttributeSet()
Create a new, empty StandardAttributeSet.


StandardAttributeSet

public StandardAttributeSet(List attrList)
Create a new StandardAttributeSet with Attributes from a List.

Parameters:
attrList - the List of Attributes.
Throws:
IllegalArgumentException - if an Object in the List is not an Attribute.
Method Detail

add

public void add(Attribute attr)
Add an Attribute.

Specified by:
add in interface AttributeSet
Parameters:
attr - the Attribute to be added to this collection.

get

public List get(URI attrCategory,
                URI type,
                URI id)
Get all Attributes by category, type, and identifier.

Specified by:
get in interface AttributeSet
Parameters:
attrCategory - the attribute category.
type - the attribute data type.
id - the attribute identifier.
Returns:
a List of Attributes with the specified category, type, and identifier or null if not in this collection.

getOneAndOnly

public Attribute getOneAndOnly(URI attrCategory,
                               URI type,
                               URI id)
Get a one and only Attribute.

NOTE: - the caller must be certain that at most one Attribute with the specified catetory, type, and id is in the set.

Specified by:
getOneAndOnly in interface AttributeSet
Parameters:
attrCategory - the attribute category.
type - the attribute data type.
id - the attribute identifier.
Returns:
the requested Attribute with the specified category, type, and identifier or null if not in this collection.

getAttributes

public Iterator getAttributes()
Get all Attributes.

Specified by:
getAttributes in interface AttributeSet
Returns:
an Iterator over all Attributes in this collection.

getAttributesByCategory

public Iterator getAttributesByCategory(URI attrCategory)
Get all Attributes by category.

Specified by:
getAttributesByCategory in interface AttributeSet
Returns:
an Iterator over all Attributes in the specifed category within this collection.

getAttributeCountByCategory

public int getAttributeCountByCategory(URI attrCategory)
Returns the number of attributes in the specified category.

Specified by:
getAttributeCountByCategory in interface AttributeSet
Returns:
the number of attributes in the specified attribute category.

getAttributeCategories

public Iterator getAttributeCategories()
Returns the attribute categories represented in this collection.

Specified by:
getAttributeCategories in interface AttributeSet
Returns:
an Iterator providing access to java.net.URI instances: one per attribute category.

getAttributeCategoryCount

public int getAttributeCategoryCount()
Returns the number of attribute categories.

Specified by:
getAttributeCategoryCount in interface AttributeSet
Returns:
the number of attribute categories represented in this set.

containsAttributeCategory

public boolean containsAttributeCategory(URI attrCategory)
Returns true if the specified attribute category is represented in in this AttributeSet.

Specified by:
containsAttributeCategory in interface AttributeSet
Returns:
true if at least one attribute with the specified category is contained in this collection.

remove

public void remove(Attribute attr)
Remove an Attribute.

Specified by:
remove in interface AttributeSet
Parameters:
attr - the Attribute to be removed from this collection.

clear

public void clear()
Clear all Attributes.

Specified by:
clear in interface AttributeSet


Generated on 5:16:42 PM May 12, 2008, © 1996-2005 Cafésoft LLC. All rights reserved.