org.biojava3.core.sequence.views
Class ComplementSequenceView<C extends ComplementCompound>

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

public class ComplementSequenceView<C extends ComplementCompound>
extends SequenceProxyView<C>

For a given sequence this class will create a view over the top of it and for every request the code will return the complement of the underlying base e.g. base A will become base T

Author:
Andy Yates

Constructor Summary
ComplementSequenceView(Sequence<C> sequence)
           
 
Method Summary
 C getCompoundAt(int position)
          Returns the Compound at the given biological index
 int getIndexOf(C compound)
          Scans through the Sequence looking for the first occurrence of the given compound
 int getLastIndexOf(C compound)
          Scans through the Sequence looking for the last occurrence of the given compound
 String getSequenceAsString()
          Returns the String representation of the Sequence
 
Methods inherited from class org.biojava3.core.sequence.template.SequenceProxyView
countCompounds, getAccession, getAsList, getBioEnd, getBioStart, getCompoundSet, getInverse, 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

ComplementSequenceView

public ComplementSequenceView(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 ComplementCompound>
Overrides:
getSequenceAsString in class SequenceProxyView<C extends ComplementCompound>

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 ComplementCompound>
Overrides:
getCompoundAt in class SequenceProxyView<C extends ComplementCompound>
Parameters:
position - Biological index (1 to n)
Returns:
Compound at the specified position

getIndexOf

public int getIndexOf(C compound)
Description copied from interface: Sequence
Scans through the Sequence looking for the first occurrence of the given compound

Specified by:
getIndexOf in interface Sequence<C extends ComplementCompound>
Overrides:
getIndexOf in class SequenceProxyView<C extends ComplementCompound>
Parameters:
compound - Compounds to look for
Returns:
Index of the first position of the compound in the sequence (1 to n)

getLastIndexOf

public int getLastIndexOf(C compound)
Description copied from interface: Sequence
Scans through the Sequence looking for the last occurrence of the given compound

Specified by:
getLastIndexOf in interface Sequence<C extends ComplementCompound>
Overrides:
getLastIndexOf in class SequenceProxyView<C extends ComplementCompound>
Parameters:
compound - Compounds to look for
Returns:
Index of the last position of the compound in the sequence (1 to n)