|
BioLegato 0.7.0 Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biolegato.core.data.seqdoc.SeqDoc
public class SeqDoc
The internal document format for BioLegato.
This document is structured as a linked list of sequences. Each character has an offset based on its position within the list and it's position within its containing sequence. Sequences start at 0 (first character in the first sequence in the list, and end with the last character in the last sequence within the list.
| Field Summary | |
|---|---|
static java.awt.datatransfer.DataFlavor |
seqDocFlavour
A data flavour representing the SeqDoc data type. |
| Constructor Summary | |
|---|---|
SeqDoc()
Creates a new instance of SeqDoc |
|
SeqDoc(Sequence[] sequenceList)
Creates a new instance of SeqDoc using the existing sequence list |
|
| Method Summary | |
|---|---|
void |
addListener(SeqDocListener listener)
Adds a listener object to the data container. |
boolean |
addSequence(int y,
Sequence seq)
Adds a sequence to the data container. |
boolean |
delete(int x,
int y,
int w)
Removes text from the document. |
boolean |
delete(int x,
int y,
int w,
int h)
Removes text from the document. |
protected void |
finalize()
Finalizes the object - removes all references to itself |
Sequence |
getLine(int y)
Retrieves a sequence object from the SeqDoc specified by its line number. |
int |
getLineCount()
Returns the number of lines in the document. |
int |
getLineLength(int y)
Retrieves the length of a line in the document. |
int |
getLongestLine()
Returns the length of the longest line in the data container |
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavour)
Translates the SeqDoc to the given format |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
Dictates what formats the SeqDoc can be converted to. |
int |
indexOf(Sequence seq)
Retrieves the line number for a sequence object in the SeqDoc. |
boolean |
insert(int x,
int y,
Sequence[] sequences)
Inserts sequences at a specific offset in the document. |
boolean |
insert(int x,
int y,
java.lang.String string)
Inserts a string into the document on a given line. |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavour)
Dictates whether a given format is supported for conversion |
boolean |
removeSequence(int lineNumber)
Removes a sequences from the data container. |
void |
removeSequences(int[] lineNumbers)
Removes an array of sequences from the data container. |
void |
sequenceChanged(Sequence sequence,
java.lang.String key)
Called when a field in a sequence is modified. |
Sequence[] |
toArray()
Converts the SeqDoc into a sequence array representation |
java.lang.String |
toString()
Converts the SeqDoc into a string representation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.awt.datatransfer.DataFlavor seqDocFlavour
| Constructor Detail |
|---|
public SeqDoc()
public SeqDoc(Sequence[] sequenceList)
sequenceList - the list of sequences to initialize the SeqDoc with.| Method Detail |
|---|
public boolean insert(int x,
int y,
java.lang.String string)
x - the offset in the document to insert the text.y - the line number to insert the string.string - the text to insert.
public boolean insert(int x,
int y,
Sequence[] sequences)
The first sequence is always merged with the sequence located at offset, unless the offset
points to the end of the sequence. The same applies to the last sequence.
Example:
insertion X offset: 4
insertion Y offset: 0
Document: ggggtttt
Sequence[0]: aaaa
....
Sequence[last]: cccc
Result: ggggaaaa
....
cccctttt
x - the X co-ordinate offset in the document to insert the sequences.y - the Y co-ordinate offset in the document to insert the sequences.sequences - the array of sequences to insert.
public boolean delete(int x,
int y,
int w)
This method will delete line endings and sequences as well as individual characters from the document.
NOTE: ALL DELETIONS ARE PERFORMED AS FOLLOWS:
x - the X-offset/column number to start the deletion from.y - the Y-offset/line number to delete characters from.w - the width of the deletion (measured in characters along the X-axis).
public boolean delete(int x,
int y,
int w,
int h)
This method will delete line endings and sequences as well as individual characters from the document.
NOTE: ALL DELETIONS ARE PERFORMED AS FOLLOWS:
x - the X-offset/column number to start the deletion from.y - the Y-offset/line number to delete characters from.w - the width of the deletion (measured in characters along the X-axis).h - the height of the deletion (measured in sequences along the Y-axis).
public boolean addSequence(int y,
Sequence seq)
y - is the line number to insert the sequence.seq - is the sequence to insert.
public boolean removeSequence(int lineNumber)
lineNumber - the line number of the sequence to remove.
public void removeSequences(int[] lineNumbers)
lineNumbers - the line numbers to remove.public Sequence getLine(int y)
y - the line number to retreive the sequence.
public int getLineLength(int y)
y - the line number to find the length of.
public int getLineCount()
public int getLongestLine()
public int indexOf(Sequence seq)
seq - the sequence to search for.
public void addListener(SeqDocListener listener)
listener - the listener to add.
public void sequenceChanged(Sequence sequence,
java.lang.String key)
sequenceChanged in interface SequenceListenersequence - the sequence modified.key - the key of the modified field in the sequence.public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors in interface java.awt.datatransfer.Transferablepublic boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavour)
isDataFlavorSupported in interface java.awt.datatransfer.Transferableflavour - the flavour to test for compatability
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavour)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
getTransferData in interface java.awt.datatransfer.Transferableflavour - the data flavour to use for translation
java.awt.datatransfer.UnsupportedFlavorException - if the SeqDoc cannot be translated into the requested data flavour
java.io.IOException - if there is a problem with I/O during the translationpublic java.lang.String toString()
toString in class java.lang.Objectpublic Sequence[] toArray()
protected void finalize()
finalize in class java.lang.Object
|
BioLegato 0.7.0 Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||