Class DefaultAxisDescription

  • All Implemented Interfaces:
    AxisDescription

    public class DefaultAxisDescription
    extends DataRange
    implements AxisDescription
    Simple default implementation of the AxisDescription interface
    Author:
    rstein
    • Constructor Detail

      • DefaultAxisDescription

        public DefaultAxisDescription()
        Default
      • DefaultAxisDescription

        public DefaultAxisDescription​(DataSet dataSet,
                                      AxisDescription axisDesc)
        Copy constructor to generate axisDescriptions for datasets from existing Axis Descriptions
        Parameters:
        dataSet - for which the update events shall be registered
        axisDesc - axis Description to copy all data except dataSet from
      • DefaultAxisDescription

        public DefaultAxisDescription​(DataSet dataSet,
                                      java.lang.String axisName,
                                      java.lang.String... axisUnit)
        Parameters:
        dataSet - for which the update events shall be registered
        axisName - the new axis name
        axisUnit - the new axis unit
      • DefaultAxisDescription

        public DefaultAxisDescription​(DataSet dataSet,
                                      java.lang.String axisName,
                                      java.lang.String axisUnit,
                                      double rangeMin,
                                      double rangeMax)
        Parameters:
        dataSet - for which the update events shall be registered
        axisName - the new axis name
        axisUnit - the new axis unit
        rangeMin - the user-provided new minimum value of the DataSet/Axis range
        rangeMax - the user-provided new maximum value of the DataSet/Axis range
      • DefaultAxisDescription

        public DefaultAxisDescription​(java.lang.String axisName,
                                      java.lang.String... axisUnit)
        Parameters:
        axisName - the new axis name
        axisUnit - the new axis unit
    • Method Detail

      • add

        public boolean add​(double value)
        Adds value to this range.
        Specified by:
        add in interface AxisDescription
        Overrides:
        add in class DataRange
        Parameters:
        value - value to be added
        Returns:
        true if the value becomes min or max.
      • add

        public boolean add​(double[] values,
                           int nlength)
        Adds values to this range.
        Specified by:
        add in interface AxisDescription
        Overrides:
        add in class DataRange
        Parameters:
        values - values to be added
        nlength - the maximum array length that should be taken into account
        Returns:
        true if the value becomes min or max.
      • clear

        public boolean clear()
        Empties this DataRange. After calling this method this data range becomes undefined.
        Specified by:
        clear in interface AxisDescription
        Overrides:
        clear in class DataRange
        Returns:
        true if the values were valid before
        See Also:
        DataRange.isDefined()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class DataRange
      • equals

        public boolean equals​(java.lang.Object obj,
                              double epsilon)
        Parameters:
        obj - object to compare to
        epsilon - allow for fuzzy comparisons of min/max
        Returns:
        true: matches, false otherwise
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface AxisDescription
        Returns:
        axis name
      • getUnit

        public final java.lang.String getUnit()
        Specified by:
        getUnit in interface AxisDescription
        Returns:
        the unit of the axis, typically in SI units such as 's', 'V' etc. or 'a.u.'
      • set

        public boolean set​(DataRange range)
        Description copied from class: DataRange
        Sets updates range to the specified one.
        Overrides:
        set in class DataRange
        Parameters:
        range - other DataRange object
        Returns:
        true if the value becomes min or max.
      • set

        public boolean set​(double min,
                           double max)
        Description copied from class: DataRange
        Sets min and max values for this range.
        Specified by:
        set in interface AxisDescription
        Overrides:
        set in class DataRange
        Parameters:
        min - new minimum of the range
        max - new maximum of the range
        Returns:
        true if the values becomes the new min or max.
      • set

        public final boolean set​(java.lang.String axisName,
                                 java.lang.String axisUnit,
                                 double rangeMin,
                                 double rangeMax)
        Specified by:
        set in interface AxisDescription
        Parameters:
        axisName - the new axis name
        axisUnit - the new axis unit
        rangeMin - the user-provided new minimum value of the DataSet/Axis range
        rangeMax - the user-provided new maximum value of the DataSet/Axis range
        Returns:
        true if this setter invalidates the existing min/max range
        See Also:
        event if only the name/unit changed, or, event if only the range changed, or, for a full change
      • setMax

        public boolean setMax​(double max)
        Description copied from class: DataRange
        Sets max value for this range.
        Specified by:
        setMax in interface AxisDescription
        Overrides:
        setMax in class DataRange
        Parameters:
        max - the new max value
        Returns:
        true if the value becomes the new max.
      • setMin

        public boolean setMin​(double min)
        Description copied from class: DataRange
        Sets min value for this range.
        Specified by:
        setMin in interface AxisDescription
        Overrides:
        setMin in class DataRange
        Parameters:
        min - the new data range minimum
        Returns:
        true if the value becomes the new min.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class DataRange