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

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.alignment.AbstractSequenceAlignment
All Implemented Interfaces:
AlignmentEventProvider, EventListener, Identifiable, SequenceAlignment, SequenceEventProvider, SequenceListener, VetoableSequenceListener
Direct Known Subclasses:
DefaultSequenceAlignment

public abstract class AbstractSequenceAlignment
extends Object
implements SequenceAlignment, VetoableSequenceListener

AbstractSequenceAlignment.java An abstract class to extend for the basic definition of a multiple sequence alignment. This class basically ensures listener handling. Created: Mon Feb 21 13:02:10 2000

Version:
$Id: AbstractSequenceAlignment.java,v 1.13 2001/04/11 17:04:43 lord Exp $
Author:
J Selley

Constructor Summary
AbstractSequenceAlignment()
           
 
Method Summary
 void addAlignmentListener(AlignmentListener listener)
          Delegates to the AlignmentListenerSupport object, the addition of a Multiple Sequence (MS) listener.
 void addSequence(GappedSequence seq, int inset)
          Adds a sequence to the alignment.
 void addSequence(SequenceAlignment align)
          Calls addSequence on every sequence in the supplied alignment.
 void addSequenceListener(SequenceListener listener)
          Adds the specified sequence listener.
protected abstract  void addSequenceQuietly(GappedSequence sequence, int inset)
          Adds a sequence to the alignment, quietly, without notifying listeners.
 void addVetoableAlignmentListener(VetoableAlignmentListener listener)
          Delegates to the AlignmentListenerSupport the addition of a vetoable MS listener.
 void addVetoableSequenceListener(VetoableSequenceListener listener)
          Adds the specified vetoable sequence listener.
 void changeOccurred(SequenceEvent event)
          Method called when a change occurs
protected  void fireAlignmentEvent(AlignmentEvent event)
           
protected  void fireVetoableAlignmentEvent(VetoableAlignmentEvent event)
           
 SequenceAlignment getSubAlignment(SequenceAlignmentRectangle rect)
           
 void removeAlignmentListener(AlignmentListener listener)
          Delegates to the AlignmentListenerSupport the removal of the MS listener.
 GappedSequence removeSequence(int seqIndex)
          Removes a sequence from the alignment.
 void removeSequenceListener(SequenceListener listener)
          Removes the specified sequence listener.
protected abstract  GappedSequence removeSequenceQuietly(int seqIndex)
          Remove a sequence from the alignment, quietly, without notifying listeners.
 void removeVetoableAlignmentListener(VetoableAlignmentListener listener)
          Delegates to the AlignmentListenerSupport the removal of the vetoable MS listener.
 void removeVetoableSequenceListener(VetoableSequenceListener listener)
          Removes the specified vetoable sequence listener.
 void setInset(int seqIndex, int inset)
          Set the inset (or number of preceeding gaps) in a sequence.
protected abstract  void setInsetQuietly(int seqIndex, int inset)
          Set the inset (or number of preceeding gaps) in a sequence, quietly without notifying listeners.
protected abstract  void setLengthQuietly(int length)
           
 void vetoableChangeOccurred(VetoableSequenceEvent event)
          Method signalled before a prospective change occurs
 
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.alignment.SequenceAlignment
getInset, getLength, getNumberSequences, getSequenceAt, getSequenceIndex, getSequenceType, getSubAlignment
 
Methods inherited from interface uk.ac.man.bioinf.sequence.identifier.Identifiable
getIdentifier
 

Constructor Detail

AbstractSequenceAlignment

public AbstractSequenceAlignment()
Method Detail

setLengthQuietly

protected abstract void setLengthQuietly(int length)

addSequenceQuietly

protected abstract void addSequenceQuietly(GappedSequence sequence,
                                           int inset)
Adds a sequence to the alignment, quietly, without notifying listeners.

Parameters:
sequence - the sequence
inset - the inset of the sequence

getSubAlignment

public SequenceAlignment getSubAlignment(SequenceAlignmentRectangle rect)
Specified by:
getSubAlignment in interface SequenceAlignment

addSequence

public void addSequence(GappedSequence seq,
                        int inset)
                 throws AlignmentVetoException
Adds a sequence to the alignment. This action can be vetoed by a listener.

Specified by:
addSequence in interface SequenceAlignment
Parameters:
seq - the sequence
inset - the sequence inset
Throws:
AlignmentVetoException - veto to the addition

addSequence

public void addSequence(SequenceAlignment align)
                 throws AlignmentVetoException
Calls addSequence on every sequence in the supplied alignment. This basically provides a simple shortcut method.

Parameters:
align - the alignment of sequences to be added
Throws:
AlignmentVetoException - veto to the addition - this can be sequence based as well as alignment based

removeSequenceQuietly

protected abstract GappedSequence removeSequenceQuietly(int seqIndex)
Remove a sequence from the alignment, quietly, without notifying listeners.

Parameters:
seqIndex - the sequence index
Returns:
the sequence

removeSequence

public GappedSequence removeSequence(int seqIndex)
                              throws AlignmentVetoException
Removes a sequence from the alignment. This action can be veetoed by a listener.

Specified by:
removeSequence in interface SequenceAlignment
Parameters:
seqIndex - the sequence index
Returns:
the sequence
Throws:
AlignmentVetoException - veto to the removal

setInsetQuietly

protected abstract void setInsetQuietly(int seqIndex,
                                        int inset)
Set the inset (or number of preceeding gaps) in a sequence, quietly without notifying listeners.

Parameters:
seqIndex - the sequence index
inset - the inset or preceeding number of gaps

setInset

public void setInset(int seqIndex,
                     int inset)
              throws AlignmentVetoException
Set the inset (or number of preceeding gaps) in a sequence.

Specified by:
setInset in interface SequenceAlignment
Parameters:
seqIndex - the sequence index
inset - the inset or preceeding number of gaps
AlignmentVetoException

fireAlignmentEvent

protected void fireAlignmentEvent(AlignmentEvent event)

fireVetoableAlignmentEvent

protected void fireVetoableAlignmentEvent(VetoableAlignmentEvent event)
                                   throws AlignmentVetoException
AlignmentVetoException

addAlignmentListener

public void addAlignmentListener(AlignmentListener listener)
Delegates to the AlignmentListenerSupport object, the addition of a Multiple Sequence (MS) listener.

Specified by:
addAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - a MS listener

removeAlignmentListener

public void removeAlignmentListener(AlignmentListener listener)
Delegates to the AlignmentListenerSupport the removal of the MS listener.

Specified by:
removeAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - the MS listener to be removed

addVetoableAlignmentListener

public void addVetoableAlignmentListener(VetoableAlignmentListener listener)
Delegates to the AlignmentListenerSupport the addition of a vetoable MS listener.

Specified by:
addVetoableAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - a vetoable MS listener to be added

removeVetoableAlignmentListener

public void removeVetoableAlignmentListener(VetoableAlignmentListener listener)
Delegates to the AlignmentListenerSupport the removal of the vetoable MS listener.

Specified by:
removeVetoableAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - the vetoable MS listener to be removed

addSequenceListener

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

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

addVetoableSequenceListener

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

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

removeSequenceListener

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

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

removeVetoableSequenceListener

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

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

vetoableChangeOccurred

public void vetoableChangeOccurred(VetoableSequenceEvent event)
                            throws SequenceVetoException
Description copied from interface: VetoableSequenceListener
Method signalled before a prospective change occurs

Specified by:
vetoableChangeOccurred in interface VetoableSequenceListener
Parameters:
event - the event
Throws:
SequenceVetoException - if the listener does not wish the event to occur.

changeOccurred

public void changeOccurred(SequenceEvent event)
Description copied from interface: SequenceListener
Method called when a change occurs

Specified by:
changeOccurred in interface SequenceListener
Parameters:
event -