|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knime.core.data.DataValueComparator
public abstract class DataValueComparator
The comparator used to compare two DataValue
objects. An instance of this class is returned by each
DataValue.UtilityFactory implementation.
Implementations can safely assume that objects passed to the
compareDataValues(DataValue, DataValue) method support a type cast
to that type of the DataValue returning this
comparator.
Note: this comparator imposes orderings that are inconsistent with equals.
That is, the return value zero is not equivalent to equals returning
true, it rather says "don't know". Meaning, if two
DataValues cannot be compared (because they represent completely
different value types) the comparator will return zero - and equals will
return false.)
DataValue.UtilityFactory.getComparator()| Constructor Summary | |
|---|---|
protected |
DataValueComparator()
Create a new DataValue comparator. |
| Method Summary | |
|---|---|
int |
compare(DataCell c1,
DataCell c2)
This final implementation checks and handles DataCells representing missing values,
before it delegates the actual comparison
to the derived class, by calling
compareDataValues(DataValue, DataValue). |
protected abstract int |
compareDataValues(DataValue v1,
DataValue v2)
Do not call this function, rather call the compare(DataCell, DataCell) method, which handles missing cells. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
|---|
equals |
| Constructor Detail |
|---|
protected DataValueComparator()
DataValue comparator. This
constructor does nothing.
| Method Detail |
|---|
public final int compare(DataCell c1,
DataCell c2)
DataCells representing missing values,
before it delegates the actual comparison
to the derived class, by calling
compareDataValues(DataValue, DataValue).
Missing cells are considered to be smaller than any other non-missing
DataCell, and two missing cells are not
comparable (returns 0). Note: return value 0 is not equivalent to
c1 equals c2, rather they are not comparable at
all.
compare in interface Comparator<DataCell>c1 - the first DataCell to compare the
other withc2 - the other DataCell to compare the
first with
c1 is smaller than
c2, a positive number if c1 is larger
than c2, otherwise zero
NullPointerException - if any of the objects is nullComparator.compare(java.lang.Object, java.lang.Object),
compareDataValues(DataValue, DataValue)
protected abstract int compareDataValues(DataValue v1,
DataValue v2)
compare(DataCell, DataCell) method, which handles missing cells.
The derived class should compare the two passed DataValues.
It can be safely assumed that both values are castable to the specific
type of the DataValue that returned this
comparator.
v1 - the first DataValue to compare the
other withv2 - the other DataValue to compare the
first with
v1 is smaller than v2, +1
if v1 is larger than v2, 0 otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||