uk.ac.man.bioinf.sequence.complex
Class AbstractComplexSequence

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.AbstractSequence
        |
        +--uk.ac.man.bioinf.sequence.AbstractMutableSequence
              |
              +--uk.ac.man.bioinf.sequence.complex.AbstractComplexSequence
All Implemented Interfaces:
ComplexSequence, Identifiable, MutableSequence, Sequence, SequenceEventProvider
Direct Known Subclasses:
DefaultComplexSequence, DefaultGappedComplexSequence

public abstract class AbstractComplexSequence
extends AbstractMutableSequence
implements ComplexSequence

AbstractComplexSequence.java Created: Fri Nov 24 13:33:32 2000

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

Constructor Summary
AbstractComplexSequence(ComplexSequenceType type)
           
 
Method Summary
 ComplexElement addModificationAt(Modification mod, int index)
           
protected  void checkComplexSequenceType(ComplexElement element)
           
protected  void checkComplexSequenceType(ComplexElement[] element)
           
protected  void checkSequenceType(Element element)
           
protected  void checkSequenceType(Element[] element)
          Check if all these elements are of a valid type
 char[] getComplexElementAtAsChar(int index)
          Representing a ComplexElement as a char is not a simple task.
 char[] getComplexSequenceAsChars()
           
protected  InvalidSequenceTypeException getComplexSequenceTypeException(Element element)
           
 ComplexSequenceType getComplexType()
           
 ComplexElement removeModificationAt(Modification mod, int index)
           
protected abstract  ComplexElement setElementAtQuietly(ComplexElement element, int index)
           
 
Methods inherited from class uk.ac.man.bioinf.sequence.AbstractMutableSequence
addSequenceListener, addVetoableSequenceListener, fireSequenceEvent, fireVetoableSequenceEvent, hasListeners, removeSequenceListener, removeVetoableSequenceListener
 
Methods inherited from class uk.ac.man.bioinf.sequence.AbstractSequence
checkRange, getElementAtAsChar, getSequenceAsChars, getSequenceIndexException, getSequenceType, getSequenceTypeException, getSubSequence
 
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.complex.ComplexSequence
getComplexElementAt
 
Methods inherited from interface uk.ac.man.bioinf.sequence.Sequence
getElementAt, getElementAtAsChar, getLength, getSequenceAsChars, getSequenceAsElements, getSequenceType, getSubSequence
 
Methods inherited from interface uk.ac.man.bioinf.sequence.identifier.Identifiable
getIdentifier
 

Constructor Detail

AbstractComplexSequence

public AbstractComplexSequence(ComplexSequenceType type)
Method Detail

getComplexType

public ComplexSequenceType getComplexType()

checkSequenceType

protected void checkSequenceType(Element[] element)
                          throws InvalidSequenceTypeException
Description copied from class: AbstractSequence
Check if all these elements are of a valid type

Overrides:
checkSequenceType in class AbstractSequence
Parameters:
element - the elements
Throws:
InvalidSequenceTypeException - if an element is not of a valid type

checkSequenceType

protected void checkSequenceType(Element element)
                          throws InvalidSequenceTypeException
Overrides:
checkSequenceType in class AbstractSequence
InvalidSequenceTypeException

checkComplexSequenceType

protected void checkComplexSequenceType(ComplexElement[] element)
                                 throws InvalidSequenceTypeException
InvalidSequenceTypeException

checkComplexSequenceType

protected void checkComplexSequenceType(ComplexElement element)
                                 throws InvalidSequenceTypeException
InvalidSequenceTypeException

getComplexSequenceTypeException

protected InvalidSequenceTypeException getComplexSequenceTypeException(Element element)

addModificationAt

public ComplexElement addModificationAt(Modification mod,
                                        int index)
                                 throws SequenceVetoException
Specified by:
addModificationAt in interface ComplexSequence
SequenceVetoException

setElementAtQuietly

protected abstract ComplexElement setElementAtQuietly(ComplexElement element,
                                                      int index)

removeModificationAt

public ComplexElement removeModificationAt(Modification mod,
                                           int index)
                                    throws SequenceVetoException
Specified by:
removeModificationAt in interface ComplexSequence
SequenceVetoException

getComplexElementAtAsChar

public char[] getComplexElementAtAsChar(int index)
Description copied from interface: ComplexSequence
Representing a ComplexElement as a char is not a simple task. An Element can have any number of Modifications each of which comes with its own char representation. The following approach is used. Each Element is represented first by its own char representation, and then by its all of its modifications, and then finally by an underscore _, which acts as a standard terminator. Counting the number of underscores should show how many Elements there are. This is not meant to be a particular wonderfully parse-able format.

Specified by:
getComplexElementAtAsChar in interface ComplexSequence
Parameters:
index -
Returns:
a char[] value

getComplexSequenceAsChars

public char[] getComplexSequenceAsChars()
Specified by:
getComplexSequenceAsChars in interface ComplexSequence