org.expasy.jpl.commons.collection.symbol.seq
Class AbstractSequencePositioner<T>

java.lang.Object
  extended by org.expasy.jpl.commons.collection.symbol.seq.AbstractSequencePositioner<T>
All Implemented Interfaces:
Iterable<Integer>, ExtraIterable<Integer>, IndexIterable, SequenceIterable<T>
Direct Known Subclasses:
MotifMatcher

public abstract class AbstractSequencePositioner<T>
extends Object
implements SequenceIterable<T>

This class provides a skeletal implementation of the PositionIterable interface, to minimize the effort required to implement this interface. To implement a JPL positioner on a Sequence, the programmer needs only to extend this class and provide implementations for the iterator. (The iterator returned by the iterator method must implement the foundNextPosition() method).

Version:
1.0
Author:
nikitin

Nested Class Summary
 class AbstractSequencePositioner.Iterator
          This inner class provides implementations for next() and hasNext() needed from Iterator interface.
 
Nested classes/interfaces inherited from interface org.expasy.jpl.commons.collection.ExtraIterable
ExtraIterable.AbstractExtraIterator<T>
 
Field Summary
protected  int numberOfPositions
           
protected  SymbolSequence<T> sequence
          Iterator will iterate over found positions on this sequence.
 
Constructor Summary
AbstractSequencePositioner()
           
 
Method Summary
 int getNumberOfSites()
          get number of positions
 IndexIterable.Iterator iterator(SymbolSequence<T> sequence)
          coupling sequence with iterator
 void setSequence(SymbolSequence<T> sequence)
          Set the sequence for future searches.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.expasy.jpl.commons.collection.IndexIterable
iterator
 

Field Detail

sequence

protected SymbolSequence<T> sequence
Iterator will iterate over found positions on this sequence.


numberOfPositions

protected int numberOfPositions
Constructor Detail

AbstractSequencePositioner

public AbstractSequencePositioner()
Method Detail

setSequence

public void setSequence(SymbolSequence<T> sequence)
Set the sequence for future searches.

Specified by:
setSequence in interface SequenceIterable<T>
Parameters:
sequence - the sequence where motif search will be done.
Throws:
IllegalArgumentException - if sequence is not defined.

getNumberOfSites

public int getNumberOfSites()
Description copied from interface: SequenceIterable
get number of positions

Specified by:
getNumberOfSites in interface SequenceIterable<T>

iterator

public IndexIterable.Iterator iterator(SymbolSequence<T> sequence)
Description copied from interface: SequenceIterable
coupling sequence with iterator

Specified by:
iterator in interface SequenceIterable<T>


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.