Class ContentList.FilterListIterator

java.lang.Object
  extended by ContentList.FilterListIterator
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator
Enclosing class:
ContentList
 class ContentList.FilterListIterator
extends java.lang.Object
implements java.util.ListIterator

Field Summary
(package private)  intcursor
          Index in backing list of next object
(package private)  intexpected
          Expected modCount in our backing list
(package private)  Filterfilter
          The Filter that applies
(package private)  intinitialCursor
          Initial start index in backing list
(package private)  intlast
          Index in backing list of last object returned
(package private)  intlastOperation
          The last operation performed
 
Constructor Summary
ContentList.FilterListIterator(Filter filter, int start)
          Default constructor
 
Method Summary
 voidadd(java.lang.Object obj)
          Inserts the specified element into the list.
private  voidcheckConcurrentModification()
          Check if are backing list is being modified by someone else.
 booleanhasNext()
          Returns true if this list iterator has a next element.
 booleanhasPrevious()
          Returns true if this list iterator has more elements when traversing the list in the reverse direction.
private  intinitializeCursor(int start)
          Returns index in the backing list by moving forward start objects that match our filter.
private  intmoveBackward(int start)
          Returns index in the backing list of the next object matching our filter, starting at the given index and moving backwards.
private  intmoveForward(int start)
          Returns index in the backing list of the next object matching our filter, starting at the given index and moving forwards.
 java.lang.Objectnext()
          Returns the next element in the list.
 intnextIndex()
          Returns the index of the element that would be returned by a subsequent call to next.
 java.lang.Objectprevious()
          Returns the previous element in the list.
 intpreviousIndex()
          Returns the index of the element that would be returned by a subsequent call to previous.
 voidremove()
          Removes from the list the last element that was returned by next or previous.
 voidset(java.lang.Object obj)
          Replaces the last element returned by next or previous with the specified element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

Filter filter
The Filter that applies

lastOperation

int lastOperation
The last operation performed

initialCursor

int initialCursor
Initial start index in backing list

cursor

int cursor
Index in backing list of next object

last

int last
Index in backing list of last object returned

expected

int expected
Expected modCount in our backing list

Constructor Detail

ContentList.FilterListIterator

ContentList.FilterListIterator(Filter filter,
                               int start)
Default constructor

Method Detail

hasNext

public boolean hasNext()
Returns true if this list iterator has a next element.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface java.util.ListIterator

next

public java.lang.Object next()
Returns the next element in the list.

Specified by:
next in interface java.util.Iterator
Specified by:
next in interface java.util.ListIterator

hasPrevious

public boolean hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the reverse direction.

Specified by:
hasPrevious in interface java.util.ListIterator

previous

public java.lang.Object previous()
Returns the previous element in the list.

Specified by:
previous in interface java.util.ListIterator

nextIndex

public int nextIndex()
Returns the index of the element that would be returned by a subsequent call to next.

Specified by:
nextIndex in interface java.util.ListIterator

previousIndex

public int previousIndex()
Returns the index of the element that would be returned by a subsequent call to previous. (Returns -1 if the list iterator is at the beginning of the list.)

Specified by:
previousIndex in interface java.util.ListIterator

add

public void add(java.lang.Object obj)
Inserts the specified element into the list.

Specified by:
add in interface java.util.ListIterator

remove

public void remove()
Removes from the list the last element that was returned by next or previous. the last call to next or previous.

Specified by:
remove in interface java.util.Iterator
Specified by:
remove in interface java.util.ListIterator

set

public void set(java.lang.Object obj)
Replaces the last element returned by next or previous with the specified element.

Specified by:
set in interface java.util.ListIterator

initializeCursor

private int initializeCursor(int start)
Returns index in the backing list by moving forward start objects that match our filter.

moveForward

private int moveForward(int start)
Returns index in the backing list of the next object matching our filter, starting at the given index and moving forwards.

moveBackward

private int moveBackward(int start)
Returns index in the backing list of the next object matching our filter, starting at the given index and moving backwards.

checkConcurrentModification

private void checkConcurrentModification()
Check if are backing list is being modified by someone else.