uk.ac.man.bioinf.sequence.alignment
Class EmptyGappedSequence

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.alignment.EmptyGappedSequence
All Implemented Interfaces:
GappedSequence, Identifiable, MutableSequence, Sequence, SequenceEventProvider

public class EmptyGappedSequence
extends Object
implements GappedSequence

EmptyGappedSequence.java Created: Tue Nov 7 18:15:06 2000

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

Method Summary
 void addSequenceListener(SequenceListener param1)
          Adds the specified sequence listener.
 void addVetoableSequenceListener(VetoableSequenceListener param1)
          Adds the specified vetoable sequence listener.
 void deleteGapAt(int param1)
          Delete the element at index.
 void deleteGapAt(int param1, int param2)
          Delete the elements starting at index for the specified length
 Element getElementAt(int param1)
          Returns an element at a given location.
 char getElementAtAsChar(int param1)
          Returns the character of an target element.
 Element getGappedElementAt(int param1)
           
 char getGappedElementAtAsChar(int param1)
           
 int getGappedLength()
          Returns the gapped length of this sequence.
 int getGappedPositionOf(int param1)
          Translate between the gapped index, and the ungapped index
 char[] getGappedSequenceAsChars()
           
 Element[] getGappedSequenceAsElements()
           
 GappedSequence getGappedSubSequence(int param1, int param2)
           
 Identifier getIdentifier()
           
static EmptyGappedSequence getInstance()
           
 int getLength()
          Returns the length of the sequence.
 char[] getSequenceAsChars()
          Returns the sequence as an array of characters.
 Element[] getSequenceAsElements()
          Returns the sequence as an array of elements.
 SequenceType getSequenceType()
          Returns the type of sequence.
 Sequence getSubSequence(int param1, int param2)
          Returns a sub-sequence from the current sequence.
 int getUngappedPositionOf(int param1)
          Translate between the gapped position and the ungapped position.
 void insertGapAt(int param1)
           
 void insertGapAt(int param1, int param2)
          Inserts the elements at this position.
 void removeSequenceListener(SequenceListener param1)
          Removes the specified sequence listener.
 void removeVetoableSequenceListener(VetoableSequenceListener param1)
          Removes the specified vetoable sequence listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EmptyGappedSequence getInstance()

getSubSequence

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

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

getSequenceType

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

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

getSequenceAsElements

public Element[] getSequenceAsElements()
Description copied from interface: Sequence
Returns the sequence as an array of elements.

Specified by:
getSequenceAsElements in interface Sequence
Returns:
the 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

getLength

public int getLength()
Description copied from interface: Sequence
Returns the length of the sequence.

Specified by:
getLength in interface Sequence
Returns:
the length of the sequence

getElementAtAsChar

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

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

getElementAt

public Element getElementAt(int param1)
Description copied from interface: Sequence
Returns an element at a given location.

Specified by:
getElementAt in interface Sequence
Parameters:
param1 - the location of the target element
Returns:
the element

insertGapAt

public void insertGapAt(int param1,
                        int param2)
                 throws NoSuchSequenceElementException,
                        SequenceVetoException
Description copied from interface: GappedSequence
Inserts the elements at this position. If the index is one longer than the length of the sequence the sequence will be extended.

Specified by:
insertGapAt in interface GappedSequence
Parameters:
param1 - the index at which to insert
Throws:
NoSuchSequenceElementException - if the element does not exist, which will be the case if index is less than 1 or greater than sequence length + 1
SequenceVetoException

insertGapAt

public void insertGapAt(int param1)
                 throws NoSuchSequenceElementException,
                        SequenceVetoException
Specified by:
insertGapAt in interface GappedSequence
NoSuchSequenceElementException
SequenceVetoException

getUngappedPositionOf

public int getUngappedPositionOf(int param1)
Description copied from interface: GappedSequence
Translate between the gapped position and the ungapped position. I havent quite decided what to do at the moment if the index refers to a gap. One idea is to throw a NoSuchSequenceElementException which makes a certain amount of sense but isnt really that useful. Perhaps a better idea is to run -(insertion-point) where the insertion point is the nearest element before the current requested position which is not a gap. That way a value less than 0 would indicate a gap and would also return a useful value

