E
- the class of the objects in this listpublic class GenericMatchingObjectList<E extends AbstractObject> extends java.util.TreeMap<java.lang.Integer,AbstractObjectList<E>> implements java.io.Serializable, ObjectProvider<E>
ObjectMatcher
.Constructor and Description |
---|
GenericMatchingObjectList()
Creates a new instance of MatchingObjectList that is empty.
|
GenericMatchingObjectList(AbstractObjectIterator<E> iterator)
Creates a new instance of MatchingObjectList filled with objects from the iterator.
|
GenericMatchingObjectList(AbstractObjectIterator<E> iterator,
int partId)
Creates a new instance of MatchingObjectList filled with objects from the iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E object,
int partId)
Adds an object to the specified partition.
|
void |
add(int index,
E object,
int partId)
Inserts an object at the specified position of the specified partition.
|
E |
getObject(int index,
int partId)
Returns the object at position
index of the partition partId . |
int |
getObjectCount()
Returns the number of objects in all partitions.
|
int |
getObjectCount(int partId)
Returns the number of objects in the given partition.
|
protected AbstractObjectList<E> |
getPart(int partId)
Returns a list of objects in the partition identified by the given
partId . |
protected AbstractObjectList<E> |
getPart(int partId,
boolean allocateNewIfMissing)
Returns a list of objects in the partition identified by the given
partId . |
java.util.Set<java.lang.Integer> |
getPartIDs()
Returns all partition identifiers that are set in this list.
|
AbstractObjectIterator<E> |
iterator()
Returns an iterator for all objects of all partitions of this list.
|
AbstractObjectIterator<E> |
iterator(int partId)
Returns an iterator for objects of the specified partition of this list.
|
AbstractObjectList<E> |
objects()
Returns a list of all objects from all partitions.
|
AbstractObjectIterator<E> |
provideObjects()
Returns an iterator over the
provided objects. |
boolean |
remove(E object,
int partId)
Removes the first occurrence of the specified object from partition
partId . |
E |
remove(int index,
int partId)
Removes the object at specified
index of partition partId . |
void |
removeAll(int partId)
Removes all objects from the given partition
partId . |
java.lang.String |
toString() |
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, size, subMap, subMap, tailMap, tailMap, values
public GenericMatchingObjectList()
public GenericMatchingObjectList(AbstractObjectIterator<E> iterator)
iterator
- the iterator that provides the objects to fillpublic GenericMatchingObjectList(AbstractObjectIterator<E> iterator, int partId)
iterator
- the iterator that provides the objects to fillpartId
- the identification of the partition of this list to fillpublic java.util.Set<java.lang.Integer> getPartIDs()
protected final AbstractObjectList<E> getPart(int partId)
partId
.
Note that the returned list can be used to directly modify the encapsulated data.partId
- the identification of the partition of this list to retrievepartId
protected final AbstractObjectList<E> getPart(int partId, boolean allocateNewIfMissing)
partId
.
Note that the returned list can be used to directly modify the encapsulated data.partId
- the identification of the partition of this list to retrieveallocateNewIfMissing
- if true, a new list is allocated if there
there was none for the given partId
partId
and allocateNewIfMissing
is falsepublic int getObjectCount(int partId)
partId
- the identification of the partition of this list to retrievepublic int getObjectCount()
public E getObject(int index, int partId) throws java.util.NoSuchElementException, java.lang.IndexOutOfBoundsException
index
of the partition partId
.index
- the index of object within the given partitionpartId
- the identification of the partition from which to retrieve the objectindex
of the part partId
java.util.NoSuchElementException
- if the partition partId
is not foundjava.lang.IndexOutOfBoundsException
- if object index
is invalidpublic void add(E object, int partId)
object
- the object to addpartId
- the identification of the partition from which to retrieve the objectpublic void add(int index, E object, int partId) throws java.lang.IndexOutOfBoundsException
index
- the index in the specified partition where to insert the objectobject
- the object to insertpartId
- the identification of the partition from which to retrieve the objectjava.lang.IndexOutOfBoundsException
- if object index
is invalidpublic E remove(int index, int partId) throws java.util.NoSuchElementException, java.lang.IndexOutOfBoundsException
index
of partition partId
.index
- the index of object within the given partitionpartId
- the identification of the partition from which to remove the objectjava.util.NoSuchElementException
- if the partition partId
is not foundjava.lang.IndexOutOfBoundsException
- if object index
is invalidpublic boolean remove(E object, int partId)
partId
.
Note that the equals
method is used
to locate the object to remove.object
- the object to removepartId
- the identification of the partition from which to remove the objectjava.util.NoSuchElementException
- if the partition partId
is not foundjava.lang.IndexOutOfBoundsException
- if object index
is invalidpublic void removeAll(int partId)
partId
.partId
- the identification of the partition from which to remove all objectspublic AbstractObjectIterator<E> iterator(int partId) throws java.util.NoSuchElementException
partId
- the identification of the partition the iterator of which to retrievejava.util.NoSuchElementException
- if the partition partId
is not foundpublic AbstractObjectIterator<E> iterator()
public AbstractObjectList<E> objects()
public AbstractObjectIterator<E> provideObjects()
ObjectProvider
provided
objects.provideObjects
in interface ObjectProvider<E extends AbstractObject>
provided
objectspublic java.lang.String toString()
toString
in class java.util.AbstractMap<java.lang.Integer,AbstractObjectList<E extends AbstractObject>>