ve
Interface EltsIterator

All Known Implementing Classes:
FactorAssign.Itr, FactorDeterministic.Itr, FactorExpand.Itr, FactorNormalise.Itr, FactorObserved.Itr, FactorPlus.Itr, FactorStored.Itr, FactorStoredPretend.Itr, FactorTimes.Itr, FactorUniform.Itr

public interface EltsIterator

An iterator over the elements of a factor. This follows the basic abstract Iterator interface, but doesn't throw an exception. (It assumes it will be used properly.) I don't use the standard interface because I extend it to go back to a positon. This is needed for FactorExpand.


Method Summary
 void backTo(int pos)
          Goes back to the given position in the iteration.
 int currPos()
          Returns the current position in the iteration.
 boolean hasNext()
          Returns true if the iterator has more elements.
 double next()
          Returns the next element in the iteration.
 

Method Detail

hasNext

public boolean hasNext()
Returns true if the iterator has more elements.
Returns:
true if the iterator has more elements.

next

public double next()
Returns the next element in the iteration.
Returns:
the next element in the iteration.

currPos

public int currPos()
Returns the current position in the iteration. The position is the index in the sequence of values. That is the position where the next value will be taken out of. This will even be true when the factor isn't represented as an array.
Returns:
the current position in the iteration.

backTo

public void backTo(int pos)
Goes back to the given position in the iteration.
Parameters:
pos - the position in the iteration returned by currPos