jigcell.compare
Interface IDataElement

All Superinterfaces:
java.io.Serializable, java.awt.datatransfer.Transferable
All Known Subinterfaces:
IEditableDataElement
All Known Implementing Classes:
CachedDataElement, DataElement, EditableDataElement, FlippedDataElement, PackedDoubleDataElement, PackedTreeDataElement, PackedTreeDataElement2, SparseTreeDataElement, SparseTreeDataElement2, TreeDataElement

public interface IDataElement
extends java.io.Serializable, java.awt.datatransfer.Transferable

This interface is implemented by classes that wish to provide a data element to the comparator. An element can either be a list of one or more elements or a scalar. When viewed as a list, a scalar element has value only at the 0th list position; a list element of n elements has values at the 1st through nth list positions.

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

Author:
Nicholas Allen

Nested Class Summary
static class IDataElement.Type
          The types of a data element.
 
Method Summary
 boolean forceBooleanValue()
          This element represented as a boolean when evaluated in a scalar context.
 boolean forceBooleanValue(long pos)
          The element at position pos represented as a boolean.
 long forceIntegralValue()
          This element represented as an integer when evaluated in a scalar context.
 long forceIntegralValue(long pos)
          The element at position pos represented as an integer.
 IDataElement forceListValue(long pos)
          This element at position pos represented as a list.
 java.lang.String forceLiteralValue()
          This element represented as a string literal when evaluated in a scalar context.
 java.lang.String forceLiteralValue(long pos)
          The element at position pos represented as a string literal.
 double forceRealValue()
          This element represented as a real when evaluated in a scalar context.
 double forceRealValue(long pos)
          The element at position pos represented as a real.
 boolean[] forceSlice(boolean[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a boolean list.
 double[] forceSlice(double[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a real list.
 IDataElement[] forceSlice(IDataElement[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a list of elements.
 long[] forceSlice(long[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as an integral list.
 java.lang.String[] forceSlice(java.lang.String[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a string literal list.
 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.
 boolean[] getSlice(boolean[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a boolean list.
 double[] getSlice(double[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a real list.
 IDataElement[] getSlice(IDataElement[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a list of elements.
 long[] getSlice(long[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as an integral list.
 java.lang.String[] getSlice(java.lang.String[] slice, long start, int length, long stride)
          A dense, homogeneous subset of this element represented as a string literal list.
 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.
 boolean isScalar()
          Whether this element is scalar.
 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.
 java.lang.String toString(boolean limit, int size)
          Renders the DataElement as an ordered tuple.
 java.lang.String toString(boolean limit, int size, long pos)
          Renders the value of a specified position.
 java.lang.String toString(boolean limit, int size, long pos, java.text.NumberFormat format)
          Renders the value of a specified position with a particular format.
 java.lang.String toString(boolean limit, int size, java.text.NumberFormat format)
          Renders the DataElement as an ordered tuple with a particular format.
 java.lang.String toString(long pos)
          Renders the value of a specified position.
 java.lang.String toString(long pos, java.text.NumberFormat format)
          Renders the value of a specified position with a particular format.
 java.lang.String toString(java.text.NumberFormat format)
          Renders the value with a particular format.
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
 

Method Detail

forceBooleanValue

boolean forceBooleanValue()
This element represented as a boolean when evaluated in a scalar context. If this element is not a boolean it is suitably coerced.


forceBooleanValue

boolean forceBooleanValue(long pos)
The element at position pos represented as a boolean. If the given position is not a boolean it is suitably coerced.

Parameters:
pos - Position

forceIntegralValue

long forceIntegralValue()
This element represented as an integer when evaluated in a scalar context. If this element is not an integer it is suitably coerced.


forceIntegralValue

long forceIntegralValue(long pos)
The element at position pos represented as an integer. If the given position is not an integer it is suitably coerced.

Parameters:
pos - Position

forceListValue

IDataElement forceListValue(long pos)
This element at position pos represented as a list. If the given position is not a list it is suitably coerced.

Parameters:
pos - Position

forceLiteralValue

java.lang.String forceLiteralValue()
This element represented as a string literal when evaluated in a scalar context. If this element is not a string literal it is suitably coerced.


forceLiteralValue

java.lang.String forceLiteralValue(long pos)
The element at position pos represented as a string literal. If the given position is not a string literal it is suitably coerced.

Parameters:
pos - Position

forceRealValue

double forceRealValue()
This element represented as a real when evaluated in a scalar context. If this element is not a real it is suitably coerced.


forceRealValue

double forceRealValue(long pos)
The element at position pos represented as a real. If the given position is not a real it is suitably coerced.

Parameters:
pos - Position

forceSlice

boolean[] forceSlice(boolean[] slice,
                     long start,
                     int length,
                     long stride)
A dense, homogeneous subset of this element represented as a boolean list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given length has no valid meaning, the value is null. Elements not of type boolean are suitably coerced. Past the defined range of the list, all values are considered false. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

forceSlice

IDataElement[] forceSlice(IDataElement[] slice,
                          long start,
                          int length,
                          long stride)
A dense, homogeneous subset of this element represented as a list of elements. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given length has no valid meaning, the value is null. Elements not of type list are suitably coerced. Past the defined range of the list, all values are considered scalars of no type. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

forceSlice

double[] forceSlice(double[] slice,
                    long start,
                    int length,
                    long stride)
A dense, homogeneous subset of this element represented as a real list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given length has no valid meaning, the value is null. Elements not of type real are suitably coerced. Past the defined range of the list, all values are considered NaN. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

forceSlice

long[] forceSlice(long[] slice,
                  long start,
                  int length,
                  long stride)
A dense, homogeneous subset of this element represented as an integral list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given length has no valid meaning, the value is null. Elements not of type integral are suitably coerced. Past the defined range of the list, all values are considered 0. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

forceSlice

java.lang.String[] forceSlice(java.lang.String[] slice,
                              long start,
                              int length,
                              long stride)
A dense, homogeneous subset of this element represented as a string literal list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given length has no valid meaning, the value is null. Elements not of type string literal are suitably coerced. Past the defined range of the list, all values are considered null. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

getBooleanValue

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


getBooleanValue

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.

Parameters:
pos - Position

getIntegralValue

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


getIntegralValue

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.

Parameters:
pos - Position

getLength

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


getListValue

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.

Parameters:
pos - Position

getLiteralValue

java.lang.String getLiteralValue()
This element represented as a string literal when evaluated in a scalar context. The literal is not quoted.


getLiteralValue

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. The literal is not quoted.

Parameters:
pos - Position

getRealValue

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


getRealValue

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 NaN.

Parameters:
pos - Position

getSlice

boolean[] getSlice(boolean[] slice,
                   long start,
                   int length,
                   long stride)
A dense, homogeneous subset of this element represented as a boolean list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given start or length has no valid meaning for this element, the value is null. If the subset is not a dense list of booleans or slices are not available, the value is null. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

getSlice

IDataElement[] getSlice(IDataElement[] slice,
                        long start,
                        int length,
                        long stride)
A dense, homogeneous subset of this element represented as a list of elements. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given start or length has no valid meaning for this element, the value is null. If the subset is not a dense list of lists or slices are not available, the value is null. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

getSlice

double[] getSlice(double[] slice,
                  long start,
                  int length,
                  long stride)
A dense, homogeneous subset of this element represented as a real list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given start or length has no valid meaning for this element, the value is null. If the subset is not a dense list of reals or slices are not available, the value is null. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

getSlice

long[] getSlice(long[] slice,
                long start,
                int length,
                long stride)
A dense, homogeneous subset of this element represented as an integral list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given start or length has no valid meaning for this element, the value is null. If the subset is not a dense list of integers or slices are not available, the value is null. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

getSlice

java.lang.String[] getSlice(java.lang.String[] slice,
                            long start,
                            int length,
                            long stride)
A dense, homogeneous subset of this element represented as a string literal list. If slice cannot hold the requested range, a new array is created and returned. Slice may be null. If the given start or length has no valid meaning for this element, the value is null. If the subset is not a dense list of string literals or slices are not available, the value is null. Position 0 in the returned slice corresponds to position start in the original element.

Parameters:
slice - Suggested container for the slice
start - First position to pull
length - Number of positions to pull
stride - Interval between positions to pull

getType

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


getType

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.

Parameters:
pos - Position

isAvailable

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.


isScalar

boolean isScalar()
Whether this element is scalar.


memoryLock

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.


memoryUnlock

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.


toString

java.lang.String toString(java.text.NumberFormat format)
Renders the value with a particular format.

Parameters:
format - Format

toString

java.lang.String toString(long pos)
Renders the value of a specified position.

Parameters:
pos - Render position

toString

java.lang.String toString(boolean limit,
                          int size)
Renders the DataElement as an ordered tuple.

Parameters:
limit - Whether to abbreviate the string.
size - Approximate length before abbreviation occurs.

toString

java.lang.String toString(long pos,
                          java.text.NumberFormat format)
Renders the value of a specified position with a particular format.

Parameters:
pos - Render position
format - Format

toString

java.lang.String toString(boolean limit,
                          int size,
                          java.text.NumberFormat format)
Renders the DataElement as an ordered tuple with a particular format.

Parameters:
limit - Whether to abbreviate the string.
size - Approximate length before abbreviation occurs.
format - Format

toString

java.lang.String toString(boolean limit,
                          int size,
                          long pos)
Renders the value of a specified position.

Parameters:
limit - Whether to abbreviate the string.
size - Approximate length before abbreviation occurs.
pos - Render position

toString

java.lang.String toString(boolean limit,
                          int size,
                          long pos,
                          java.text.NumberFormat format)
Renders the value of a specified position with a particular format.

Parameters:
limit - Whether to abbreviate the string.
size - Approximate length before abbreviation occurs.
pos - Render position
format - Format