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

Constructor Index

 o NumberValueHolder(Number)
Construct an instance with an initial Number.
 o NumberValueHolder(int)
Construct an instance with an initial int.
 o NumberValueHolder(long)
Construct an instance with an initial long.
 o NumberValueHolder(float)
Construct an instance with an initial float.
 o NumberValueHolder(double)
Construct an instance with an initial double.

Method Index

 o doubleValue()
Get the value as a double.
 o floatValue()
Get the value as an float.
 o getNumberValue()
Get the value as an instance of Number.
 o intValue()
Get the value as an int.
 o longValue()
Get the value as an long.
 o setValue(int)
Set the value as an int.
 o setValue(long)
Set the value as a long.
 o setValue(float)
Set the value as a float.
 o setValue(double)
Set the value as a double.

Constructors

 o NumberValueHolder
  public NumberValueHolder(Number initValue)
Construct an instance with an initial Number.
Parameters:
initValue - the initial value
 o NumberValueHolder
  public NumberValueHolder(int initValue)
Construct an instance with an initial int.
Parameters:
initValue - the initial value
 o NumberValueHolder
  public NumberValueHolder(long initValue)
Construct an instance with an initial long.
Parameters:
initValue - the initial value
 o NumberValueHolder
  public NumberValueHolder(float initValue)
Construct an instance with an initial float.
Parameters:
initValue - the initial value
 o NumberValueHolder
  public NumberValueHolder(double initValue)
Construct an instance with an initial double.
Parameters:
initValue - the initial value

Methods

 o getNumberValue
  public Number getNumberValue()
Get the value as an instance of Number.
Returns:
the current value, which is cast to a Number
 o intValue
  public int intValue()
Get the value as an int.
Returns:
the current value as an int
 o longValue
  public long longValue()
Get the value as an long.
Returns:
the current value as a long
 o floatValue
  public float floatValue()
Get the value as an float.
Returns:
the current value as a float
 o doubleValue
  public double doubleValue()
Get the value as a double.
Returns:
the current value as a double
 o setValue
  public void setValue(int newValue)
Set the value as an int.
Parameters:
newValue - the new value to set
 o setValue
  public void setValue(long newValue)
Set the value as a long.
Parameters:
newValue - the new value to set
 o setValue
  public void setValue(float newValue)
Set the value as a float.
Parameters:
newValue - the new value to set
 o 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