Package uk.ac.starlink.ttools.plot2.data
Class FloatingCoord
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.data.SingleCoord
-
- uk.ac.starlink.ttools.plot2.data.FloatingCoord
-
- All Implemented Interfaces:
Coord
public class FloatingCoord extends SingleCoord
Coord implementation for floating point values. This covers both single and double precision. Currently there is a factory method to generate an instance of this class, which uses single or double precision according to a global configuration parameter. Although in general double precision processing is important, for plotting purposes it's not usually going to make a visible difference, and the cached storage requirements are cut in half if you use single precision instead. Maybe see about different configuration options for this in the future.- Since:
- 4 Feb 2013
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static FloatingCoord
WEIGHT_COORD
Coordinate instance used for weighting values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FloatingCoord
createCoord(InputMeta meta, boolean isRequired)
Factory method to return an instance of this class.static FloatingCoord
createTimeCoord(InputMeta meta, boolean isRequired)
Returns a new time coordinate.java.lang.Object
inputToStorage(java.lang.Object[] userValues, uk.ac.starlink.table.DomainMapper[] mappers)
Turns a quantity in the user view to a plotting view object.double
readDoubleCoord(Tuple tuple, int icol)
Reads a floating point value from an appropriate field in a given Tuple.-
Methods inherited from class uk.ac.starlink.ttools.plot2.data.SingleCoord
getInput, getInputs, getStorageType, isRequired
-
-
-
-
Field Detail
-
WEIGHT_COORD
public static FloatingCoord WEIGHT_COORD
Coordinate instance used for weighting values.
-
-
Method Detail
-
inputToStorage
public java.lang.Object inputToStorage(java.lang.Object[] userValues, uk.ac.starlink.table.DomainMapper[] mappers)
Description copied from interface:Coord
Turns a quantity in the user view to a plotting view object. The return value is never null.The supplied parameters both correspond (have the same length as) this object's Inputs array. For each Input, the corresponding element of the
inputValues
array gives the value obtained from the user-supplied data (matchingInput.getValueClass()
), and the corresponding element of theinputMappers
array gives a DomainMapper object (consistent withInput.getDomain()
). InputMappers may be null however, and in many cases, coordinates are not sensitive to domains, and for those cases implementations will ignoreinputMappers
.- Parameters:
userValues
- per-input valuesmappers
- per-input domain mappers, each may be null- Returns:
- object of the type corresponding to the result of
Coord.getStorageType()
; not null
-
readDoubleCoord
public double readDoubleCoord(Tuple tuple, int icol)
Reads a floating point value from an appropriate field in a given Tuple.- Parameters:
tuple
- tupleicol
- index of column in tuple corresponding to this Coord- Returns:
- value of floating point field
-
createCoord
public static FloatingCoord createCoord(InputMeta meta, boolean isRequired)
Factory method to return an instance of this class. Implementation is currently determined by thePlotUtil.storeFullPrecision()
method.- Parameters:
meta
- input value metadataisRequired
- true if this coordinate is required for plotting- Returns:
- instance
-
createTimeCoord
public static FloatingCoord createTimeCoord(InputMeta meta, boolean isRequired)
Returns a new time coordinate. This works in the TimeDomain, and the numeric value returned should normally be seconds since the Unix epoch (1 Jan 1970 midnight).- Parameters:
meta
- input value metadataisRequired
- true if this coordinate is required for plotting- Returns:
- instance
-
-