sofya.mutator
Class MutationIterator

java.lang.Object
  extended by sofya.mutator.MutationIterator
All Implemented Interfaces:
java.util.Iterator

public final class MutationIterator
extends java.lang.Object
implements java.util.Iterator

An iterator over a mutation table stored in a file.

This iterator provides the capability to read a mutation table from file progressively, avoiding the need to preload an entire table into memory.

Version:
09/27/2005
Author:
Alex Kinneer

Method Summary
 void close()
          Closes the underlying mutation file.
 int count()
          Gets the number of mutations in this iteration.
 boolean hasNext()
          Reports whether the iteration has more mutations.
 java.lang.Object next()
          Gets the next mutation in the iteration; this method is provided to satisfy the standard java.util.Iterator contract.
 Mutation nextMutation()
          Gets the next mutation in the iteration.
 void remove()
          Unsupported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

count

public int count()
Gets the number of mutations in this iteration.

Returns:
The number of iterations that will be returned by this iterator.

hasNext

public boolean hasNext()
Reports whether the iteration has more mutations.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iteration has more mutations.

nextMutation

public Mutation nextMutation()
                      throws java.io.IOException
Gets the next mutation in the iteration.

Returns:
The next mutation from the iteration.
Throws:
java.io.IOException - If an error reading the underlying file prevents the iterator from returning the next mutation.
java.util.NoSuchElementException - If the iteration does not contain any more mutations.

next

public java.lang.Object next()
Gets the next mutation in the iteration; this method is provided to satisfy the standard java.util.Iterator contract.

Specified by:
next in interface java.util.Iterator
Returns:
The next mutation from the iteration.
Throws:
java.util.NoSuchElementException - If the iteration does not contain any more mutations, or if an error reading the underlying file prevents the iterator from returning the next mutation.

close

public void close()
Closes the underlying mutation file.

This function is provided to permit cleanup on premature failure of the iteration. The mutation file is automatically closed when the end of the iteration is reached normally.


remove

public void remove()
Unsupported. This iterator does not permit removal of elements.

Specified by:
remove in interface java.util.Iterator