Specified by:
getUngappedPositionOf in interface GappedSequence
Parameters:
param1 -
Returns:

getGappedSubSequence

public GappedSequence getGappedSubSequence(int param1,
                                           int param2)
Specified by:
getGappedSubSequence in interface GappedSequence

getGappedSequenceAsElements

public Element[] getGappedSequenceAsElements()
Specified by:
getGappedSequenceAsElements in interface GappedSequence

getGappedSequenceAsChars

public char[] getGappedSequenceAsChars()
Specified by:
getGappedSequenceAsChars in interface GappedSequence

getGappedPositionOf

public int getGappedPositionOf(int param1)
Description copied from interface: GappedSequence
Translate between the gapped index, and the ungapped index

Specified by:
getGappedPositionOf in interface GappedSequence
Parameters:
param1 - the ungapped position
Returns:
the gapped position of the equivalent element

getGappedLength

public int getGappedLength()
Description copied from interface: GappedSequence
Returns the gapped length of this sequence. That is the length of the sequence including its gaps. Conversely this means that the getLength method of the Sequence interface returns the length of the sequence ignoring the gaps.

Specified by:
getGappedLength in interface GappedSequence
Returns:
the length

getGappedElementAtAsChar

public char getGappedElementAtAsChar(int param1)
Specified by:
getGappedElementAtAsChar in interface GappedSequence

getGappedElementAt

public Element getGappedElementAt(int param1)
Specified by:
getGappedElementAt in interface GappedSequence

deleteGapAt

public void deleteGapAt(int param1,
                        int param2)
                 throws NoGapAtThisPositionException,
                        NoSuchSequenceElementException,
                        SequenceVetoException
Description copied from interface: GappedSequence
Delete the elements starting at index for the specified length

Specified by:
deleteGapAt in interface GappedSequence
Parameters:
param1 - the index to start at
param2 - the length to delete
Returns:
the elements just deleted
Throws:
NoSuchSequenceElementException - if the elements do not all exist, so if index is less than 1, or index + length is greater than the length of the sequence
NoGapAtThisPositionException
SequenceVetoException

deleteGapAt

public void deleteGapAt(int param1)
                 throws NoGapAtThisPositionException,
                        NoSuchSequenceElementException,
                        SequenceVetoException
Description copied from interface: GappedSequence
Delete the element at index.

Specified by:
deleteGapAt in interface GappedSequence
Parameters:
param1 - the index to delete
Returns:
the element which has just been deleted
Throws:
NoSuchSequenceElementException - if index is less than 1 or greater than the length of the sequence
NoGapAtThisPositionException
SequenceVetoException

getIdentifier

public Identifier getIdentifier()
Specified by:
getIdentifier in interface Identifiable

removeVetoableSequenceListener

public void removeVetoableSequenceListener(VetoableSequenceListener param1)
Description copied from interface: SequenceEventProvider
Removes the specified vetoable sequence listener.

Specified by:
removeVetoableSequenceListener in interface SequenceEventProvider
Parameters:
param1 - the vetoable sequence listener

removeSequenceListener

public void removeSequenceListener(SequenceListener param1)
Description copied from interface: SequenceEventProvider
Removes the specified sequence listener.

Specified by:
removeSequenceListener in interface SequenceEventProvider
Parameters:
param1 - the sequence listener

addVetoableSequenceListener

public void addVetoableSequenceListener(VetoableSequenceListener param1)
Description copied from interface: SequenceEventProvider
Adds the specified vetoable sequence listener.

Specified by:
addVetoableSequenceListener in interface SequenceEventProvider
Parameters:
param1 - the vetoable sequence listener

addSequenceListener

public void addSequenceListener(SequenceListener param1)
Description copied from interface: SequenceEventProvider
Adds the specified sequence listener.

Specified by:
addSequenceListener in interface SequenceEventProvider
Parameters:
param1 - the sequence listener