Package ucar.unidata.util
Class Range
java.lang.Object
ucar.unidata.util.Range
- All Implemented Interfaces:
Serializable
Holds a simple min/max range
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]asArray()Get a 2-aray array holding min/maxfloat[]Get a 2-aray array holding min/maxbooleanEqualsFormat the max valueFormat the mid valueFormat the min valuedoubleget abs(max-min)doublegetMax()Get the maxintGet int value of maxdoublegetMid()Get the mid pointintGet the int value of mid pointdoublegetMin()Get the minintGet int value of mingetName()Get the Name property.doublegetPercent(double v) Ge tthe percent the given value is between min and maxdoublegetSpan()max-minintGet the int value of the span (the difference between max and min)doublegetValueOfPercent(double percent) Get percent along the way between min and maxvoidset(double min, double max) set the valuesvoidsetMax(double v) Set the maxvoidsetMax(int v) Set the maxvoidsetMin(double v) Set the minvoidsetMin(int v) Set the minvoidSet the Name property.doublespan()max-mintoString()to string
-
Field Details
-
min
public double minThe range -
max
public double maxThe range
-
-
Constructor Details
-
Range
public Range()Default ctor -
Range
public Range(double min, double max) Create a range with min, max- Parameters:
min- minmax- max
-
Range
Create a range with min, max and name- Parameters:
min- minmax- maxname- name
-
Range
public Range(double[] a) ctor- Parameters:
a- 2-ary array holding min/max
-
Range
copy ctor- Parameters:
r- object
-
-
Method Details
-
equals
Equals -
set
public void set(double min, double max) set the values- Parameters:
min- minmax- max
-
formatMin
Format the min value- Returns:
- Min value formatted
-
formatMid
Format the mid value- Returns:
- Mid value formatted
-
formatMax
Format the max value- Returns:
- Max value formatted
-
getMin
public double getMin()Get the min- Returns:
- The min value
-
getMax
public double getMax()Get the max- Returns:
- The max value
-
setMin
public void setMin(double v) Set the min- Parameters:
v- value
-
setMax
public void setMax(double v) Set the max- Parameters:
v- value
-
getSpanInt
public int getSpanInt()Get the int value of the span (the difference between max and min)- Returns:
- int value of span
-
getMinInt
public int getMinInt()Get int value of min- Returns:
- int value of min
-
getMaxInt
public int getMaxInt()Get int value of max- Returns:
- int value of max
-
setMin
public void setMin(int v) Set the min- Parameters:
v- value
-
setMax
public void setMax(int v) Set the max- Parameters:
v- value
-
asArray
public double[] asArray()Get a 2-aray array holding min/max- Returns:
- array of min and max
-
asFloatArray
public float[] asFloatArray()Get a 2-aray array holding min/max- Returns:
- array of min and max
-
span
public double span()max-min- Returns:
- max-min
-
getSpan
public double getSpan()max-min- Returns:
- max-min
-
getAbsSpan
public double getAbsSpan()get abs(max-min)- Returns:
- abs(max-min)
-
getMid
public double getMid()Get the mid point- Returns:
- mid point
-
getMidInt
public int getMidInt()Get the int value of mid point- Returns:
- int value of mid point
-
getValueOfPercent
public double getValueOfPercent(double percent) Get percent along the way between min and max- Parameters:
percent- percent- Returns:
- value
-
getPercent
public double getPercent(double v) Ge tthe percent the given value is between min and max- Parameters:
v- value- Returns:
- percent
-
setName
Set the Name property.- Parameters:
value- The new value for Name
-
getName
Get the Name property.- Returns:
- The Name
-
toString
to string
-