void |
addElement(DataElement aDataElement)
Methods inherited from class com.ibm.btt.base.DataElement |
externalizer, getCompositeKey, getDescription, getDescriptor, getErrorInfo, getExternalizer, getKey, getName, getParameter, getParameters, getState, getTagName, isAmended, isCached, isSerializable, readExternal, readObject, removeExternal, setAmended, setCompositeKey, setDescription, setDescriptor, setErrorInfo, setExternalizer, setIsCached, setName, setParameter, setParameters, setSerializable, setState, validateObject, writeExternal |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
elements
protected Vector elements
defaultName
public static final java.lang.String defaultName
- See Also:
- Constant Field Values
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.
- Throws:
java.io.IOException
addElement
public void addElement(DataElement aDataElement)
- Adds an element at the end of the collection.
- Parameters:
aDataElement - - The element to be added
addElement
public void addElement(java.lang.String aName,
java.lang.Object aValue,
java.lang.String aType,
int aPosition)
throws DSEInvalidArgumentException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException
- Throws:
DSEInvalidArgumentException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Returns a new IndexedCollection cloned from the current one.
- Specified by:
clone in interface DSECloneable - Overrides:
clone in class DataElement
- Returns:
- com.ibm.btt.base.DataElement - The new indexed collection
- Throws:
java.lang.CloneNotSupportedException - - if a problem occurs trying to clone the object
createElement
public DataElement createElement(boolean shareDescriptor)
throws DSEInvalidRequestException
- Returns a new DataElement to be inserted in the indexed collection that can share the same descriptors of the existing elements.
- Parameters:
shareDescriptor - - True if the descriptors can be shared
- Returns:
- com.ibm.btt.base.DataElement - The new DataElement
- Throws:
DSEInvalidRequestException
createElementSharingDescriptors
public DataElement createElementSharingDescriptors(DataElement sourceDataElement)
throws DSEInvalidRequestException
- Creates a new DataElement that shares the same descriptor than the DataElement passed.
- Parameters:
sourceDataElement -
- Returns:
- com.ibm.btt.base.DataElement - The new DataElement
- Throws:
DSEInvalidRequestException
getDataElement
public DataElement getDataElement()
- Gets the dataElement defined if the indexed collection size is zero.
- Returns:
- com.ibm.btt.base.DataElement
getElementAt
public DataElement getElementAt(int anIdentifier)
throws DSEObjectNotFoundException
- Returns the element located at the index anIdentifier.
- Throws:
DSEObjectNotFoundException
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,
the method calls the getElementAt(int) method.
- Overrides:
getElementAt in class DataElement
- Parameters:
anIdentifier - java.lang.String
- Returns:
- DataElement
- Throws:
DSEObjectNotFoundException
getElements
public java.util.Vector getElements()
- Returns the value of elements.
- Returns:
- java.util.Vector
getElementSubTag
public Tag getElementSubTag()
- Sets the data element.
getEnumeration
public java.util.Enumeration getEnumeration()
- Returns the IndexedCollection's elements as an Enumeration.
- Specified by:
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.
- Specified by:
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
- Throws:
java.io.IOException
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 a key the qualified name of the DataElement and as value the DataElement object.
- Overrides:
nestedQualifiedElements in class DataCollection
- Parameters:
theTable - java.util.HashtablePath - 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.
- Specified by:
readExternal in interface java.io.Externalizable - Overrides:
readExternal in class DataElement
- Parameters:
s - java.io.ObjectInput
- Throws:
java.io.IOException.
java.lang.ClassNotFoundException.
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
- Throws:
DSEObjectNotFoundException
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
- Throws:
DSEObjectNotFoundException
setDataElement
public void setDataElement(DataElement aDataElement)
- Sets the data element.
- Parameters:
aDataElement - com.ibm.btt.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.
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 the 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
- Throws:
java.io.IOException
tryGetElementAt
public DataElement tryGetElementAt(int anIdentifier)
- Returns the element located at the index anIdentifier.
tryGetElementAt
public DataElement tryGetElementAt(java.lang.String anIdentifier)
- Performs a recursive search of the element. If it is the last element in the path,
the method calls the getElementAt(int) method.
- Overrides:
tryGetElementAt in class DataElement
- Parameters:
anIdentifier - java.lang.String
- Returns:
- DataElement
tryGetValueAt
public java.lang.Object tryGetValueAt(java.lang.String aCompositeKey)
- Returns the value of an element located in the path aCompositeKey.
Returns null if the element is not found or if it is found but has a null value.
- Parameters:
aCompositeKey - java.lang.String
- Returns:
- java.lang.Object
trySetValueAt
public int trySetValueAt(java.lang.String aName,
java.lang.Object aValue)
throws DSEInvalidArgumentException
- Sets the value of an element located in the aCompositeKey path.
- Returns:
- int, 0:success; -1:DSEObjectNotFoundException
- Throws:
DSEInvalidArgumentException
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
- Returns:
- java.lang.Object
- 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.
- Specified by:
writeExternal in interface java.io.Externalizable - Overrides:
writeExternal in class DataElement
- Parameters:
s - java.io.ObjectOutput
- Throws:
java.io.IOException
(c) Copyright IBM Corporation 1998, 2009
|