uk.ac.man.bioinf.sequence
Class AbstractSequence

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.AbstractSequence
All Implemented Interfaces:
Identifiable, Sequence
Direct Known Subclasses:
AbstractMutableSequence, DefaultSequence

public abstract class AbstractSequence
extends Object
implements Sequence

AbstractSequence.java Provides some of the methods for sequence. It assumes that the sequence is stored internally as a list of Residues and does all the mapping into chars. Created: Thu Mar 2 16:10:51 2000

Version:
$Id: AbstractSequence.java,v 1.7 2001/04/11 17:04:43 lord Exp $
Author:
Phillip Lord

Constructor Summary
AbstractSequence(SequenceType type)
           
 
Method Summary
protected  void checkRange(int index)
           
protected  void checkSequenceType(Element element)
           
protected  void checkSequenceType(Element[] elements)
          Check if all these elements are of a valid type
 char getElementAtAsChar(int index)
          Returns the character of an target element.
 char[] getSequenceAsChars()
          Returns the sequence as an array of characters.
protected  NoSuchSequenceElementException getSequenceIndexException(int index)
           
 SequenceType getSequenceType()
          Returns the type of sequence.
protected  InvalidSequenceTypeException getSequenceTypeException(Element element)
           
 Sequence getSubSequence(int position, int length)
          Returns a sub-sequence from the current sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.man.bioinf.sequence.Sequence
getElementAt, getLength, getSequenceAsElements
 
Methods inherited from interface uk.ac.man.bioinf.sequence.identifier.Identifiable
getIdentifier
 

Constructor Detail

AbstractSequence

public AbstractSequence(SequenceType type)
Method Detail

getSequenceType

public SequenceType getSequenceType()
Description copied from interface: Sequence
Returns the type of sequence.

Specified by:
getSequenceType in interface Sequence
Returns:
the sequence type

getSubSequence

public Sequence getSubSequence(int position,
                               int length)
Description copied from interface: Sequence
Returns a sub-sequence from the current sequence.

Specified by:
getSubSequence in interface Sequence
Parameters:
position - the initial index of the sub-sequence
Returns:
the sub-sequence

getSequenceAsChars

public char[] getSequenceAsChars()
Description copied from interface: Sequence
Returns the sequence as an array of characters.

Specified by:
getSequenceAsChars in interface Sequence
Returns:
the sequence

getElementAtAsChar

public char getElementAtAsChar(int index)
Description copied from interface: Sequence
Returns the character of an target element.

Specified by:
getElementAtAsChar in interface Sequence
Parameters:
index - the location of the target element
Returns:
the element character

checkSequenceType

protected void checkSequenceType(Element[] elements)
                          throws InvalidSequenceTypeException
Check if all these elements are of a valid type

Parameters:
elements - the elements
Throws:
InvalidSequenceTypeException - if an element is not of a valid type

getSequenceTypeException

protected InvalidSequenceTypeException getSequenceTypeException(Element element)

checkSequenceType

protected void checkSequenceType(Element element)
                          throws InvalidSequenceTypeException
InvalidSequenceTypeException

getSequenceIndexException

protected NoSuchSequenceElementException getSequenceIndexException(int index)

checkRange

protected void checkRange(int index)