|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.TransferHandler
jigcell.compare.impl.Transferer
jigcell.compare.data.DataElement
jigcell.compare.data.EditableDataElement
public abstract class EditableDataElement
A helper implementation for editable data element classes. Handles the parsing of a text representation of an element and provides a default implementation for nearly every method required by IEditableDataElement. EditableDataElement is not synchronized and in particular does not protect against concurrent edits.
This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.
| Nested Class Summary | |
|---|---|
protected static class |
EditableDataElement.EditableDataElementDelegate
Persists the element using a flat string rather than trying to save the values table. |
| Nested classes/interfaces inherited from interface jigcell.compare.IDataElement |
|---|
IDataElement.Type |
| Field Summary | |
|---|---|
protected static java.lang.Double |
DOUBLE_NaN
NaN |
protected static java.lang.Double |
DOUBLE_NINFINITY
-Infinity |
protected static java.lang.Double |
DOUBLE_PINFINITY
+Infinity |
protected static java.lang.String |
MESSAGE_PARSEBLOCKERROR
Message when unable to parse element text due to bad block nesting |
protected static java.lang.String |
MESSAGE_PARSEERROR
Message when unable to parse element text |
protected static java.lang.String |
MESSAGE_PARSEEXTRAERROR
Message when unable to parse element text due to too much input |
protected static java.lang.String |
MESSAGE_PARSELITERALERROR
Message when unable to parse element text due to unterminated literal |
protected static char |
PATTERN_FP
Pattern indicating value is floating point |
protected EditableDataElement |
prototypeChild
Prototypical instance of a subelement |
protected static java.lang.String |
TOKEN_ALL
All of the tokens used by the parser |
protected static java.lang.String |
TOKEN_BLOCKELEMENT
Token to separate block elements |
protected static java.lang.String |
TOKEN_BLOCKEND
Token to end a block |
protected static java.lang.String |
TOKEN_BLOCKSTART
Token to start a block |
protected static java.lang.String |
TOKEN_LITERAL
Token to delimit a 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 | |
|---|---|
EditableDataElement()
|
|
| Method Summary | |
|---|---|
protected abstract EditableDataElement |
constructNew()
Constructs a new element of the same type as this element. |
void |
copyValue(long pos1,
long pos2)
Copies a value within the element. |
static EditableDataElement |
createElement(EditableDataElement element,
java.io.Reader reader)
Generates the map for an element from a streaming input. |
private static EditableDataElement |
createElement(EditableDataElement element,
StreamingStringTokenizer tokenizer,
long pos)
Generates the map for an element from a text string. |
static IEditableDataElement |
createElement(IDataElement element)
Generates an element from an existing DataElement. |
static IEditableDataElement |
createElement(java.io.Reader reader)
Generates an element from streaming input. |
static IEditableDataElement |
createElement(java.lang.String text)
Generates an element from a text string. |
static IEditableDataElement |
createElementSafe(IDataElement element)
Generates an element from an existing DataElement. |
static IEditableDataElement |
createElementSafe(java.io.Reader reader)
Generates an element from streaming input. |
static IEditableDataElement |
createElementSafe(java.lang.String text)
Generates an element from a text string. |
static IEditableDataElement |
createScalarElement(boolean value)
Generates an element from a boolean. |
static IEditableDataElement |
createScalarElement(double value)
Generates an element from a double. |
static IEditableDataElement |
createScalarElement(long value)
Generates an element from a long. |
static IEditableDataElement |
createScalarElement(java.lang.String value)
Generates an element from a string. |
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. |
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. |
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. |
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. |
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. |
protected java.lang.Object |
getChecked(long pos)
Gets the value at a position. |
protected abstract java.lang.Object |
getDirect(long pos)
Gets the value at a position. |
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. |
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. |
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. |
EditableDataElement |
getPrototypeChild()
The prototypical instance of a subelement. |
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. |
IDataElement.Type |
getType()
The type of this element. |
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. |
void |
makeList()
Converts this element to a list. |
void |
moveValue(long pos1,
long pos2)
Moves a value within the element. |
protected void |
putChecked(long pos,
java.lang.Object value)
Sets the value at a position. |
protected abstract void |
putDirect(long pos,
java.lang.Object value)
Sets the value at a position. |
protected abstract void |
removeDirect(long pos)
Removes the value at a position. |
protected abstract void |
setLengthDirect(long length)
Sets the known length of an element. |
void |
setPrototypeChild(EditableDataElement prototypeChild)
Sets the prototypical instance of a subelement |
void |
setValue(boolean value)
Sets the element to a boolean. |
void |
setValue(double value)
Sets the element to a double. |
void |
setValue(IDataElement value)
Sets the element to a list. |
void |
setValue(long value)
Sets the element to a long. |
void |
setValue(long pos,
boolean value)
Sets an element value to a boolean. |
void |
setValue(long pos,
double value)
Sets an element value to a double. |
void |
setValue(long pos,
IDataElement value)
Sets an element value to a list. |
void |
setValue(long pos,
long value)
Sets an element value to a long. |
void |
setValue(long pos,
java.lang.String value)
Sets an element value to a string. |
void |
setValue(java.lang.String value)
Sets the element to a String. |
void |
setValueInterpreted(long pos,
java.lang.String value)
Sets an element value by parsing the textual representation of an element. |
void |
setValueInterpreted(java.lang.String value)
Sets the element by parsing the textual representation of an element. |
void |
swapValues(long pos1,
long pos2)
Exchanges values within the element. |
void |
unsetValue(long pos)
Deletes an element value. |
| Methods inherited from class jigcell.compare.data.DataElement |
|---|
forceBooleanValue, forceBooleanValue, forceIntegralValue, forceIntegralValue, forceListValue, forceLiteralValue, forceLiteralValue, forceRealValue, forceRealValue, forceSlice, getBooleanValue, getIntegralValue, getLength, getLiteralValue, getLongObject, getRealValue, getSlice, getSlice, getSlice, getSlice, getSlice, getTransferData, isAvailable, isScalar, isSpecialNonNumeric, memoryLock, memoryUnlock, 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.IEditableDataElement |
|---|
clear |
| Methods inherited from interface jigcell.compare.IDataElement |
|---|
forceBooleanValue, forceBooleanValue, forceIntegralValue, forceIntegralValue, forceListValue, forceLiteralValue, forceLiteralValue, forceRealValue, forceRealValue, forceSlice, getBooleanValue, getIntegralValue, getLength, getLiteralValue, getRealValue, getSlice, getSlice, getSlice, getSlice, getSlice, isAvailable, isScalar, memoryLock, memoryUnlock, toString, toString, toString, toString, toString, toString, toString |
| Methods inherited from interface java.awt.datatransfer.Transferable |
|---|
getTransferData, getTransferDataFlavors, isDataFlavorSupported |
| Field Detail |
|---|
protected static final char PATTERN_FP
protected static final java.lang.Double DOUBLE_NaN
protected static final java.lang.Double DOUBLE_NINFINITY
protected static final java.lang.Double DOUBLE_PINFINITY
protected static final java.lang.String MESSAGE_PARSEBLOCKERROR
protected static final java.lang.String MESSAGE_PARSEERROR
protected static final java.lang.String MESSAGE_PARSEEXTRAERROR
protected static final java.lang.String MESSAGE_PARSELITERALERROR
protected static final java.lang.String TOKEN_ALL
protected static final java.lang.String TOKEN_BLOCKELEMENT
protected static final java.lang.String TOKEN_BLOCKEND
protected static final java.lang.String TOKEN_BLOCKSTART
protected static final java.lang.String TOKEN_LITERAL
protected EditableDataElement prototypeChild
| Constructor Detail |
|---|
public EditableDataElement()
| Method Detail |
|---|
public static IEditableDataElement createElement(IDataElement element)
element - DataElement
public static EditableDataElement createElement(EditableDataElement element,
java.io.Reader reader)
element - Element to populatereader - Readerpublic static IEditableDataElement createElement(java.lang.String text)
text - String to parsepublic static IEditableDataElement createElement(java.io.Reader reader)
reader - Readerpublic static IEditableDataElement createElementSafe(IDataElement element)
element - DataElementpublic static IEditableDataElement createElementSafe(java.lang.String text)
text - String to parsepublic static IEditableDataElement createElementSafe(java.io.Reader reader)
reader - Readerpublic static IEditableDataElement createScalarElement(boolean value)
value - Valuepublic static IEditableDataElement createScalarElement(double value)
value - Valuepublic static IEditableDataElement createScalarElement(long value)
value - Valuepublic static IEditableDataElement createScalarElement(java.lang.String value)
value - Value
private static EditableDataElement createElement(EditableDataElement element,
StreamingStringTokenizer tokenizer,
long pos)
element - Element to populatetokenizer - Tokenizer to obtain input frompos - Initial position to store element data at
public void copyValue(long pos1,
long pos2)
copyValue in interface IEditableDataElementpos1 - Position to copy frompos2 - Position to copy to
public boolean[] forceSlice(boolean[] slice,
long start,
int length,
long stride)
forceSlice in interface IDataElementforceSlice in class DataElementslice - Suggested container for the slicestart - First position to pulllength - Number of positions to pullstride - Interval between positions to pull
public IDataElement[] forceSlice(IDataElement[] slice,
long start,
int length,
long stride)
forceSlice in interface IDataElementforceSlice in class DataElementslice - Suggested container for the slicestart - First position to pulllength - Number of positions to pullstride - Interval between positions to pull
public double[] forceSlice(double[] slice,
long start,
int length,
long stride)
forceSlice in interface IDataElementforceSlice in class DataElementslice - Suggested container for the slicestart - First position to pulllength - Number of positions to pullstride - Interval between positions to pull
public long[] forceSlice(long[] slice,
long start,
int length,
long stride)
forceSlice in interface IDataElementforceSlice in class DataElementslice - Suggested container for the slicestart - First position to pulllength - Number of positions to pullstride - Interval between positions to pullpublic boolean getBooleanValue(long pos)
getBooleanValue in interface IDataElementgetBooleanValue in class DataElementpos - Positionpublic long getIntegralValue(long pos)
getIntegralValue in interface IDataElementgetIntegralValue in class DataElementpos - Positionpublic IDataElement getListValue(long pos)
getListValue in interface IDataElementgetListValue in class DataElementpos - Positionpublic java.lang.String getLiteralValue(long pos)
getLiteralValue in interface IDataElementgetLiteralValue in class DataElementpos - Positionpublic EditableDataElement getPrototypeChild()
public double getRealValue(long pos)
getRealValue in interface IDataElementgetRealValue in class DataElementpos - Positionpublic IDataElement.Type getType()
getType in interface IDataElementgetType in class DataElementpublic IDataElement.Type getType(long pos)
getType in interface IDataElementgetType in class DataElementpos - Positionpublic void makeList()
makeList in interface IEditableDataElement
public void moveValue(long pos1,
long pos2)
moveValue in interface IEditableDataElementpos1 - The position to move frompos2 - The position to move topublic void setPrototypeChild(EditableDataElement prototypeChild)
prototypeChild - Instancepublic void setValue(boolean value)
setValue in interface IEditableDataElementvalue - Valuepublic void setValue(IDataElement value)
setValue in interface IEditableDataElementvalue - Valuepublic void setValue(double value)
setValue in interface IEditableDataElementvalue - Valuepublic void setValue(long value)
setValue in interface IEditableDataElementvalue - Valuepublic void setValue(java.lang.String value)
setValue in interface IEditableDataElementvalue - Value
public void setValue(long pos,
boolean value)
setValue in interface IEditableDataElementpos - Value positionvalue - Value
public void setValue(long pos,
IDataElement value)
setValue in interface IEditableDataElementpos - Value positionvalue - Value
public void setValue(long pos,
double value)
setValue in interface IEditableDataElementpos - Value positionvalue - Value
public void setValue(long pos,
long value)
setValue in interface IEditableDataElementpos - Value positionvalue - Value
public void setValue(long pos,
java.lang.String value)
setValue in interface IEditableDataElementpos - Value positionvalue - Valuepublic void setValueInterpreted(java.lang.String value)
setValueInterpreted in interface IEditableDataElementvalue - Text to parse
public void setValueInterpreted(long pos,
java.lang.String value)
setValueInterpreted in interface IEditableDataElementpos - Value positionvalue - Text to parse
public void swapValues(long pos1,
long pos2)
swapValues in interface IEditableDataElementpos1 - A position to exchangepos2 - Another position to exchangepublic void unsetValue(long pos)
unsetValue in interface IEditableDataElementpos - Value positionprotected abstract EditableDataElement constructNew()
protected java.lang.Object getChecked(long pos)
pos - Positionprotected abstract java.lang.Object getDirect(long pos)
pos - Position
protected void putChecked(long pos,
java.lang.Object value)
pos - Positionvalue - Value
protected abstract void putDirect(long pos,
java.lang.Object value)
pos - Positionvalue - Valueprotected abstract void removeDirect(long pos)
pos - Positionprotected abstract void setLengthDirect(long length)
length - Length of element
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||