context.arch.storage
Class AttributeNameValues

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--context.arch.storage.AttributeNameValues

public class AttributeNameValues
extends java.util.Vector

This class is a container for a group of related attributes. It contains information about attribute names, values and types AttributeNameValues can be added, removed, and found in the container.

See Also:
Serialized Form

Field Summary
static java.lang.String ALL
          Tag to indicate all attributes are to be used
static java.lang.String ATTRIBUTE_NAME_VALUES
          Tag for a list of attribute name/value pairs
static char SEPARATOR
          Connector for nested attributes
static java.lang.String SEPARATOR_STRING
          Connector for nested attributes - String
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AttributeNameValues()
          Empty constructor
AttributeNameValues(DataObject data)
          Constructor that takes a DataObject as a parameter.
 
Method Summary
 void addAttributeNameValue(AttributeNameValue att)
          Adds the given AttributeNameValue object to the container.
 void addAttributeNameValue(java.lang.String name)
          Adds the given attribute name.
 void addAttributeNameValue(java.lang.String name, java.lang.Object value)
          Adds the given attribute name and value to the container.
 void addAttributeNameValue(java.lang.String name, java.lang.Object value, java.lang.String type)
          Adds the given attribute name, value and type to the container
 void addAttributeNameValues(AttributeNameValues atts)
          Adds the given AttributeNameValues object to the container.
 AttributeNameValue getAttributeNameValue(java.lang.String name)
          This method returns the AttributeNameValue with the given name from this list of AttributeNameValues.
 AttributeNameValue getAttributeNameValue(java.lang.String name, java.lang.String prefix)
          This method returns the AttributeNameValue with the given name from this list of AttributeNameValue.
 AttributeNameValue getAttributeNameValueAt(int index)
          Returns the AttributeNameValue object at the given index
 AttributeNameValues getSubset(Attributes atts)
          This method takes a list of attributes wanted and it filters all the rest out from this Attributes object.
 boolean hasAttributeNameValue(AttributeNameValue att)
          Determines whether the given AttributeNameValue object is in the container
 boolean hasAttributeNameValue(java.lang.String name, java.lang.Object value)
          Determines whether the given attribute name and value are in the container, using the default datatype.
 boolean hasAttributeNameValue(java.lang.String name, java.lang.Object value, java.lang.String type)
          Determines whether the given attribute name, value and type are in the container,
 int indexOfAttributeNameValue(AttributeNameValue att)
          Returns the index at which the AttributeNameValue object occurs
 int indexOfAttributeNameValue(java.lang.String name, java.lang.Object value)
          Returns the index at which the given attribute name and value occurs, using the default datatype
 int indexOfAttributeNameValue(java.lang.String name, java.lang.Object value, java.lang.String type)
          Returns the index at which the given attribute name, value and type occurs.
 int numAttributeNameValues()
          Returns the number of AttributeNameValues in the container return the number of AttributeNameValues in the container
 void removeAttributeNameValue(AttributeNameValue att)
          Removes the given AttributeNameValue object to the container.
 java.lang.String toAString()
          A printable version of this class.
 DataObject toDataObject()
          Converts to a DataObject.
 java.util.Hashtable toTypesHashtable()
          Converts the attributes name-type pairs to a hashtable where the keys are the names and the values are the types.
 java.util.Hashtable toTypesHashtable(java.lang.String prefix)
          Converts the attributes name-type pairs to a hashtable where the keys are the names and the values are the types.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_NAME_VALUES

public static final java.lang.String ATTRIBUTE_NAME_VALUES
Tag for a list of attribute name/value pairs

SEPARATOR

public static final char SEPARATOR
Connector for nested attributes

SEPARATOR_STRING

public static final java.lang.String SEPARATOR_STRING
Connector for nested attributes - String

ALL

public static final java.lang.String ALL
Tag to indicate all attributes are to be used
Constructor Detail

AttributeNameValues

public AttributeNameValues()
Empty constructor

AttributeNameValues

public AttributeNameValues(DataObject data)
Constructor that takes a DataObject as a parameter. An expected tag contained within the DataObject is . The constructor stores the encoded data in an AttributeNameValues object.
Parameters:
data - DataObject that contains the attribute name-value (and possibly type) info
Method Detail

toDataObject

public DataObject toDataObject()
Converts to a DataObject.
Returns:
Attributes object converted to an DataObject

addAttributeNameValue

public void addAttributeNameValue(AttributeNameValue att)
Adds the given AttributeNameValue object to the container.
Parameters:
att - AttributeNameValue to add

addAttributeNameValue

