ABL4J (Alignment Based Learning for Java) - 0.9.7

org.schwiebert.abl4j.data
Class FindIterator<T>

java.lang.Object
  extended by org.schwiebert.abl4j.data.FindIterator<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterator<IConstituent<T>>

public class FindIterator<T>
extends Object
implements Iterator<IConstituent<T>>

An Iterator that does not check ConcurrentModificationException.


Field Summary
(package private)  int cursor
          Index of element to be returned by subsequent call to next.
(package private)  int lastRet
          Index of element returned by most recent call to next or previous.
private  List list
           
private  IConstituent<T> searched
           
 
Constructor Summary
FindIterator(IConstituent<T> searched, List list)
           
 
Method Summary
 boolean hasNext()
           
private  int indexOf(Object elem, int index)
          Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
 IConstituent<T> next()
           
 void remove()
          Not supported - Will throw an UnsupportedOperationException if called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

private List list

searched

private IConstituent<T> searched

cursor

int cursor
Index of element to be returned by subsequent call to next.


lastRet

int lastRet
Index of element returned by most recent call to next or previous. Reset to -1 if this element is deleted by a call to remove.

Constructor Detail

FindIterator

public FindIterator(IConstituent<T> searched,
                    List list)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<IConstituent<T>>

next

public IConstituent<T> next()
Specified by:
next in interface Iterator<IConstituent<T>>

remove

public void remove()
Not supported - Will throw an UnsupportedOperationException if called.

Specified by:
remove in interface Iterator<IConstituent<T>>

indexOf

private int indexOf(Object elem,
                    int index)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.

Parameters:
elem - an object.
index - the non-negative index to start searching from.
Returns:
the index of the first occurrence of the object argument in this vector at position index or later in the vector, that is, the smallest value k such that elem.equals(elementData[k]) && (k >= index) is true; returns -1 if the object is not found. (Returns -1 if index >= the current size of this Vector.)
Throws:
IndexOutOfBoundsException - if index is negative.
See Also:
Object.equals(Object)

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert