Package de.gsi.dataset.spi
Class DataRange
- java.lang.Object
-
- de.gsi.dataset.spi.DataRange
-
- All Implemented Interfaces:
java.lang.Cloneable
public class DataRange extends java.lang.Object implements java.lang.CloneableDefines range (limits) of data.
- Version:
- $Id: DataRange.java,v 1.7 2006-06-22 12:09:30 gkruk Exp $
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(double value)Adds value to this range.voidadd(DataRange range)Add the specified data range to this range.java.lang.Objectclone()booleancontains(double value)Examines if this range contains the specified value.voidempty()Empties this DataRange.booleanequals(java.lang.Object obj)voidexpand(double value)Expands this data set by the given value.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.voidset(double min, double max)Setsminandmaxvalues for this range.voidset(DataRange range)Sets updates range to the specified one.voidsetMax(double max)Setsmaxvalue for this range.voidsetMin(double min)Setsminvalue for this range.DataRangesubstract(DataRange range)Substracts the specified data range from this range.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DataRange
public DataRange()
Creates a newDataRangethat is not defined.- See Also:
isDefined()
-
DataRange
public DataRange(double min, double max)Creates a newDataRangewith the specifiedminandmaxvalues.- Parameters:
min- the new min valuemax- the new max value
-
DataRange
public DataRange(DataRange range)
Creates a copy of the specified data range.- Parameters:
range- otherDataRangeobject
-
-
Method Detail
-
isDefined
public boolean isDefined()
Determines if this DataRange is defined -minandmaxvalues are defined.- Returns:
- true: range is defined
-
isMinDefined
public boolean isMinDefined()
Determines ifminvalue has been defined.- Returns:
- true: min is defined
-
isMaxDefined
public boolean isMaxDefined()
Determines ifmaxvalue has been defined.- Returns:
- true max is defined
-
getMax
public double getMax()
- Returns:
- Returns the max.
-
setMax
public void setMax(double max)
Setsmaxvalue for this range.- Parameters:
max- the new max value
-
getMin
public double getMin()
- Returns:
- the minimum of the range
-
setMin
public void setMin(double min)
Setsminvalue for this range.- Parameters:
min- the new data range minimum
-
set
public void set(DataRange range)
Sets updates range to the specified one.- Parameters:
range- otherDataRangeobject
-
set
public void set(double min, double max)Setsminandmaxvalues for this range.- Parameters:
min- new minimum of the rangemax- new maximum of the range
-
getLength
public double getLength()
Returns length of this range (max - min).- Returns:
- max - min or 0.0 if the range is not defined.
-
add
public boolean add(double value)
Adds value to this range.- Parameters:
value- value to be added- Returns:
trueif the value becomesminormax.
-
add
public void add(DataRange range)
Add the specified data range to this range.- Parameters:
range- otherDataRange
-
substract
public DataRange substract(DataRange range)
Substracts the specified data range from this range.- Parameters:
range- otherDataRange- Returns:
- new data Range
-
expand
public void expand(double value)
Expands this data set by the given value.- Parameters:
value- range to expand to
-
empty
public void empty()
Empties this DataRange. After calling this method this data range becomes undefined.- 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
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-