ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.collections
Class ObjectTypeListIterator<E>

java.lang.Object
  extended by umontreal.iro.lecuyer.collections.FilteredIterator<E>
      extended by umontreal.iro.lecuyer.collections.FilteredListIterator<E>
          extended by umontreal.iro.lecuyer.collections.ObjectTypeListIterator<E>
Type Parameters:
E - the type of the objects.
All Implemented Interfaces:
Iterator<E>, ListIterator<E>

public class ObjectTypeListIterator<E>
extends FilteredListIterator<E>

Represents a list iterator traversing objects of a particular class enumerated by another iterator.


Constructor Summary
ObjectTypeListIterator(ListIterator<? super E> it, Class<E> objectClass)
          Constructs a new iterator traversing objects of class objectClass enumerated by the inner iterator it.
ObjectTypeListIterator(ListIterator<? super E> it, Class<E> objectClass, int maxNumElements)
          Constructs a new iterator traversing at most maxNumElements objects of class objectClass enumerated by the inner iterator it.
 
Method Summary
 boolean filter(Object o)
          Determines if the object o is returned by this iterator.
 Class<E> getObjectClass()
          Returns the class of the objects returned by this iterator.
 
Methods inherited from class umontreal.iro.lecuyer.collections.FilteredListIterator
add, getInnerIterator, hasNext, hasPrevious, next, nextIndex, previous, previousIndex, remove, set
 
Methods inherited from class umontreal.iro.lecuyer.collections.FilteredIterator
getMaxNumElements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectTypeListIterator

public ObjectTypeListIterator(ListIterator<? super E> it,
                              Class<E> objectClass)
Constructs a new iterator traversing objects of class objectClass enumerated by the inner iterator it.

Parameters:
it - the inner iterator.
objectClass - the object class.
Throws:
NullPointerException - if it or objectClass are null.

ObjectTypeListIterator

public ObjectTypeListIterator(ListIterator<? super E> it,
                              Class<E> objectClass,
                              int maxNumElements)
Constructs a new iterator traversing at most maxNumElements objects of class objectClass enumerated by the inner iterator it.

Parameters:
it - the inner iterator.
objectClass - the object class.
maxNumElements - the maximal nuber of traverd objects.
Throws:
NullPointerException - if it or objectClass are null.
IllegalArgumentException - if maxNumElements is negative.
Method Detail

getObjectClass

public Class<E> getObjectClass()
Returns the class of the objects returned by this iterator.

Returns:
the class of the iterated objects.

filter

public boolean filter(Object o)
Description copied from class: FilteredIterator
Determines if the object o is returned by this iterator. Returns true if the object is accepted, false otherwise. This iterator assumes that this method returns true for a particular object o only if o can be cast into an instance of E.

Specified by:
filter in class FilteredIterator<E>
Parameters:
o - the tested object.
Returns:
the result of the test.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.