jigcell.compare.data
Class TreeDataElement

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by jigcell.compare.impl.Transferer
          extended by jigcell.compare.data.DataElement
              extended by jigcell.compare.data.EditableDataElement
                  extended by jigcell.compare.data.TreeDataElement
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.io.Serializable, IDataElement, IEditableDataElement
Direct Known Subclasses:
PackedTreeDataElement, SparseTreeDataElement

public abstract class TreeDataElement
extends EditableDataElement

Base class for implementations of EditableDataElement that want to use some form of tree to store values. TreeDataElement does not protect against concurrent edits.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jigcell.compare.data.EditableDataElement
EditableDataElement.EditableDataElementDelegate
 
Nested classes/interfaces inherited from interface jigcell.compare.IDataElement
IDataElement.Type
 
Field Summary
protected  long length
          Element length
protected  java.util.SortedMap values
          Element values
 
Fields inherited from class jigcell.compare.data.EditableDataElement
DOUBLE_NaN, DOUBLE_NINFINITY, DOUBLE_PINFINITY, MESSAGE_PARSEBLOCKERROR, MESSAGE_PARSEERROR, MESSAGE_PARSEEXTRAERROR, MESSAGE_PARSELITERALERROR, PATTERN_FP, prototypeChild, TOKEN_ALL, TOKEN_BLOCKELEMENT, TOKEN_BLOCKEND, TOKEN_BLOCKSTART, TOKEN_LITERAL
 
Fields inherited from class jigcell.compare.data.DataElement
lockCount, LONGPOOL, PATTERN_FALSE, PATTERN_NAN, PATTERN_NINFINITY, PATTERN_NINFINITY2, PATTERN_NULL, PATTERN_PINFINITY, PATTERN_PINFINITY2, PATTERN_TRUE, PATTERN_VOID, SIZE_LONGPOOL
 
Fields inherited from class jigcell.compare.impl.Transferer
CSV_FOOTER, CSV_LINEPOSTPEND, CSV_LINEPREPEND, CSV_LINESEPARATOR, HTML_FOOTER, HTML_HEADPOSTPEND, HTML_HEADPREPEND, HTML_HEADSEPARATOR, HTML_LINEPOSTPEND, HTML_LINEPREPEND, HTML_LINESEPARATOR
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
TreeDataElement()
           
 
Method Summary
 void clear()
          Deletes all values in this element.
 long getLength()
          The number of elements in this element, or 0 if this element is scalar.
 java.util.SortedMap getValues()
          A sorted map of the values in this element.
 boolean isAvailable()
          Whether the element data can currently be worked with. Editing the internal state of a data generator while locked may cause subsequent calls to isAvailable to incorrectly report that the element data is available.
protected abstract  long lastValue()
          Finds the last defined value.
 void memoryLock()
          Forces the element to guarantee that the element data can currently be worked with. Implementations may or may not support reentrancy or other forms of multiple locking. Editing the internal state of a data generator while locked may cause subsequent calls to memoryLock to incorrectly terminate without guarantee that the element data can currently be worked with.
 void memoryUnlock()
          Releases the element from the guarantee that the element data can currently be worked with. Implementations may or may not support reentrancy or other forms of multiple locking.
protected  void setLengthDirect(long length)
          Sets the known length of an element.
 void setValue(IDataElement value)
          Sets the element to a list.
 void setValues(java.util.SortedMap values)
          Sets the map of values in this element.
 void unsetValue(long pos)
          Deletes an element value.
 
Methods inherited from class jigcell.compare.data.EditableDataElement
constructNew, copyValue, createElement, createElement, createElement, createElement, createElementSafe, createElementSafe, createElementSafe, createScalarElement, createScalarElement, createScalarElement, createScalarElement, forceSlice, forceSlice, forceSlice, forceSlice, getBooleanValue, getChecked, getDirect, getIntegralValue, getListValue, getLiteralValue, getPrototypeChild, getRealValue, getType, getType, makeList, moveValue, putChecked, putDirect, removeDirect, setPrototypeChild, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueInterpreted, setValueInterpreted, swapValues
 
Methods inherited from class jigcell.compare.data.DataElement
forceBooleanValue, forceBooleanValue, forceIntegralValue, forceIntegralValue, forceListValue, forceLiteralValue, forceLiteralValue, forceRealValue, forceRealValue, forceSlice, getBooleanValue, getIntegralValue, getLiteralValue, getLongObject, getRealValue, getSlice, getSlice, getSlice, getSlice, getSlice, getTransferData, isScalar, isSpecialNonNumeric, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString, toString
 
Methods inherited from class jigcell.compare.impl.Transferer
addExtension, addFlavor, createCSVTable, createFormattedTable, createHTMLTable, getExceptionRecorder, getExpectedClasses, getExpectedClasses, getExpectedClasses, getFlavors, getFlavors, getPreferredExtensions, getPreferredExtensions, getTransferClass, getTransferDataFlavors, getTransferFlavor, isDataFlavorSupported, transfer
 
Methods inherited from class javax.swing.TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getSourceActions, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jigcell.compare.IDataElement
forceBooleanValue, forceBooleanValue, forceIntegralValue, forceIntegralValue, forceListValue, forceLiteralValue, forceLiteralValue, forceRealValue, forceRealValue, forceSlice, getBooleanValue, getIntegralValue, getLiteralValue, getRealValue, getSlice, getSlice, getSlice, getSlice, getSlice, isScalar, toString, toString, toString, toString, toString, toString, toString
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

length

protected long length
Element length


values

protected java.util.SortedMap values
Element values

Constructor Detail

TreeDataElement

public TreeDataElement()
Method Detail

clear

public void clear()
Deletes all values in this element.


getLength

public long getLength()
The number of elements in this element, or 0 if this element is scalar.

Specified by:
getLength in interface IDataElement
Overrides:
getLength in class DataElement

getValues

public java.util.SortedMap getValues()
A sorted map of the values in this element.


isAvailable

public boolean isAvailable()
Whether the element data can currently be worked with. Editing the internal state of a data generator while locked may cause subsequent calls to isAvailable to incorrectly report that the element data is available.

Specified by:
isAvailable in interface IDataElement
Overrides:
isAvailable in class DataElement

memoryLock

public void memoryLock()
Forces the element to guarantee that the element data can currently be worked with. Implementations may or may not support reentrancy or other forms of multiple locking. Editing the internal state of a data generator while locked may cause subsequent calls to memoryLock to incorrectly terminate without guarantee that the element data can currently be worked with.

Specified by:
memoryLock in interface IDataElement
Overrides:
memoryLock in class DataElement

memoryUnlock

public void memoryUnlock()
Releases the element from the guarantee that the element data can currently be worked with. Implementations may or may not support reentrancy or other forms of multiple locking.

Specified by:
memoryUnlock in interface IDataElement
Overrides:
memoryUnlock in class DataElement

setValue

public void setValue(IDataElement value)
Sets the element to a list.

Specified by:
setValue in interface IEditableDataElement
Overrides:
setValue in class EditableDataElement
Parameters:
value - Value

setValues

public void setValues(java.util.SortedMap values)
Sets the map of values in this element.

Parameters:
values - Value map

unsetValue

public void unsetValue(long pos)
Deletes an element value.

Specified by:
unsetValue in interface IEditableDataElement
Overrides:
unsetValue in class EditableDataElement
Parameters:
pos - Value position

lastValue

protected abstract long lastValue()
Finds the last defined value.


setLengthDirect

protected void setLengthDirect(long length)
Sets the known length of an element. The length of the object may be anything.

Specified by:
setLengthDirect in class EditableDataElement
Parameters:
length - Length of element