Package de.gsi.dataset.spi
Class DataRange
- java.lang.Object
-
- de.gsi.dataset.spi.DataRange
-
- Direct Known Subclasses:
DefaultAxisDescription
public class DataRange extends java.lang.ObjectDefines min/max (limits) used for DataSet and Axis range definitions.- Author:
- gkruk, CERN, rstein
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(double value)Adds value to this range.booleanadd(double[] values)Adds values to this range.booleanadd(double[] values, int nLength)Adds values to this range.booleanadd(DataRange range)Add the specified data range to this range.booleanclear()Empties this DataRange.booleancontains(double value)Examines if this range contains the specified value.booleanequals(java.lang.Object obj)doublegetLength()Returns length of this range (max - min).doublegetMax()doublegetMin()inthashCode()booleanisDefined()Determines if this DataRange is defined -minandmaxvalues are defined.booleanisMaxDefined()Determines ifmaxvalue has been defined.booleanisMinDefined()Determines ifminvalue has been defined.booleanset(double min, double max)Setsminandmaxvalues for this range.booleanset(DataRange range)Sets updates range to the specified one.booleansetMax(double max)Setsmaxvalue for this range.booleansetMin(double min)Setsminvalue for this range.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DataRange
public DataRange()
Creates a newDataRangethat is not defined.- See Also:
isDefined()
-
DataRange
public DataRange(DataRange range)
Creates a copy of the specified data range.- Parameters:
range- otherDataRangeobject
-
DataRange
public DataRange(double min, double max)Creates a newDataRangewith the specifiedminandmaxvalues.- Parameters:
min- the new min valuemax- the new max value
-
-
Method Detail
-
add
public boolean add(DataRange range)
Add the specified data range to this range.- Parameters:
range- otherDataRange- Returns:
trueif the value becomesminormax.
-
add
public boolean add(double value)
Adds value to this range.- Parameters:
value- value to be added- Returns:
trueif the value becomesminormax.
-
add
public boolean add(double[] values)
Adds values to this range.- Parameters:
values- values to be added- Returns:
trueif the value becomesminormax.
-
add
public boolean add(double[] values, int nLength)Adds values to this range.- Parameters:
values- values to be addednLength- the maximum array length that should be taken into account- Returns:
trueif the value becomesminormax.
-
clear
public boolean clear()
Empties this DataRange. After calling this method this data range becomes undefined.- Returns:
trueif 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:
equalsin classjava.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:
hashCodein classjava.lang.Object
-
isDefined
public boolean isDefined()
Determines if this DataRange is defined -minandmaxvalues are defined.- Returns:
- true: range is defined
-
isMaxDefined
public boolean isMaxDefined()
Determines ifmaxvalue has been defined.- Returns:
- true max is defined
-
isMinDefined
public boolean isMinDefined()
Determines ifminvalue has been defined.- Returns:
- true: min is defined
-
set
public boolean set(DataRange range)
Sets updates range to the specified one.- Parameters:
range- otherDataRangeobject- Returns:
trueif the value becomesminormax.
-
set
public boolean set(double min, double max)Setsminandmaxvalues for this range.- Parameters:
min- new minimum of the rangemax- new maximum of the range- Returns:
trueif the values becomes the newminormax.
-
setMax
public boolean setMax(double max)
Setsmaxvalue for this range.- Parameters:
max- the new max value- Returns:
trueif the value becomes the newmax.
-
setMin
public boolean setMin(double min)
Setsminvalue for this range.- Parameters:
min- the new data range minimum- Returns:
trueif the value becomes the newmin.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-