jigcell.compare.data
Class FlippedDataElement

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.FlippedDataElement
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.io.Serializable, IDataElement

public class FlippedDataElement
extends DataElement

An implementation of DataElement that acts as the transpose of another DataElement. A FlippedDataElement is unsynchronized.

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 interface jigcell.compare.IDataElement
IDataElement.Type
 
Field Summary
protected  IEditableDataElement element
          Untied element
protected  long index
          Index within the flip to access
protected static java.lang.String MESSAGE_UNTIEERROR
          Error message when an element cannot be untied
protected  IDataElement tie
          Original element
 
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
  FlippedDataElement(IDataElement element)
          Creates a new flipped data element from an existing data element.
  FlippedDataElement(IDataElement element, boolean tied)
          Creates a new flipped data element from an existing data element.
protected FlippedDataElement(IDataElement element, boolean tied, long index)
          Creates a new flipped data element from an existing data element.
 
Method Summary
static IDataElement flip(IDataElement element)
          Produces a DataElement that acts as the transpose of another DataElement.
static IDataElement flip(IDataElement element, boolean tied)
          Produces a DataElement that acts as the transpose of another DataElement.
 boolean getBooleanValue()
          This element represented as a boolean when evaluated in a scalar context.
 boolean getBooleanValue(long pos)
          The element at position pos represented as a boolean.
 long getIntegralValue()
          This element represented as an integer when evaluated in a scalar context.
 long getIntegralValue(long pos)
          The element at position pos represented as an integer.
 long getLength()
          The number of elements in this element, or 0 if this element is scalar.
 IDataElement getListValue(long pos)
          This element at position pos represented as a list.
 java.lang.String getLiteralValue()
          This element represented as a string literal when evaluated in a scalar context.
 java.lang.String getLiteralValue(long pos)
          The element at position pos represented as a string literal.
 double getRealValue()
          This element represented as a real when evaluated in a scalar context.
 double getRealValue(long pos)
          The element at position pos represented as a real.
 IDataElement getTiedElement()
          The tied data element if this element is tied or null otherwise.
 IDataElement.Type getType()
          The type of this element.
 IDataElement.Type getType(long pos)
          The type of the element at position pos.
 boolean isAvailable()
          Whether the element data can currently be worked with.
 void memoryLock()
          Forces the element to 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.
 void untie()
          Converts a FlippedDataElement to an untied FlippedDataElement or throws an exception if not possible.
 
Methods inherited from class jigcell.compare.data.DataElement
forceBooleanValue, forceBooleanValue, forceIntegralValue, forceIntegralValue, forceListValue, forceLiteralValue, forceLiteralValue, forceRealValue, forceRealValue, forceSlice, forceSlice, forceSlice, forceSlice, forceSlice, getLongObject, 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 java.awt.datatransfer.Transferable
getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

MESSAGE_UNTIEERROR

protected static final java.lang.String MESSAGE_UNTIEERROR
Error message when an element cannot be untied

See Also:
Constant Field Values

tie

protected IDataElement tie
Original element


element

protected IEditableDataElement element
Untied element


index

protected long index
Index within the flip to access

Constructor Detail

FlippedDataElement

public FlippedDataElement(IDataElement element)
Creates a new flipped data element from an existing data element.

Parameters:
element - Data element

FlippedDataElement

public FlippedDataElement(IDataElement element,
                          boolean tied)
Creates a new flipped data element from an existing data element.

Parameters:
element - Data element
tied - Whether the flipped element should reflect changes in the original data element

FlippedDataElement

protected FlippedDataElement(IDataElement element,
                             boolean tied,
                             long index)
Creates a new flipped data element from an existing data element.

Parameters:
element - Data element
tied - Whether the flipped element should reflect changes in the original data element
index - Index into the original data element
Method Detail

flip

public static IDataElement flip(IDataElement element)
Produces a DataElement that acts as the transpose of another DataElement. The transposed element will be tied to the original element.

Parameters:
element - DataElement to flip

flip

public static IDataElement flip(IDataElement element,
                                boolean tied)
Produces a DataElement that acts as the transpose of another DataElement. If the flipped element is tied to original element, changes made to the original element will be reflected in the flipped element. An untied element requires a complete copy of the original element's data.

Parameters:
element - DataElement to flip
tied - Whether updates to element should be propogated

getBooleanValue

public boolean getBooleanValue()
This element represented as a boolean when evaluated in a scalar context.

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

getBooleanValue

public boolean getBooleanValue(long pos)
The element at position pos represented as a boolean. If the given position has no valid meaning for this element, the value is false.

Specified by:
getBooleanValue in interface IDataElement
Overrides:
getBooleanValue in class DataElement
Parameters:
pos - Position

getIntegralValue

public long getIntegralValue()
This element represented as an integer when evaluated in a scalar context.

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

getIntegralValue

public long getIntegralValue(long pos)
The element at position pos represented as an integer. If the given position has no valid meaning for this element, the value is 0.

Specified by:
getIntegralValue in interface IDataElement
Overrides:
getIntegralValue in class DataElement
Parameters:
pos - Position

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

getListValue

public IDataElement getListValue(long pos)
This element at position pos represented as a list. If the given position has no valid meaning for this element, the value is null.

Specified by:
getListValue in interface IDataElement
Overrides:
getListValue in class DataElement
Parameters:
pos - Position

getLiteralValue

public java.lang.String getLiteralValue()
This element represented as a string literal when evaluated in a scalar context.

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

getLiteralValue

public java.lang.String getLiteralValue(long pos)
The element at position pos represented as a string literal. If the given position has no valid meaning for this element, the value is null.

Specified by:
getLiteralValue in interface IDataElement
Overrides:
getLiteralValue in class DataElement
Parameters:
pos - Position

getRealValue

public double getRealValue()
This element represented as a real when evaluated in a scalar context.

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

getRealValue

public double getRealValue(long pos)
The element at position pos represented as a real. If the given position has no valid meaning for this element, the value is 0.0.

Specified by:
getRealValue in interface IDataElement
Overrides:
getRealValue in class DataElement
Parameters:
pos - Position

getTiedElement

public IDataElement getTiedElement()
The tied data element if this element is tied or null otherwise.


getType

public IDataElement.Type getType()
The type of this element.

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

getType

public IDataElement.Type getType(long pos)
The type of the element at position pos. If the given position has no valid meaning for this object, the type is TYPE_NONE.

Specified by:
getType in interface IDataElement
Overrides:
getType in class DataElement
Parameters:
pos - Position

isAvailable

public boolean isAvailable()
Whether the element data can currently be worked with.

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

untie

public void untie()
Converts a FlippedDataElement to an untied FlippedDataElement or throws an exception if not possible.