|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
messif.objects.util.AbstractObjectList<E>
E
- the type of abstract objects stored in this listpublic class AbstractObjectList<E extends AbstractObject>
Resizable-array for storing AbstractObjects or their descendants.
All list operations are implemented and additional support for
building randomly selected AbstracObject lists is provided.
Additionally, the list returns GenericObjectIterator
through iterator
method.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
AbstractObjectList()
Constructs an empty AbstractObject list with an initial capacity of ten. |
|
AbstractObjectList(java.util.Collection<? extends E> source)
Constructs an AbstractObject list containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
AbstractObjectList(int capacity)
Constructs an empty AbstractObject list with the specified initial capacity. |
|
AbstractObjectList(java.util.Iterator<? extends E> iterator)
Constructs an AbstractObject list containing all elements returned by the specified iterator (in that order). |
|
AbstractObjectList(java.util.Iterator<? extends E> iterator,
int count)
Constructs an AbstractObject list containing maximally count
elements returned by the specified iterator (in that order). |
Method Summary | ||
---|---|---|
int |
addAll(java.util.Iterator<? extends E> iterator)
Appends all of the elements that can be retrieved from the specified iterator to the end of this list. |
|
boolean |
dataEquals(java.lang.Object obj)
Indicates whether some other object has the same data as this one. |
|
int |
dataHashCode()
Returns a hash code value for the data of this list. |
|
UniqueID |
getObjectID(int index)
Returns the ID of object at specified position. |
|
AbstractObjectIterator<E> |
iterator()
Returns an iterator over the elements in this list in proper sequence. |
|
AbstractObjectIterator<E> |
provideObjects()
The iterator for provided objects for ObjectProvider interface. |
|
static
|
randomList(int count,
boolean unique,
java.util.Iterator<F> iterSource)
Returns a list containing randomly choosen objects from the passed iterator. |
|
|
randomList(int count,
boolean unique,
T list)
Returns a list containing randomly choosen objects from this list. |
|
static
|
randomList(int count,
boolean unique,
T list,
java.util.Iterator<F> iterSource)
Returns a list containing randomly choosen objects from the passed iterator. |
|
E |
randomObject()
Returns one object selected from the list at random. |
|
java.lang.String |
toString()
Returns a string representation of this collection of objects. |
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, 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 java.util.List |
---|
containsAll, equals, hashCode, listIterator, listIterator, removeAll, retainAll, subList |
Constructor Detail |
---|
public AbstractObjectList(int capacity) throws java.lang.IllegalArgumentException
capacity
- the initial capacity of the list
java.lang.IllegalArgumentException
- if the specified initial capacity is negativepublic AbstractObjectList()
public AbstractObjectList(java.util.Collection<? extends E> source) throws java.lang.NullPointerException
source
- the collection whose elements are to be placed into this list
java.lang.NullPointerException
- if the specified collection is nullpublic AbstractObjectList(java.util.Iterator<? extends E> iterator, int count) throws java.lang.NullPointerException
count
elements returned by the specified iterator (in that order).
iterator
- the iterator returing elements that are to be placed into this listcount
- maximal number of objects that are placed from iterator
(negative number means unlimited)
java.lang.NullPointerException
- if the specified iterator is nullpublic AbstractObjectList(java.util.Iterator<? extends E> iterator) throws java.lang.NullPointerException
iterator
- the iterator returing elements that are to be placed into this list
java.lang.NullPointerException
- if the specified iterator is nullMethod Detail |
---|
public UniqueID getObjectID(int index)
index
- position of object in the list
index
public AbstractObjectIterator<E> iterator()
iterator
in interface java.lang.Iterable<E extends AbstractObject>
iterator
in interface java.util.Collection<E extends AbstractObject>
iterator
in interface java.util.List<E extends AbstractObject>
iterator
in class java.util.AbstractList<E extends AbstractObject>
public AbstractObjectIterator<E> provideObjects()
provideObjects
in interface ObjectProvider<E extends AbstractObject>
public int addAll(java.util.Iterator<? extends E> iterator)
iterator
- iterator over elements to be added to this list
public boolean dataEquals(java.lang.Object obj)
obj
- the reference object with which to compare.
true
if this object has the same data as the obj
argument; false
otherwise.public int dataHashCode()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<E extends AbstractObject>
public E randomObject()
public <T extends java.util.List<E>> T randomList(int count, boolean unique, T list)
T
- the list class that receives random objectscount
- Number of object to return.unique
- Flag if returned list contains each object only once.list
- An instance of a class extending ObjectListpublic static <F extends AbstractObject,T extends java.util.List<F>> T randomList(int count, boolean unique, T list, java.util.Iterator<F> iterSource)
F
- the class of objects that are stored in the listT
- the list class that receives random objectscount
- Number of object to return.unique
- Flag if returned list contains each object only once.list
- An instance of a class extending ObjectListiterSource
- Iterator from which objects are randomly picked.
public static <F extends AbstractObject> AbstractObjectList<F> randomList(int count, boolean unique, java.util.Iterator<F> iterSource)
F
- the class of objects that are stored in the listcount
- Number of object to return.unique
- Flag if returned list contains each object only once.iterSource
- Iterator from which objects are randomly picked.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |