com.ibm.dse.base
Class IndexedCollection

java.lang.Object
  |
  +--com.ibm.dse.base.DataElement
        |
        +--com.ibm.dse.base.DataCollection
              |
              +--com.ibm.dse.base.IndexedCollection
Direct Known Subclasses:
HtmlIndexedCollection

public class IndexedCollection
extends DataCollection

This class contains a collection of elements of the same class ordered by index.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.base.DataElement
description, name, state
 
Constructor Summary
IndexedCollection()
          This is the default constructor used to create an IndexedCollection object.
IndexedCollection(java.lang.String aName)
          This constructor creates an IndexedCollection object with a specified name.
 
Method Summary
 void addElement(DataElement aDataElement)
          Adds an element at the end of the collection.
 java.lang.Object clone()
          Returns a new IndexedCollection cloned from the current one.
 DataElement getDataElement()
          Gets the dataElement defined in case of the indexed collection size is zero.
 DataElement getElementAt(int anIdentifier)
          Returns the element located at the index anIdentifier.
 DataElement getElementAt(java.lang.String anIdentifier)
          Performs a recursive search of the element.
 java.util.Vector getElements()
          Returns the value of elements.
 Tag getElementSubTag()
          Sets the data element
 java.util.Enumeration getEnumeration()
          Returns the IndexedCollection's elements as an Enumeration.
 java.lang.Object getValue()
          Returns the Indexed Collection's elements.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes an IndexedCollection with the attributes in aTag.
 void nestedQualifiedElements(java.util.Hashtable theTable, java.lang.String Path)
          Adds as qualified name all elements of this IndexedCollection to the Hashtable passed by parameter.
 void readExternal(java.io.ObjectInput s)
          Invokes the object creation from an ObjectInput.
 void removeAll()
          Removes all elements.
 DataElement removeElementAt(int anIndex)
          Remove the element at the index marked by anIndex.
 DataElement removeElementAt(java.lang.String anIdentifier)
          Performs a recursive search for the element.
 void setDataElement(DataElement aDataElement)
          Sets the data element
 void setElements(Vector aVector)
          Sets the value of elements.
 void setElementSubTag(Tag aSubTag)
          Sets the data element
 void setValue(java.lang.Object aValue)
          Validates the value to be set and if it succeeds then sets the value to the IndexedCollection from a Vector of DataElements.
 int size()
          Returns the number of elements.
 java.lang.String toString()
          Returns a visual representation of this data.
 Vector toStrings()
          Returns a Vector containing a visual representation of this data.
 Vector toTags()
          Returns a Vector with the indexed collection represented as a Tag.
 java.lang.Object validate(java.lang.Object toValidate)
          Validates the object passed (that must be an indexed collection or a vector) and if successful, the object is returned, otherwise an appropriate exception is thrown.
 void writeExternal(java.io.ObjectOutput s)
          Provides concrete serialization handling for IndexedCollection.
 
Methods inherited from class com.ibm.dse.base.DataCollection
getValueAt, nestedElements, nestedElements, nestedFields, nestedKeyedCollections, setValueAt
 
Methods inherited from class com.ibm.dse.base.DataElement
externalizer, getDescription, getDescriptor, getErrorInfo, getExternalizer, getKey, getName, getState, getTagName, readExternal, readObject, removeExternal, setDescription, setDescriptor, setErrorInfo, setExternalizer, setName, setState, writeExternal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexedCollection

public IndexedCollection()
This is the default constructor used to create an IndexedCollection object.

IndexedCollection

public IndexedCollection(java.lang.String aName)
                  throws java.io.IOException
This constructor creates an IndexedCollection object with a specified name.
Parameters:
aString - java.lang.String
Method Detail

addElement

public void addElement(DataElement aDataElement)
Adds an element at the end of the collection.
Parameters:
aDataElement -  

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a new IndexedCollection cloned from the current one.
Overrides:
clone in class DataElement
Returns:
com.ibm.dse.base.DataElement

getDataElement

public DataElement getDataElement()
Gets the dataElement defined in case of the indexed collection size is zero.
Returns:
com.ibm.dse.base.DataElement

getElementAt

public DataElement getElementAt(int anIdentifier)
                         throws DSEObjectNotFoundException
Returns the element located at the index anIdentifier.
Parameters:
anIndent - int
Returns:
DataElement

getElementAt

public DataElement getElementAt(java.lang.String anIdentifier)
                         throws DSEObjectNotFoundException
