Data Request Broker
2-3-release

fr.gael.drb
Interface DrbSequence

All Known Subinterfaces:
DrbAttributeList, DrbNodeList, NumericArray, ValueArray
All Known Implementing Classes:
AbstractNumericArray, AbstractValueArray, BooleanArray, ByteArray, DefaultValueArray, DoubleArray, DrbAbstractNodeList, DrbAbstractSequence, DrbDefaultAttributeList, DrbDefaultNodeList, DrbDefaultSequence, FloatArray, IntArray, LongArray, ShortArray, UnsignedByteArray, UnsignedIntArray, UnsignedLongArray, UnsignedShortArray

public interface DrbSequence

Collection of item. This interface provides primary operations to handle collections of items.


Method Summary
 DrbSequence addItem(int index, DrbItem item)
          Inserts a item at a given position.
 ValueArray atomize()
          The atomic values of this sequence.
 DrbItem getItem(int index)
          Returns a specific item of the list.
 int getLength()
          The number of items in the list.
 DrbSequence removeItem(int index)
          Removes an existing item.
 

Method Detail

getItem

DrbItem getItem(int index)
Returns a specific item of the list. The item is identified by its position (i.e. index or sequence number) in the list of items. The order depends on the implementation as well as from the operation that created the list. The index starts from 0 and shall not be greater or equal to the item count of the list. A null reference is returned if the provided index is outside the list bounds.

Parameters:
index - The position of the item starting from and not greater or equal to the item count in the list.
Returns:
A reference to specified item or null if no such attribute.

atomize

ValueArray atomize()
The atomic values of this sequence. The value of the node means its content. The value is expressed accoring to one of the types supported by the fr.gael.drb.value package. Generally these types correspond to primitive types (e.g. integer, floatting points etc.) or very low level types (e.g. string, date, etc.).

Returns:
A reference to the values of the sequence.

getLength

int getLength()
The number of items in the list. This number can be 0 if the list is empty but shall never be negative.

Returns:
The number of items is the list.

addItem

DrbSequence addItem(int index,
                    DrbItem item)
                    throws NullPointerException,
                           UnsupportedOperationException,
                           IndexOutOfBoundsException
Inserts a item at a given position. The passed item is inserted in the list of children at the given position The position is the expected index of the item after insertion. All the previous item from the aimed position to the end of the list are shift to the end of the new sequence (i.e. their indices are shifted up of 1). If the given index is out of the sequence bounds and therefore less than zero and greater or equal to the current number of items,the operation raises an exception. An index equal to the current number of item is allowed and the operation is therefore equivalent to an append.

Parameters:
index - The expected index of the item after the insertion.
item - A reference to the item to be inserted.
Returns:
A reference to the a sequence containing the inserted node.
Throws:
NullPointerException - This exception is raised when the passed item a null reference. This exception may be overriden by an UnsupportedOperationException.
IndexOutOfBoundsException - This exception is raised when the passe index is less than zero or if it is greater or equal to the number of item in the sequence prior the call
UnsupportedOperationException - This exception is raised when the implementation does not support the requested insertion for any reason (e.g. impossible in this current specific case or in general).

removeItem

DrbSequence removeItem(int index)
                       throws IndexOutOfBoundsException,
                              UnsupportedOperationException
Removes an existing item. The item at the given index is removed from the sequence of the current item. The item is not modified by this operation. The index of the item to be removed has to correspond to an existing item index. If the index is less than zero or greater or equal to the current number of items, an exception is thrown.

Parameters:
index - Index of the item to be removed.
Returns:
A reference to the a sequence after the removal of the item.
Throws:
IndexOutOfBoundsException - This exception is raised when the passed index is less than zero or greater or equal to the current number of children.
UnsupportedOperationException - This exception is raised when the implementation does not support the requested removal for any reason.

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .