BioLegato 0.7.3 GDE plugin

org.biolegato.gdesupport.canvas.data
Class Dataset

java.lang.Object
  extended by org.biolegato.gdesupport.canvas.data.Dataset
All Implemented Interfaces:
java.awt.datatransfer.Transferable, CellListener

public class Dataset
extends java.lang.Object
implements CellListener, java.awt.datatransfer.Transferable

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.

Author:
Graham Alvare, Brian Fristensky

Field Summary
static java.awt.datatransfer.DataFlavor seqDocFlavour
          A data flavour representing the Dataset data type.
 
Constructor Summary
Dataset()
          Creates a new instance of Dataset
Dataset(Cell[] row)
          Creates a new instance of Dataset using the existing sequence list
 
Method Summary
 void addListener(DatasetListener listener)
          Adds a listener object to the data container.
 boolean addRow(int y, Cell seq)
          Adds a sequence to the data container.
protected  void finalize()
          Finalizes the object - removes all references to itself
 Cell get(int y)
          Retrieves a sequence object from the Dataset specified by its line number.
 int getRowCount()
          Returns the number of lines in the document.
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavour)
          Translates the Dataset to the given format
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Dictates what formats the Dataset can be converted to.
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavour)
          Dictates whether a given format is supported for conversion
 void removeListener(DatasetListener listener)
          Adds a listener object to the data container.
 void removeRows(int[] lineNumbers)
          Removes an array of sequences from the data container.
 void sequenceChanged(Cell sequence, java.lang.String key)
          Called when a field in a sequence is modified.
 Cell[] toArray()
          Converts the Dataset into a sequence array representation
 java.lang.String toString()
          Converts the Dataset into a string representation
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

seqDocFlavour

public static final java.awt.datatransfer.DataFlavor seqDocFlavour
A data flavour representing the Dataset data type.

Constructor Detail

Dataset

public Dataset()
Creates a new instance of Dataset


Dataset

public Dataset(Cell[] row)
Creates a new instance of Dataset using the existing sequence list

Parameters:
sequenceList - the list of sequences to initialize the SDatasetwith.
Method Detail

addRow

public boolean addRow(int y,
                      Cell seq)
Adds a sequence to the data container. This function calls all listeners.

Parameters:
y - is the line number to insert the sequence.
seq - is the sequence to insert.
Returns:
true if the insertion was successful, otherwise false.

removeRows

public void removeRows(int[] lineNumbers)
Removes an array of sequences from the data container.

Parameters:
lineNumbers - the line numbers to remove.

get

public Cell get(int y)
Retrieves a sequence object from the Dataset specified by its line number.

Parameters:
y - the line number to retreive the sequence.
Returns:
the sequence.

addListener

public void addListener(DatasetListener listener)
Adds a listener object to the data container.

Parameters:
listener - the listener to add.

removeListener

public void removeListener(DatasetListener listener)
Adds a listener object to the data container.

Parameters:
listener - the listener to add.

sequenceChanged

public void sequenceChanged(Cell sequence,
                            java.lang.String key)
Called when a field in a sequence is modified.

Specified by:
sequenceChanged in interface CellListener
Parameters:
sequence - the sequence modified.
key - the key of the modified field in the sequence.

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Dictates what formats the Dataset can be converted to.

Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable
Returns:
an array of supported formats

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavour)
Dictates whether a given format is supported for conversion

Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable
Parameters:
flavour - the flavour to test for compatability
Returns:
true if the format is supported

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavour)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Translates the Dataset to the given format

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Parameters:
flavour - the data flavour to use for translation
Returns:
the translated object
Throws:
java.awt.datatransfer.UnsupportedFlavorException - if the SeqDatasetnnot be translated into the requested data flavour
java.io.IOException - if there is a problem with I/O during the translation

toString

public java.lang.String toString()
Converts the Dataset into a string representation

Overrides:
toString in class java.lang.Object
Returns:
the string representation of the sequence document

toArray

public Cell[] toArray()
Converts the Dataset into a sequence array representation

Returns:
the sequence array representation of the sequence document

finalize

protected void finalize()
Finalizes the object - removes all references to itself

Overrides:
finalize in class java.lang.Object

getRowCount

public int getRowCount()
Returns the number of lines in the document.

Returns:
the number of lines in the document.

BioLegato 0.7.3 GDE plugin

Copyright © 2008-2010 University of Manitoba.