Class 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 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 (matching Input.getValueClass()), and the corresponding element of the inputMappers array gives a DomainMapper object (consistent with Input.getDomain()). InputMappers may be null however, and in many cases, coordinates are not sensitive to domains, and for those cases implementations will ignore inputMappers.

        Parameters:
        userValues - per-input values
        mappers - 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 - tuple
        icol - 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 the PlotUtil.storeFullPrecision() method.
        Parameters:
        meta - input value metadata
        isRequired - 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 metadata
        isRequired - true if this coordinate is required for plotting
        Returns:
        instance