|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetkit.graph.Attributes
public final class Attributes
This class is a container for Attribute classes. It keeps an ordered list of Attribute classes as individually typed fields. This container knows which field is the KEY Attribute (if a key exists.) Each Attribute within this container must have a unique field name. Each Attributes container must have a unique container name also. The name of this container class serves as a "type" for Nodes.
Attribute
,
AttributeKey
,
Node
,
SchemaReader
Constructor Summary | |
---|---|
Attributes(java.lang.String name)
This constructor builds an Attributes container object using the supplied name. |
Method Summary | |
---|---|
void |
add(Attribute a)
Adds an Attribute to this container; the name of the Attribute must be a unique field name within this container. |
int |
attributeCount()
Get the number of Attribute fields in this container including the key Attribute (if one exists). |
boolean |
contains(java.lang.String fieldName)
Check if the specified field name is already present among the attributes in this container. |
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one; note this method assumes that each instance has a unique name and uses the name for equality purposes. |
Attribute |
getAttribute(int attrIndex)
Get the Attribute at a particular index; indexes honor the presence of a key Attribute within this container. |
Attribute |
getAttribute(java.lang.String attribute)
Get the Attribute with a particular name. |
int |
getAttributeIndex(java.lang.String attribute)
Get the index of an attribute within this container; indexes honor the presence of a key Attribute within this container. |
AttributeKey |
getKey()
Get the key Attribute from this container. |
int |
getKeyIndex()
Get the key index from this container. |
java.lang.String |
getName()
Get the name of this object. |
int |
hashCode()
Returns a hash code value for this object. |
java.util.Iterator<Attribute> |
iterator()
Get an Iterator over the Attribute fields; iteration is performed in the order that each Attribute was added to this container. |
void |
remove(int index)
Removes the Attribute at the specified index. |
void |
remove(java.lang.String fieldName)
Removes the Attribute specified by the supplied field name. |
java.lang.String |
toString()
Returns a String representation for this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Attributes(java.lang.String name)
name
- a string to uniquely name this container.Method Detail |
---|
public void add(Attribute a)
a
- the attribute to be added.
java.lang.RuntimeException
- if the attribute name is already present.
java.lang.RuntimeException
- if an attempt is made to add a second key.Graph.addAttribute(String,Attribute)
public java.lang.String getName()
public int getAttributeIndex(java.lang.String attribute)
getAttribute(int)
.
attribute
- the attribute name to lookup.
java.lang.RuntimeException
- if the attribute isn't found.public void remove(int index)
index
- an integer index specifying which Attribute to
remove.
java.lang.RuntimeException
- if index is out of bounds or if index
references the KEY field.Graph.removeAttribute(String,int)
public void remove(java.lang.String fieldName)
fieldName
- a String representing the name of the
Attribute field to be removed.
java.lang.RuntimeException
- if fieldName references the KEY field
or if the Attribute referenced by fieldName does not exist in
this container.Graph.removeAttribute(String,int)
public java.util.Iterator<Attribute> iterator()
iterator
in interface java.lang.Iterable<Attribute>
public boolean contains(java.lang.String fieldName)
fieldName
- the field name to look for in this container.
public Attribute getAttribute(java.lang.String attribute)
attribute
- the attribute name to look for in the container.
public Attribute getAttribute(int attrIndex)
getAttributeIndex(String)
.
attrIndex
- the attribute index to look for in the
container.
public AttributeKey getKey()
public int getKeyIndex()
public int attributeCount()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the reference object with which to compare.
true
if this object is the same as the argument; false
otherwise.Graph.addAttributes(Attributes)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |