|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdods.clients.importwizard.TMAP.convert.Convert
public abstract class Convert
An abstract class for conversions between double and String along an axis. The axis will have a range of acceptable values. This package is designed to be hooked up with TextInputFields for region specification on database servers.
Field Summary | |
---|---|
protected static int |
HI
|
protected static int |
LO
|
protected int |
outputStyle
The output style as defined by individual Convert objects. |
protected double[] |
range
The range within which a value is acceptable. |
protected String[] |
recognizedUnits
The strings recognized as valid units. |
protected String |
units
The base units in which all double values will be expressed. |
Constructor Summary | |
---|---|
Convert()
Creates a Convert object. |
Method Summary | |
---|---|
double |
getNearestValue(double val)
Returns the nearest value within the range. |
double |
getNearestValue(double val,
int lo_hi)
Returns the nearest value within the range. |
double[] |
getRange()
Returns the LO [0] and HI [1] values of the range as an array of doubles. |
double |
getRange(int index)
Returns the LO [0] or HI [1] value from the range of acceptable values. |
String |
getUnits()
Returns a String describing the base units. |
double[] |
intersectRange(double val_lo,
double val_hi)
Returns the intersection of the incoming range within the internal range. |
protected double |
rangeTest(double val)
|
void |
setRange(double lo,
double hi)
Sets the valid range for the Convert object. |
void |
setUnits(String u)
Sets the String describing the base units. |
abstract double |
toDouble(String s)
Converts a double value to a String. |
String |
toString()
Prints out the internal properties. |
abstract String |
toString(double val)
Converts a String value to a double. |
protected String |
unitTest(String u)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int LO
protected static final int HI
protected int outputStyle
protected double[] range
This can be used if you have a region of interest and you wish to do bounds checking at the level of the input before passing to value to any other routines.
protected String units
protected String[] recognizedUnits
Constructor Detail |
---|
public Convert()
Method Detail |
---|
public String getUnits()
public void setRange(double lo, double hi) throws IllegalArgumentException
lo
- the lowest acceptable value.hi
- the highest acceptable value.
IllegalArgumentException
public double getRange(int index)
index
- the LO [0] or HI [1] index.
public double[] getRange()
public void setUnits(String u) throws IllegalArgumentException
u
- the string describing the base units.
IllegalArgumentException
- the unit string is not recognized.public abstract double toDouble(String s) throws IllegalArgumentException
abstract
method which makes this class abstract.
string
- the string to be converted.
IllegalArgumentException
public String toString()
toString
in class Object
public abstract String toString(double val) throws IllegalArgumentException
abstract
method which makes this class abstract.
val
- the string to be converted.
IllegalArgumentException
public double getNearestValue(double val)
val
- The value passed in.
public double getNearestValue(double val, int lo_hi)
val
- The value passed in.lo_hi
- which end of the range to return.
public double[] intersectRange(double val_lo, double val_hi) throws IllegalArgumentException
val_lo
- The lo value of the range to be tested.val_hi
- The hi value of the range to be tested.
IllegalArgumentException
- range is outside
the internally defined range.protected double rangeTest(double val) throws IllegalArgumentException
IllegalArgumentException
protected String unitTest(String u) throws IllegalArgumentException
IllegalArgumentException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |