|
BioLegato 0.5.6 | |||||||||
| 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 | |
|---|---|
protected java.util.Stack<Undoable> |
redoStack
The stack of redoable events |
protected java.util.Stack<Undoable> |
undoStack
The stack of undoable events. |
| Constructor Summary | |
|---|---|
SeqDoc()
Creates a new instance of SeqDoc |
|
| Method Summary | |
|---|---|
void |
addListener(SeqDocListener listener)
Adds a listener object to the data container. |
void |
addSequence(int lineNumber,
Sequence seq)
Adds a sequence to the document. |
void |
addSequence(Sequence seq)
Adds a sequence to the end of the data container. |
void |
addSequences(int lineNumber,
Sequence[] sequenceList)
Adds an array of sequences to a data container at position "lineNumber". |
void |
addSequences(Sequence[] sequenceList)
Adds an array of sequences to the end of the data container. |
boolean |
delete(int offset,
int length)
Removes text from the document. |
boolean |
delete(int lineNumber,
int offset,
int length)
Removes text from the document. |
int |
getLength()
Returns the length of the data container's content. |
java.lang.String |
getLine(int lineNumber)
Retrieves a given line of text from the document. |
int |
getLineCount()
Returns the number of lines in the document. |
int |
getLineEndOffset(int lineNumber)
Retrieves the end offset of the given line. |
int |
getLineLength(int lineNumber)
Retrieves the length of a line in the document. |
int |
getLineNumber(int offset)
Obtains the line number for a given offset. |
int |
getLineStartOffset(int lineNumber)
Retrieves the start offset of a line. |
int |
getLongestLineLength()
Returns the length of the longest line in the data container |
Sequence |
getSequence(int lineNumber)
Retrieves a sequence object from the SeqDoc specified by its line number. |
Sequence[] |
getSequences(int[] lineNumbers)
Calls getSequence multiple times for multiple line numbers. |
java.lang.String |
getText(int offset,
int length)
Retrieves a body of text from the data container. |
boolean |
insert(int lineNumber,
int offset,
java.lang.String string)
Inserts a string into the document on a given line. |
boolean |
insert(int offset,
Sequence[] sequences)
Inserts sequences at a specific offset in the document. |
boolean |
redo()
Performs an redo operation to the data container. |
void |
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. |
boolean |
undo()
Performs an undo operation to the data container. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Stack<Undoable> undoStack
Every time an event occurs within the SeqDoc that is undoable, an undo object is created and added to this stack. This allows one to undo performed SeqDoc actions. To undo an action, pop the top object off of the stack and call its undo method. This will perform the undo and the undo method will return a redo object. The resulting redo object can then be added to the redoStack stack.
org.biolegato.core.data.undo.Undoableprotected java.util.Stack<Undoable> redoStack
Every time an event is undone, a redo object is created and added to this stack. A redo object is essentially an undo object created to "undo an undo". To perform a redo, pop the top object off the stact and call its undo method. This will perform the redo and the undo method will return an undo object. The resulting undo object can then be added to the undoStack stack.
org.biolegato.core.data.undo.Undoable| Constructor Detail |
|---|
public SeqDoc()
| Method Detail |
|---|
public boolean insert(int lineNumber,
int offset,
java.lang.String string)
lineNumber - the line number to insert the string.offset - the offset in the document to insert the text.string - the text to insert.
public boolean insert(int offset,
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:
Sequence[0]: aaaa
....
Sequence[last]: cccc
Document: ggggtttt
offset: 4
Result: ggggaaaa
....
cccctttt
offset - the offset in the document to insert the sequences.sequences - the array of sequences to insert.
public boolean delete(int offset,
int length)
This method will delete line endings and sequences as well as individual characters from the document. The offset and length parameters are both character based (not line based).
offset - the offset to start the deletion from.length - the number of characters to delete.
public boolean delete(int lineNumber,
int offset,
int length)
This method will delete line endings and sequences as well as individual characters from the document.
lineNumber - the line number to delete characters from.offset - the offset to start the deletion from.length - the number of characters to delete.
public void addSequences(int lineNumber,
Sequence[] sequenceList)
lineNumber - the line number to insert the sequence.sequenceList - the array of sequences to add to the data container.public void removeSequences(int[] lineNumbers)
lineNumbers - the line numbers to remove.public void addSequence(Sequence seq)
seq - the sequence to add to the data container.
public void addSequence(int lineNumber,
Sequence seq)
lineNumber - the line number to insert the sequence.seq - the sequence to add to the document.public void addSequences(Sequence[] sequenceList)
sequenceList - the array of sequences to add to the data container.public void removeSequence(int lineNumber)
lineNumber - the line number of the sequence to remove.public boolean undo()
public boolean redo()
public int getLength()
public int getLineNumber(int offset)
offset - the offset to get the line number for (in characters).
public int getLineCount()
public java.lang.String getLine(int lineNumber)
lineNumber - the line number to retrieve.
public int getLineStartOffset(int lineNumber)
lineNumber - the line number to obtain the start offset for.
public int getLineEndOffset(int lineNumber)
lineNumber - the line number to obtain the end offset for.
public int getLineLength(int lineNumber)
lineNumber - the line number to find the length of.
public java.lang.String getText(int offset,
int length)
offset - the offset to start retrieving from (in characters).length - the length of text to retrieve (in characters).
public Sequence getSequence(int lineNumber)
lineNumber - the line number to retreive the sequence.
public Sequence[] getSequences(int[] lineNumbers)
lineNumbers - the line numbers to send to get sequence.
public void addListener(SeqDocListener listener)
listener - the listener to add.public int getLongestLineLength()
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.
|
BioLegato 0.5.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||