|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.util.coordinate.Coordinate
public abstract class Coordinate
The abstract class for all coordinate classes. A concrete coordinate depends
on whether it is nominal or numeric, etc. All coordinates have an underlying
DataColumnSpec
. Ticks have to be created and
mapped to their domain values.
Field Summary | |
---|---|
static int |
DEFAULT_ABSOLUTE_TICK_DIST
The default tick distance in pixel. |
Constructor Summary | |
---|---|
protected |
Coordinate(DataColumnSpec dataColumnSpec)
Creates a coordinate from a data column spec. |
Method Summary | |
---|---|
static void |
addCoordinateFactory(Class<? extends DataValue> valueClass,
CoordinateFactory factory)
Adds a coordinate factory class. |
abstract void |
addDesiredValues(DataValue... values)
Adds a value which should have a tick. |
static void |
addMappingMethod(Class<? extends DataValue> clazz,
String id,
MappingMethod mappingMethod)
Adds a MappingMethod to the internal registry. |
static void |
addPolicy(Class<? extends DataValue> dataValue,
String id,
PolicyStrategy strategy)
Registers a strategy. |
protected DataCell |
applyMappingMethod(DataCell datacell)
Applies the mapping method. |
double |
calculateMappedValue(DataCell domainValueCell,
double absoluteLength)
Returns the mapping of a domain value for this coordinate axis. |
double |
calculateMappedValue(DataCell domainValueCell,
double absoluteLength,
boolean naturalMapping)
Deprecated. Use calculateMappedValue(DataCell, double) instead. |
protected abstract double |
calculateMappedValueInternal(DataCell domainValueCell,
double absoluteLength)
Returns the mapping of a domain value for this coordinate axis. |
void |
clearDesiredValues()
Clears the desired values. |
static Coordinate |
createCoordinate(DataColumnSpec dataColumnSpec)
Factory method to create a coordinate for a given column spec. |
MappingMethod |
getActiveMappingMethod()
Gets the mapping method which should be applied. |
Set<MappingMethod> |
getCompatibleMappingMethods()
Returns the mapping methods compatible to this coordinate's data type. |
Set<PolicyStrategy> |
getCompatiblePolicies()
Returns the compatible policies for this data value. |
PolicyStrategy |
getCurrentPolicy()
Returns the current tick policy. |
(package private) DataColumnSpec |
getDataColumnSpec()
Returns the underlying DataColumnSpec . |
DataValue[] |
getDesiredValues()
Returns the desired values. |
protected Set<DataValue> |
getDesiredValuesSet()
Returns the set for the desired values. |
DataColumnDomain |
getDomain()
Returns the domain used in this moment after applying the active mapping method. |
MappingMethod |
getMappingMethod(String id)
Returns the MappingMethod with the given id if available. |
double |
getNegativeInfinity()
Returns the value for negative infinity after mapping. |
protected PolicyStrategy |
getPolicyStategy(String policy)
Returns the strategy for the given policy. |
double |
getPositiveInfinity()
Returns the value for positive infinity after mapping. |
CoordinateMapping[] |
getTickPositions(double absoluteLength)
Returns an array with the position of all ticks and their corresponding domain values given an absolute length. |
CoordinateMapping[] |
getTickPositions(double absoluteLength,
boolean naturalMapping)
Deprecated. Use getTickPositions(double) instead. |
protected abstract CoordinateMapping[] |
getTickPositionsWithLabels(double absoluteLength)
Returns an array with the position of all ticks and their corresponding domain values given an absolute length. |
abstract double |
getUnusedDistBetweenTicks(double absoluteLength)
Returns the range according to the mapping in which no values can have values. |
abstract boolean |
isNominal()
Whether this coordinate is a nominal one. |
void |
setActiveMappingMethod(MappingMethod method)
Sets the mapping method which should be applied. |
void |
setPolicy(PolicyStrategy policy)
Sets the current PolicyStrategy . |
void |
setPolicy(String id)
Sets the current PolicyStrategy . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_ABSOLUTE_TICK_DIST
Constructor Detail |
---|
protected Coordinate(DataColumnSpec dataColumnSpec)
dataColumnSpec
- the underlying column spec to setMethod Detail |
---|
public abstract void addDesiredValues(DataValue... values)
values
- the desired valueprotected Set<DataValue> getDesiredValuesSet()
public void clearDesiredValues()
protected PolicyStrategy getPolicyStategy(String policy)
policy
- the numeric tick policy
public Set<PolicyStrategy> getCompatiblePolicies()
null
if none.public static void addPolicy(Class<? extends DataValue> dataValue, String id, PolicyStrategy strategy)
dataValue
- the according DataValue
.id
- a unique identifierstrategy
- the PolicyStrategy
public PolicyStrategy getCurrentPolicy()
null
if none.public void setPolicy(PolicyStrategy policy)
PolicyStrategy
.
policy
- the new PolicyStrategy
IllegalArgumentException
- if desired policy does not fit to this
coordinatepublic void setPolicy(String id)
PolicyStrategy
.
id
- the unique identifier of the desired policy
IllegalArgumentException
- if desired policy does not exist.public DataValue[] getDesiredValues()
null
, if not setpublic static void addCoordinateFactory(Class<? extends DataValue> valueClass, CoordinateFactory factory)
valueClass
- the data valuefactory
- the according coordinate factorypublic static Coordinate createCoordinate(DataColumnSpec dataColumnSpec)
dataColumnSpec
- the column spec to create the coordinate from
null
if not possibleDataColumnSpec getDataColumnSpec()
DataColumnSpec
. If MappingMethod
s
are set, they will be applied to the domain. The domain must not be equal
to the original DataColumnSpec
.
@Deprecated public CoordinateMapping[] getTickPositions(double absoluteLength, boolean naturalMapping)
getTickPositions(double)
instead.
absoluteLength
- the absolute length the domain is mapped onnaturalMapping
- if true
the mapping values are
rounded to the next integer equivalent
public CoordinateMapping[] getTickPositions(double absoluteLength)
absoluteLength
- the absolute length the domain is mapped on
protected abstract CoordinateMapping[] getTickPositionsWithLabels(double absoluteLength)
absoluteLength
- the absolute length the domain is mapped on
public double calculateMappedValue(DataCell domainValueCell, double absoluteLength)
The value is not the position on the screen. Since the java coordinate system is upside down simply subtract the returned value from the screen height to calculate the screen position.
domainValueCell
- the data cell with the domain value to mapabsoluteLength
- the absolute length on which the domain value is
mapped on
@Deprecated public double calculateMappedValue(DataCell domainValueCell, double absoluteLength, boolean naturalMapping)
calculateMappedValue(DataCell, double)
instead.
domainValueCell
- the data cell with the domain value to mapabsoluteLength
- the absolute length on which the domain value is
mapped onnaturalMapping
- if true
the return value will be a
double but with zeros after the decimal dot
protected abstract double calculateMappedValueInternal(DataCell domainValueCell, double absoluteLength)
The value is not the position on the screen. Since the java coordinate system is upside down simply subtract the returned value from the screen height to calculate the screen position.
domainValueCell
- the data cell with the domain value to mapabsoluteLength
- the absolute length on which the domain value is
mapped on
public abstract boolean isNominal()
true
, if this coordinate is a nominal onepublic abstract double getUnusedDistBetweenTicks(double absoluteLength)
absoluteLength
- the absolute length available for this coordinate
public static void addMappingMethod(Class<? extends DataValue> clazz, String id, MappingMethod mappingMethod)
MappingMethod
to the internal registry.
clazz
- the according class, must extend DataValue
id
- a unique identifiermappingMethod
- a MappingMethod
public Set<MappingMethod> getCompatibleMappingMethods()
Set
of MappingMethod
spublic MappingMethod getMappingMethod(String id)
MappingMethod
with the given id if available.
id
- the unique identifier
MappingMethod
or null
if id is not
registered.public void setActiveMappingMethod(MappingMethod method)
method
- a MappingMethod
public MappingMethod getActiveMappingMethod()
MappingMethod
which currently will be applied or
null
if noneprotected DataCell applyMappingMethod(DataCell datacell)
datacell
- value to be mapped
public DataColumnDomain getDomain()
public double getPositiveInfinity()
public double getNegativeInfinity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |