|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.data.DataCell
public abstract class DataCell
Abstract base class of all DataCell
s, which acts as a container
for arbitrary values and defines the common abilities all cells must provide,
that is: retrieve the cell type, a string representation of the value,
find out if this cell is missing, and test whether it is equal to another
one.
Derived classes have to implement at least one interface
derived from DataValue
. The derived class must be
read-only, i.e. setter methods must not be implemented.
This class implements Serializable
. However, if
you define a custom DataCell
implementation, consider to
implement a factory that takes care of reading and writing a cell to a
DataInput
or
DataOutput
source. Ordinary Java
serialization is considerably slower than implementing your own
DataCellSerializer
. To register
such a serializer, define a static method having the following signature:
public static final DataCellSerializer
<YourCellClass>
getCellSerializer() {
...
}
where YourCellClass is the name of your DataCell
implementation. This method will be called by reflection, whenever the cell
at hand needs to be written or read.
Since DataCell
may implement different DataValue
interfaces but only one is the preferred value class,
implement a static method in your derived class with the following signature:
public static final Class<? extends DataValue> getPreferredValueClass() { ... }This method is called once when the runtime
DataType
of the cell is
created using reflection. The associated DataType
provides the
renderer, icon, and comparator of this preferred value. If this method is
not implemented, the order on the value interfaces is undefined.
For further details on data types, see also the package description and the manual on defining new cell types.
DataType
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface org.knime.core.data.DataValue |
---|
DataValue.UtilityFactory |
Field Summary |
---|
Fields inherited from interface org.knime.core.data.DataValue |
---|
UTILITY |
Constructor Summary | |
---|---|
DataCell()
|
Method Summary | |
---|---|
boolean |
equals(Object o)
Implements the equals method which returns true only if both
cells are of the same class and equalsDataCell(DataCell) returns
true . |
protected abstract boolean |
equalsDataCell(DataCell dc)
Derived classes implement their specific equals function here. |
DataType |
getType()
Returns this cell's DataType . |
abstract int |
hashCode()
This method must be implemented in order to ensure that two equal DataCell objects return the same hash code. |
boolean |
isMissing()
Returns true if this represents missing cell,
false otherwise. |
(package private) boolean |
isMissingInternal()
Internal implementation of isMissing() . |
abstract String |
toString()
Returns the String representation of this cell's value. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DataCell()
Method Detail |
---|
public final DataType getType()
DataType
. This method is provided for
convenience only, it is a shortcut for
DataType.getType(o.getClass())
, where o is the
runtime DataCell
object.
DataType
DataType.getType(Class)
public final boolean isMissing()
true
if this represents missing cell,
false
otherwise. The default implementation returns
false
. If you need a missing cell use the static method
DataType.getMissingCell()
.
true
if the cell represents a missing value,
false
otherwiseDataType.getMissingCell()
boolean isMissingInternal()
isMissing()
. It will return
false
and is only overridden in the
DataType.getMissingCell()
implementation.
false
public abstract String toString()
toString
in class Object
public final boolean equals(Object o)
true
only if both
cells are of the same class and equalsDataCell(DataCell)
returns
true
. For that, this final method calls the type specific
equalsDataCell(DataCell)
method, which all derived
DataCell
s must provide. This method handles the missing
value and null
cases, in all other cases it delegates
to the specific method.
equals
in class Object
o
- the other object to check
true
if this instance and the given object are
instances of the same class and of equal value (or both
representing missing values)protected abstract boolean equalsDataCell(DataCell dc)
null
or a missing value,
to be of the same class like this.
dc
- the cell to compare this to
true
if this is equal to the argument,
false
if notpublic abstract int hashCode()
DataCell
objects return the same hash code.
hashCode
in class Object
DataCell
Object.hashCode()
,
equals(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |