Class com.bdnm.mvc.NumberValueHolder
All Packages Class Hierarchy This Package Previous Next Index
Class com.bdnm.mvc.NumberValueHolder
java.lang.Object
|
+----java.util.Observable
|
+----com.bdnm.mvc.ValueModel
|
+----com.bdnm.mvc.ValueHolder
|
+----com.bdnm.mvc.NumberValueHolder
- public class NumberValueHolder
- extends ValueHolder
This class represents a holder on a number.
It implements the Valuable interface, so you
can set and get this value. In addition, it
is an Observable so you can share this instance
between any number of Observers. The argument
that is sent in an update is the new value, as
a Number.
This class is just like ValueHolder expect it
defines a number of convenience methods for
dealing with numerics (non-objects). It can
handle ints, longs, doubles, and floats.
- See Also:
- Number
-
NumberValueHolder(Number)
- Construct an instance with an initial Number.
-
NumberValueHolder(int)
- Construct an instance with an initial int.
-
NumberValueHolder(long)
- Construct an instance with an initial long.
-
NumberValueHolder(float)
- Construct an instance with an initial float.
-
NumberValueHolder(double)
- Construct an instance with an initial double.
-
doubleValue()
- Get the value as a double.
-
floatValue()
- Get the value as an float.
-
getNumberValue()
- Get the value as an instance of Number.
-
intValue()
- Get the value as an int.
-
longValue()
- Get the value as an long.
-
setValue(int)
- Set the value as an int.
-
setValue(long)
- Set the value as a long.
-
setValue(float)
- Set the value as a float.
-
setValue(double)
- Set the value as a double.
NumberValueHolder
public NumberValueHolder(Number initValue)
- Construct an instance with an initial Number.
- Parameters:
- initValue - the initial value
NumberValueHolder
public NumberValueHolder(int initValue)
- Construct an instance with an initial int.
- Parameters:
- initValue - the initial value
NumberValueHolder
public NumberValueHolder(long initValue)
- Construct an instance with an initial long.
- Parameters:
- initValue - the initial value
NumberValueHolder
public NumberValueHolder(float initValue)
- Construct an instance with an initial float.
- Parameters:
- initValue - the initial value
NumberValueHolder
public NumberValueHolder(double initValue)
- Construct an instance with an initial double.
- Parameters:
- initValue - the initial value
getNumberValue
public Number getNumberValue()
- Get the value as an instance of Number.
- Returns:
- the current value, which is cast to a Number
intValue
public int intValue()
- Get the value as an int.
- Returns:
- the current value as an int
longValue
public long longValue()
- Get the value as an long.
- Returns:
- the current value as a long
floatValue
public float floatValue()
- Get the value as an float.
- Returns:
- the current value as a float
doubleValue
public double doubleValue()
- Get the value as a double.
- Returns:
- the current value as a double
setValue
public void setValue(int newValue)
- Set the value as an int.
- Parameters:
- newValue - the new value to set
setValue
public void setValue(long newValue)
- Set the value as a long.
- Parameters:
- newValue - the new value to set
setValue
public void setValue(float newValue)
- Set the value as a float.
- Parameters:
- newValue - the new value to set
setValue
public void setValue(double newValue)
- Set the value as a double.
- Parameters:
- newValue - the new value to set
All Packages Class Hierarchy This Package Previous Next Index