messif.objects.util
Class GenericMatchingObjectList<E extends AbstractObject>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<java.lang.Integer,AbstractObjectList<E>>
          extended by messif.objects.util.GenericMatchingObjectList<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Integer,AbstractObjectList<E>>, java.util.NavigableMap<java.lang.Integer,AbstractObjectList<E>>, java.util.SortedMap<java.lang.Integer,AbstractObjectList<E>>, ObjectProvider

public class GenericMatchingObjectList<E extends AbstractObject>
extends java.util.TreeMap<java.lang.Integer,AbstractObjectList<E>>
implements java.io.Serializable, ObjectProvider

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
GenericMatchingObjectList()
          Creates a new instance of MatchingObjectList
GenericMatchingObjectList(AbstractObjectIterator<E> iterator)
          Creates a new instance of MatchingObjectList
GenericMatchingObjectList(AbstractObjectIterator<E> iterator, int partId)
          Creates a new instance of MatchingObjectList
 
Method Summary
 void add(E object, int partId)
          Add object to a specified part
 void add(int index, E object, int partId)
          Insert object on a specified index position to a specified part
 E getObject(int index, int partId)
          Get object with index position from part partId
 int getObjectCount()
          Returns number of object in all parts
 int getObjectCount(int partId)
          Returns number of object in the given part.
 UniqueID getObjectID(int index, int partId)
          Get ID of object with index position from part partId
protected  AbstractObjectList<E> getPart(int partId)
           
protected  AbstractObjectList<E> getPart(int partId, boolean allocateNewIfMissing)
           
 java.util.Set<java.lang.Integer> getPartIDs()
           
 AbstractObjectIterator<E> iterator()
          Returns iterator through all objects from all parts of this MatchingObjectList
 AbstractObjectIterator<E> iterator(int partId)
          Returns iterator through objects from the specified part of this MatchingObjectList throws NoSuchElementException if specified part cannot be found
 AbstractObjectList<E> objects()
          Returns list of all objects from all parts of this MatchingObjectList
 AbstractObjectList<E> objects(int partId)
          Returns list of all objects from given part of this MatchingObjectList.
 AbstractObjectIterator<E> provideObjects()
          The iterator for provided objects for ObjectProvider interface.
 boolean remove(E object, int partId)
          Remove object by index position from part partId throws NoSuchElementException if part is not found
 E remove(int index, int partId)
          Remove specified object from part partId throws NoSuchElementException if part is not found
 void removeAll(int partId)
           
 java.lang.String toString()
          String representation
 
Methods inherited from class java.util.TreeMap
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
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

GenericMatchingObjectList

public GenericMatchingObjectList()
Creates a new instance of MatchingObjectList


GenericMatchingObjectList

public GenericMatchingObjectList(AbstractObjectIterator<E> iterator)
Creates a new instance of MatchingObjectList


GenericMatchingObjectList

public GenericMatchingObjectList(AbstractObjectIterator<E> iterator,
                                 int partId)
Creates a new instance of MatchingObjectList

Method Detail

getPartIDs

public java.util.Set<java.lang.Integer> getPartIDs()

getPart

protected AbstractObjectList<E> getPart(int partId)

getPart

protected AbstractObjectList<E> getPart(int partId,
                                        boolean allocateNewIfMissing)

getObjectCount

public int getObjectCount(int partId)
Returns number of object in the given part.

Parameters:
partId - partition id
Returns:
number of objects if partition exists, otherwise zero

getObjectCount

public int getObjectCount()
Returns number of object in all parts

Returns:
number of objects

getObject

public E getObject(int index,
                   int partId)
Get object with index position from part partId

Throws:
java.util.NoSuchElementException - if part is not found
java.lang.ArrayIndexOutOfBoundsException - if object index is out of bounds

getObjectID

public UniqueID getObjectID(int index,
                            int partId)
Get ID of object with index position from part partId

Throws:
java.util.NoSuchElementException - if part is not found
java.lang.ArrayIndexOutOfBoundsException - if object index is out of bounds

add

public void add(E object,
                int partId)
Add object to a specified part


add

public void add(int index,
                E object,
                int partId)
Insert object on a specified index position to a specified part


remove

public E remove(int index,
                int partId)
Remove specified object from part partId throws NoSuchElementException if part is not found


remove

public boolean remove(E object,
                      int partId)
Remove object by index position from part partId throws NoSuchElementException if part is not found


removeAll

public void removeAll(int partId)

iterator

public AbstractObjectIterator<E> iterator(int partId)
Returns iterator through objects from the specified part of this MatchingObjectList throws NoSuchElementException if specified part cannot be found


objects

public AbstractObjectList<E> objects(int partId)
                                                     throws java.util.NoSuchElementException
Returns list of all objects from given part of this MatchingObjectList.

Throws:
java.util.NoSuchElementException - if the part does not exist

iterator

public AbstractObjectIterator<E> iterator()
Returns iterator through all objects from all parts of this MatchingObjectList


objects

public AbstractObjectList<E> objects()
Returns list of all objects from all parts of this MatchingObjectList


provideObjects

public AbstractObjectIterator<E> provideObjects()
The iterator for provided objects for ObjectProvider interface.

Specified by:
provideObjects in interface ObjectProvider
Returns:
iterator for provided objects

toString

public java.lang.String toString()
String representation

Overrides:
toString in class java.util.AbstractMap<java.lang.Integer,AbstractObjectList<E extends AbstractObject>>