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

      • inputStorage

        public java.util.function.Function<java.lang.Object[],​java.lang.Number> inputStorage​(uk.ac.starlink.table.ValueInfo[] infos,
                                                                                                   uk.ac.starlink.table.DomainMapper[] dms)
        Description copied from interface: Coord
        Provides a function to turn a quantity in the user view to a plotting view object.

        The supplied infos and domainMappers arrays correspond to (have the same length as) this object's Inputs array, and may influence the return values. However, Coord instances that always behave the same way (for instance whose Input Domains have fixed DomainMappers) are free to ignore these arguments.

        The returned function converts an array of per-input user values to a storable object of the type corresponding to the result of Coord.getStorageType(); the return value of the returned function is never null.

        Parameters:
        infos - per-input array of column input metadata
        dms - per-input array of input value->domain value mappers
        Returns:
        input values to storage object conversion function, or null if such conversions will never be possible
      • 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