de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous
Class SequenceIterator

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.SequenceIterator
All Implemented Interfaces:
Cloneable

public class SequenceIterator
extends Object
implements Cloneable

This class is used to iterate over a discrete sequence.

Author:
Jens Keilwagen

Constructor Summary
SequenceIterator(int length)
          Creates a new SequenceIterator with maximal length.
 
Method Summary
 SequenceIterator clone()
           
 int discreteValAt(int pos)
          This method returns the discrete value for a specific position.
 int getNumberOfSequences()
          This method returns the number of sequences in this iterator, i.e., the number of times next() returns true after using reset().
 boolean next()
          Changes the internal sequence representation to the next sequence.
 void reset()
          Resets the internal sequence representation.
 void setBounds(int[] bounds)
          This method sets the bounds for each position.
 boolean skip(int firstPos)
          This method skips some position.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceIterator

public SequenceIterator(int length)
Creates a new SequenceIterator with maximal length.

Parameters:
length - the maximal length of the sequence
Method Detail

clone

public SequenceIterator clone()
                       throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

next

public boolean next()
Changes the internal sequence representation to the next sequence.

Returns:
true if the new sequence is correct, otherwise false

reset

public void reset()
Resets the internal sequence representation. So the SequenceIterator starts again.


setBounds

public void setBounds(int[] bounds)
This method sets the bounds for each position. It does not copy the array and it does not proof bounds.length <= length. This has to be ensured by the user.

Parameters:
bounds - the array with bounds for each position

skip

public boolean skip(int firstPos)
This method skips some position.

Parameters:
firstPos - the first position that is interesting
Returns:
true if the internal sequence is from the scope, false otherwise

discreteValAt

public int discreteValAt(int pos)
This method returns the discrete value for a specific position.

Parameters:
pos - the position
Returns:
the value for the given position

getNumberOfSequences

public int getNumberOfSequences()
This method returns the number of sequences in this iterator, i.e., the number of times next() returns true after using reset().

Returns:
the number of sequences in this iterator