public class NumericVariable extends SimpleVariable
Variable
who's values is a number with possibly minimum and
maximum values.Constructor and Description |
---|
NumericVariable(java.lang.Number value)
creates a numeric variable with an initial value.
|
NumericVariable(java.lang.Number value,
java.lang.Number minValue,
java.lang.Number maxValue)
creates a numeric variable with an initial value plus minimum and maximum
values.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
returns the numeric value as (possibly rounded or truncated) byte.
|
double |
doubleValue()
returns the numeric value as double.
|
float |
floatValue()
returns the numeric value as (possibly rounded or truncated) flpat.
|
int |
intValue()
returns the numeric value as (possibly rounded or truncated) int.
|
long |
longValue()
returns the numeric value as (possibly rounded or truncated) long.
|
short |
shortValue()
returns the numeric value as (possibly rounded or truncated) short.
|
void |
validate(java.lang.Object object)
validates the
value . |
getValue, setValidator, setValue
addObserver, clone, fireChangeEvent, removeObserver
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addObserver, clone, fireChangeEvent, removeObserver
public NumericVariable(java.lang.Number value)
value
- the initial valuepublic NumericVariable(java.lang.Number value, java.lang.Number minValue, java.lang.Number maxValue)
value
- the initial valueminValue
- the minimum valuemaxValue
- the maximum valuepublic void validate(java.lang.Object object)
SimpleVariable
value
.
Validates the value by calling Validator.validate(Object)
if the
validator has been set by SimpleVariable.setValidator(Validator)
, else
validates against list of valid values if a list of valid values was
passed to the variable constructor.
validate
in interface Variable
validate
in class SimpleVariable
object
- the value to validatepublic byte byteValue()
public short shortValue()
public int intValue()
public long longValue()
public float floatValue()
public double doubleValue()