fr.gael.drb
Class DrbDefaultAttributeList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<DrbItem>
fr.gael.drb.DrbDefaultSequence
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
| 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 |
DrbDefaultAttributeList
public DrbDefaultAttributeList()
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).
Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .