BioLegato 0.5.7

org.biolegato.core.data.seqdoc
Class SeqWrap

java.lang.Object
  extended by org.biolegato.core.data.seqdoc.SeqWrap
All Implemented Interfaces:
SequenceListener

public class SeqWrap
extends java.lang.Object
implements SequenceListener

Used to wrap sequences; this object is used to give sequences start offsets, so they may be ordered within a SeqDoc structure.

Author:
Graham Alvare, Brian Fristensky

Constructor Summary
SeqWrap(int offset, Sequence seq)
          Creates a new instance of SeqWrap.
 
Method Summary
 void addListener(SequenceListener listener)
          Adds a listener to the wrapped sequence.
 boolean equals(java.lang.Object test)
          Tests equality of the inner sequence.
protected  void finalize()
          Removes the sequence wrapper as a sequence listener.
 java.lang.Object getField(java.lang.String key)
          Returns the content of a field within the wrapped sequence.
 Sequence getSequence()
          Retrieves the wrapped sequence object.
 int getStart()
          Retrieves the start offset for the sequence wrapper object.
 void sequenceChanged(Sequence sequence, java.lang.String key)
          Handles changes to the inner sequence.
 void setField(java.lang.String key, java.lang.Object value)
          Alters the content of a field within the wrapped sequence.
 void setStart(int offset)
          Changes the start offset of the sequence.
 Sequence subseq(int start)
          Extracts a portion of the wrapper's sequence.
 Sequence subseq(int start, int end)
          Extracts a portion of the wrapper's sequence.
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeqWrap

public SeqWrap(int offset,
               Sequence seq)
Creates a new instance of SeqWrap.

Parameters:
offset - the start offset of the sequence wrapper.
seq - the sequence to wrap.
Method Detail

getStart

public int getStart()
Retrieves the start offset for the sequence wrapper object.

Returns:
the start offset of the sequence wrapper object.

getField

public java.lang.Object getField(java.lang.String key)
Returns the content of a field within the wrapped sequence.

Parameters:
key - the key of the field to retrieve.
Returns:
the current value of the field.

setField

public void setField(java.lang.String key,
                     java.lang.Object value)
Alters the content of a field within the wrapped sequence.

Parameters:
key - the key of the field to alter.
value - the new value of the field.

subseq

public Sequence subseq(int start)
Extracts a portion of the wrapper's sequence.

Parameters:
start - the position to start the extraction.
Returns:
the extracted sequence.

subseq

public Sequence subseq(int start,
                       int end)
Extracts a portion of the wrapper's sequence.

Parameters:
start - the position to start the extraction.
end - the position to end the extraction.
Returns:
the extracted sequence.

setStart

public void setStart(int offset)
Changes the start offset of the sequence.

Parameters:
offset - the new start offset of the sequence.

getSequence

public Sequence getSequence()
Retrieves the wrapped sequence object.

Returns:
the sequence object.

addListener

public void addListener(SequenceListener listener)
Adds a listener to the wrapped sequence.

Parameters:
listener - the listener to add.

sequenceChanged

public void sequenceChanged(Sequence sequence,
                            java.lang.String key)
Handles changes to the inner sequence.

Specified by:
sequenceChanged in interface SequenceListener
Parameters:
sequence - the sequence modified.
key - the key modified.

finalize

protected void finalize()
Removes the sequence wrapper as a sequence listener.

Overrides:
finalize in class java.lang.Object

equals

public boolean equals(java.lang.Object test)
Tests equality of the inner sequence. NOTE: The two objects are equal if
1. "test" is a sequence wrapper then if the wrapped sequences are equal 2. "test" is equal to the wrapped sequence (sequence.equals method)

Overrides:
equals in class java.lang.Object
Parameters:
test - the object to test for equality.

BioLegato 0.5.7

Copyright © 2008-2009 University of Manitoba.