|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava3.core.sequence.views.WindowedSequence<C>
C
- The type of compound we return from a windowpublic class WindowedSequence<C extends Compound>
A sliding window view of a sequence which does not implement any
interfaces like Sequence
because they do not fit how this works.
For each index requested we return a SequenceView or List of compounds back.
If you perform a view on a Sequence whose length is not a multiple of the
window the final window will be omitted i.e. if we have the sequence AGCGG
and a window of 3 then you will only see AGC since GG exceeds the calculated
length of this sequence.
Because this does not implement a Sequence interface we do not recommend
passing this class around. If you need to represent a windowed sequence
as a real Sequence then translate it into a new Compound
Constructor Summary | |
---|---|
WindowedSequence(Sequence<C> sequence,
int windowSize)
|
Method Summary | |
---|---|
SequenceView<C> |
get(int index)
Returns the window specified at the given index in offsets i.e. |
Sequence<C> |
getBackingSequence()
Access the sequence which backs this window |
List<C> |
getCompounds(int index)
For a given position into the windowed view this will return those compounds we can see in the window. |
int |
getLength()
Returns the size of the windowed sequence which is the length by the window size. |
int |
getWindowSize()
Access the current window size |
Iterator<SequenceView<C>> |
iterator()
Returns an iterator which will return the windows in a sequence in sequential order. |
protected int |
toStartIndex(int index)
Calculates start index according to the equation start = ( (index-1) - windowSize) +1 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WindowedSequence(Sequence<C> sequence, int windowSize)
Method Detail |
---|
public int getWindowSize()
public Sequence<C> getBackingSequence()
protected int toStartIndex(int index)
public int getLength()
public List<C> getCompounds(int index)
index
- Windowed index position
public SequenceView<C> get(int index)
public Iterator<SequenceView<C>> iterator()
iterator
in interface Iterable<SequenceView<C extends Compound>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |