Class DataRange

  • Direct Known Subclasses:
    DefaultAxisDescription

    public class DataRange
    extends java.lang.Object
    Defines min/max (limits) used for DataSet and Axis range definitions.
    Author:
    gkruk, CERN, rstein
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double max  
      protected double min  
    • Constructor Summary

      Constructors 
      Constructor Description
      DataRange()
      Creates a new DataRange that is not defined.
      DataRange​(double min, double max)
      Creates a new DataRange with the specified min and max values.
      DataRange​(DataRange range)
      Creates a copy of the specified data range.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(double value)
      Adds value to this range.
      boolean add​(double[] values)
      Adds values to this range.
      boolean add​(double[] values, int nLength)
      Adds values to this range.
      boolean add​(DataRange range)
      Add the specified data range to this range.
      boolean clear()
      Empties this DataRange.
      boolean contains​(double value)
      Examines if this range contains the specified value.
      boolean equals​(java.lang.Object obj)  
      double getLength()
      Returns length of this range (max - min).
      double getMax()  
      double getMin()  
      int hashCode()  
      boolean isDefined()
      Determines if this DataRange is defined - min and max values are defined.
      boolean isMaxDefined()
      Determines if max value has been defined.
      boolean isMinDefined()
      Determines if min value has been defined.
      boolean set​(double min, double max)
      Sets min and max values for this range.
      boolean set​(DataRange range)
      Sets updates range to the specified one.
      boolean setMax​(double max)
      Sets max value for this range.
      boolean setMin​(double min)
      Sets min value for this range.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • min

        protected double min
      • max

        protected double max
    • Constructor Detail

      • DataRange

        public DataRange()
        Creates a new DataRange that is not defined.
        See Also:
        isDefined()
      • DataRange

        public DataRange​(DataRange range)
        Creates a copy of the specified data range.
        Parameters:
        range - other DataRange object
      • DataRange

        public DataRange​(double min,
                         double max)
        Creates a new DataRange with the specified min and max values.
        Parameters:
        min - the new min value
        max - the new max value
    • Method Detail

      • add

        public boolean add​(DataRange range)
        Add the specified data range to this range.
        Parameters:
        range - other DataRange
        Returns:
        true if the value becomes min or max.
      • add

        public boolean add​(double value)
        Adds value to this range.
        Parameters:
        value - value to be added
        Returns:
        true if the value becomes min or max.
      • add

        public boolean add​(double[] values)
        Adds values to this range.
        Parameters:
        values - values 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.
        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.
        Returns:
        true if the values were valid before
        See Also:
        isDefined()
      • contains

        public boolean contains​(double value)
        Examines if this range contains the specified value.
        Parameters:
        value - to be tested
        Returns:
        true: data value is within range
      • equals

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

        public double getLength()
        Returns length of this range (max - min).
        Returns:
        max - min or 0.0 if the range is not defined.
      • getMax

        public double getMax()
        Returns:
        Returns the max.
      • getMin

        public double getMin()
        Returns:
        the minimum of the range
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isDefined

        public boolean isDefined()
        Determines if this DataRange is defined - min and max values are defined.
        Returns:
        true: range is defined
      • isMaxDefined

        public boolean isMaxDefined()
        Determines if max value has been defined.
        Returns:
        true max is defined
      • isMinDefined

        public boolean isMinDefined()
        Determines if min value has been defined.
        Returns:
        true: min is defined
      • set

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

        public boolean set​(double min,
                           double max)
        Sets min and max values for this range.
        Parameters:
        min - new minimum of the range
        max - new maximum of the range
        Returns:
        true if the values becomes the new min or max.
      • setMax

        public boolean setMax​(double max)
        Sets max value for this range.
        Parameters:
        max - the new max value
        Returns:
        true if the value becomes the new max.
      • setMin

        public boolean setMin​(double min)
        Sets min value for this range.
        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 java.lang.Object