Data Request Broker
2-3-release

fr.gael.drb
Class DrbDefaultAttributeList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<DrbItem>
              extended by fr.gael.drb.DrbDefaultSequence
                  extended by fr.gael.drb.DrbDefaultAttributeList
All Implemented Interfaces:
DrbAttributeList, DrbSequence, Serializable, Cloneable, Iterable<DrbItem>, Collection<DrbItem>, List<DrbItem>, RandomAccess

public class DrbDefaultAttributeList
extends DrbDefaultSequence
implements DrbAttributeList

Generic implementation of DrbAttributeList. This default implementation extends an ArrayList provided by Java API. It is a generic mean to create a list of attributes. If no specific operations are required to implement the DrbAttributeList (e.g. filtering, caching, hashing, etc.). This class is a simple way to handle a collection of attributes. Note : the add() or equivalent operations of the ArrayList class have not been overrided to insure they insert DrbAttribute intances. Some inconsistency may appear if no care is taken while calling add() or equivalent operations.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DrbDefaultAttributeList()
           
 
Method Summary
 DrbSequence addItem(int index, DrbItem item)
          Inserts a item at a given position.
 DrbAttribute getNamedItem(String name)
          Returns the item matching a specific name.
 DrbAttribute item(int index)
          Returns a specific item of the list.
 
Methods inherited from class fr.gael.drb.DrbDefaultSequence
addItem, atomize, getItem, getLength, main, removeItem, toString
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fr.gael.drb.DrbAttributeList
getLength
 
Methods inherited from interface fr.gael.drb.DrbSequence
atomize, getItem, removeItem
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

DrbDefaultAttributeList

public DrbDefaultAttributeList()
Method Detail

item

public DrbAttribute item(int index)
Returns a specific item of the list. This operation wraps the ArrayList.get() operation. The exception that ArrayList.get() can raise is however traped and not propagated. In such case a message is written to the error output and the operation returns null without throwing any exception.

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

getNamedItem

public DrbAttribute getNamedItem(String name)
Returns the item matching a specific name. The name is a local name without any prefix.

Specified by:
getNamedItem in interface DrbAttributeList
Parameters:
name - The name to match.
Returns:
A reference to specified items or null if no such attribute.

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
Overrides:
addItem in class DrbDefaultSequence
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).

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

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