org.biojava3.core.sequence.views
Class ReversedSequenceView<C extends Compound>

java.lang.Object
  extended by org.biojava3.core.sequence.template.SequenceProxyView<C>
      extended by org.biojava3.core.sequence.views.ReversedSequenceView<C>
Type Parameters:
C - Must be a subtype of @{link Compound}
All Implemented Interfaces:
Iterable<C>, Accessioned, Sequence<C>, SequenceView<C>

public class ReversedSequenceView<C extends Compound>
extends SequenceProxyView<C>

For a given sequence this class will return the base at the reversed position i.e. in a sequence of size 10, if you request base 2 you will get back the base at position 9. Sub-views can be made of this class which also respect the reversed calls.

Author:
Andy Yates

Constructor Summary
ReversedSequenceView(Sequence<C> sequence)
           
 
Method Summary
 C getCompoundAt(int position)
          Returns the Compound at the given biological index
 String getSequenceAsString()
          Returns the String representation of the Sequence
protected  int toIndex(int index)
           
 
Methods inherited from class org.biojava3.core.sequence.template.SequenceProxyView
countCompounds, getAccession, getAsList, getBioEnd, getBioStart, getCompoundSet, getIndexOf, getInverse, getLastIndexOf, getLength, getSubSequence, getViewedSequence, iterator, setBioEnd, setBioStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReversedSequenceView

public ReversedSequenceView(Sequence<C> sequence)
Method Detail

getSequenceAsString

public String getSequenceAsString()
Description copied from interface: Sequence
Returns the String representation of the Sequence

Specified by:
getSequenceAsString in interface Sequence<C extends Compound>
Overrides:
getSequenceAsString in class SequenceProxyView<C extends Compound>

toIndex

protected int toIndex(int index)

getCompoundAt

public C getCompoundAt(int position)
Description copied from interface: Sequence
Returns the Compound at the given biological index

Specified by:
getCompoundAt in interface Sequence<C extends Compound>
Overrides:
getCompoundAt in class SequenceProxyView<C extends Compound>
Parameters:
position - Biological index (1 to n)
Returns:
Compound at the specified position