public void addAttributeNameValue(java.lang.String name)
Adds the given attribute name.
Parameters:
name - Name of the attribute to add

addAttributeNameValue

public void addAttributeNameValue(java.lang.String name,
                                  java.lang.Object value)
Adds the given attribute name and value to the container. It uses a default datatype.
Parameters:
name - Name of the attribute to add
value - Value of the attribute to add

addAttributeNameValue

public void addAttributeNameValue(java.lang.String name,
                                  java.lang.Object value,
                                  java.lang.String type)
Adds the given attribute name, value and type to the container
Parameters:
name - Name of the attribute to add
value - Value of the attribute to add
type - Datatype of the attribute to add

addAttributeNameValues

public void addAttributeNameValues(AttributeNameValues atts)
Adds the given AttributeNameValues object to the container.
Parameters:
atts - AttributeNameValues to add

getAttributeNameValueAt

public AttributeNameValue getAttributeNameValueAt(int index)
Returns the AttributeNameValue object at the given index
Parameters:
index - Index into the container
Returns:
AttributeNameValue at the specified index

hasAttributeNameValue

public boolean hasAttributeNameValue(AttributeNameValue att)
Determines whether the given AttributeNameValue object is in the container
Parameters:
att - AttributeNameValue to check
Returns:
whether AttributeNameValue is in the container

hasAttributeNameValue

public boolean hasAttributeNameValue(java.lang.String name,
                                     java.lang.Object value)
Determines whether the given attribute name and value are in the container, using the default datatype.
Parameters:
name - Name of the attribute to check
value - Value of the attribute to check
Returns:
whether the given attribute name and value are in the container

hasAttributeNameValue

public boolean hasAttributeNameValue(java.lang.String name,
                                     java.lang.Object value,
                                     java.lang.String type)
Determines whether the given attribute name, value and type are in the container,
Parameters:
name - Name of the attribute to check
value - Value of the attribute to check
type - Datatype of the attribute to check
Returns:
whether the given attribute name, value and type are in the container

indexOfAttributeNameValue

public int indexOfAttributeNameValue(AttributeNameValue att)
Returns the index at which the AttributeNameValue object occurs
Parameters:
att - AttributeNameValue to look for
Returns:
index of the specified AttributeNameValue

indexOfAttributeNameValue

public int indexOfAttributeNameValue(java.lang.String name,
                                     java.lang.Object value)
Returns the index at which the given attribute name and value occurs, using the default datatype
Parameters:
name - Name of the attribute to look for
value - Value of the attribute to look for
Returns:
index of the specified Attribute

indexOfAttributeNameValue

public int indexOfAttributeNameValue(java.lang.String name,
                                     java.lang.Object value,
                                     java.lang.String type)
Returns the index at which the given attribute name, value and type occurs.
Parameters:
name - Name of the attribute to look for
value - Value of the attribute to look for
type - Datatype of the attribute to look for
Returns:
index of the specified Attribute

numAttributeNameValues

public int numAttributeNameValues()
Returns the number of AttributeNameValues in the container return the number of AttributeNameValues in the container

removeAttributeNameValue

public void removeAttributeNameValue(AttributeNameValue att)
Removes the given AttributeNameValue object to the container.
Parameters:
att - AttributeNameValue to remove

getAttributeNameValue

public AttributeNameValue getAttributeNameValue(java.lang.String name)
This method returns the AttributeNameValue with the given name from this list of AttributeNameValues.
Parameters:
name - of the AttributeNameValue to return
Returns:
AttributeNameValue with the given name

getAttributeNameValue

public AttributeNameValue getAttributeNameValue(java.lang.String name,
                                                java.lang.String prefix)
This method returns the AttributeNameValue with the given name from this list of AttributeNameValue.
Parameters:
name - of the AttributeNameValue to return
prefix - Structure name to use
Returns:
AttributeNameValue with the given name

getSubset

public AttributeNameValues getSubset(Attributes atts)
This method takes a list of attributes wanted and it filters all the rest out from this Attributes object.
Parameters:
atts - Attributes object containing the attributes to return
Returns:
filtered AttributeNameValues object

toTypesHashtable

public java.util.Hashtable toTypesHashtable()
Converts the attributes name-type pairs to a hashtable where the keys are the names and the values are the types. AKD - problem if two attributes have same name but different types

toTypesHashtable

public java.util.Hashtable toTypesHashtable(java.lang.String prefix)
Converts the attributes name-type pairs to a hashtable where the keys are the names and the values are the types. This method allows the use of a prefix for structures. AKD - problem if two attributes have same name but different types

toAString

public java.lang.String toAString()
A printable version of this class.
Returns:
String version of this class