Data Request Broker
2-3-release

fr.gael.drb
Class DrbAbstractSequence

java.lang.Object
  extended by fr.gael.drb.DrbAbstractSequence
All Implemented Interfaces:
DrbSequence
Direct Known Subclasses:
DrbAbstractNodeList

public abstract class DrbAbstractSequence
extends Object
implements DrbSequence

This class provides a skeletal implementation of the DrbSequence interface, to minimize the effort required to implement this interface.


Constructor Summary
DrbAbstractSequence()
           
 
Method Summary
 DrbSequence addItem(DrbItem item)
          Appends an item at the end of the item list.
 DrbSequence addItem(int index, DrbItem item)
          Inserts a item at a given position.
 ValueArray atomize()
          The atomic values of this sequence.
 DrbSequence removeItem(int index)
          Removes an existing item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.gael.drb.DrbSequence
getItem, getLength
 

Constructor Detail

DrbAbstractSequence

public DrbAbstractSequence()
Method Detail

atomize

public 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.).

Specified by:
atomize in interface DrbSequence
Returns:
A reference to the values of the sequence.

addItem

public 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.

Specified by:
addItem in interface DrbSequence
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).

addItem

public DrbSequence addItem(DrbItem item)
                    throws NullPointerException,
                           UnsupportedOperationException
Appends an item at the end of the item list.

Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to append a node wrapping a file in an XML document. The documentation of the implementation shall describe its specific strategy.

Case of unordered or specifically ordered implementations: If the implementation does not support ordered children or has specific ordering rules, the node may not be appended but only inserted according to these rules. For instance it may not be possible to impose the file order in a directory:it generally depends on the lexicographical order of the node names or their creation date.

Parameters:
item - A reference to the item to be appended.
Returns:
A reference to the a sequence containing the appended node.
Throws:
NullPointerException - This exception is raised when the passed node a null reference.This exception may be overriden by an UnsupportedOperationException.
UnsupportedOperationException - This exception is raised when the implementation does not support the requested append for any reason (e.g. impossible in this current specific case or in general).

removeItem

public 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.

Specified by:
removeItem in interface DrbSequence
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 .