Performs a recursive search of the element. If it is the last element in the path, it calls the getElementAt(int) method.
Overrides:
getElementAt in class DataElement
Parameters:
anIdentifier - java.lang.String
Returns:
DataElement

getElements

public java.util.Vector getElements()
Returns the value of elements.
Returns:
java.util.Vector

getElementSubTag

public Tag getElementSubTag()
Sets the data element
Parameters:
aDataElement - com.ibm.dse.base.DataElement

getEnumeration

public java.util.Enumeration getEnumeration()
Returns the IndexedCollection's elements as an Enumeration.
Overrides:
getEnumeration in class DataCollection
Returns:
java.util.Enumeration

getValue

public java.lang.Object getValue()
Returns the Indexed Collection's elements. This method is implemented to provide polymorphism.
Overrides:
getValue in class DataElement
Returns:
java.lang.Object

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Initializes an IndexedCollection with the attributes in aTag.
Parameters:
aTag - Externalization.Tag
Returns:
Externalizable

nestedQualifiedElements

public void nestedQualifiedElements(java.util.Hashtable theTable,
                                    java.lang.String Path)
Adds as qualified name all elements of this IndexedCollection to the Hashtable passed by parameter. Each entry has as key the qualified name of the DataElement and as value the DataElement object.
Overrides:
nestedQualifiedElements in class DataCollection
Parameters:
theTable - java.util.Hashtable
Path - String The path where the IndexedCollection is.

readExternal

public void readExternal(java.io.ObjectInput s)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Invokes the object creation from an ObjectInput.
Overrides:
readExternal in class DataElement
Parameters:
s - java.io.ObjectInput
Throws:
java.io.IOException. -  
java.lang.ClassNotFoundException. -  

removeAll

public void removeAll()
Removes all elements.

removeElementAt

public DataElement removeElementAt(int anIndex)
                            throws DSEObjectNotFoundException
Remove the element at the index marked by anIndex.
Parameters:
anIndex - int
Returns:
DataElement

removeElementAt

public DataElement removeElementAt(java.lang.String anIdentifier)
                            throws DSEObjectNotFoundException
Performs a recursive search for the element. If it is the last element in the path, this method calls the removeElementAt(int) method.
Overrides:
removeElementAt in class DataElement
Parameters:
anIdentifier - java.lang.String
Returns:
DataElement

setDataElement

public void setDataElement(DataElement aDataElement)
Sets the data element
Parameters:
aDataElement - com.ibm.dse.base.DataElement

setElements

public void setElements(Vector aVector)
Sets the value of elements.
Parameters:
aVector - java.util.Vector

setElementSubTag

public void setElementSubTag(Tag aSubTag)
Sets the data element
Parameters:
aDataElement - com.ibm.dse.base.DataElement

setValue

public void setValue(java.lang.Object aValue)
              throws DSEInvalidArgumentException
Validates the value to be set and if it succeeds then sets the value to the IndexedCollection from a Vector of DataElements. The elements attribute will contain a cloned Vector from the Vector passed by parameter. The subTag attribute will contain a Tag Object constructed from toString() representation of first vector's element. The DataElement attribute will contain a new DataElement build from subTag attribute.
Overrides:
setValue in class DataCollection
Parameters:
aValue - java.lang.Object Must be a Vector of DataElements.
Throws:
DSEInvalidArgumentException - The parameter is not a Vector.

size

public int size()
Returns the number of elements.
Returns:
int

toString

public java.lang.String toString()
Returns a visual representation of this data.
Overrides:
toString in class java.lang.Object
Returns:
String

toStrings

public Vector toStrings()
Returns a Vector containing a visual representation of this data.
Overrides:
toStrings in class DataElement
Returns:
Vector

toTags

public Vector toTags()
              throws java.io.IOException
Returns a Vector with the indexed collection represented as a Tag.
Overrides:
toTags in class DataElement
Returns:
Tag

validate

public java.lang.Object validate(java.lang.Object toValidate)
                          throws DSETypeException
Validates the object passed (that must be an indexed collection or a vector) and if successful, the object is returned, otherwise an appropriate exception is thrown.
Overrides:
validate in class DataElement
Parameters:
toValidate - Object
descriptor - PropertyDescription
Throws:
DSETypeException - Thrown if the validation is unsuccessful.

writeExternal

public void writeExternal(java.io.ObjectOutput s)
                   throws java.io.IOException
Provides concrete serialization handling for IndexedCollection.
Overrides:
writeExternal in class DataElement
Parameters:
s - java.io.ObjectOutput
Throws:
java.io.IOException. -