SalesPoint v3.3 API

data
Class NumberValue

java.lang.Object
  extended by data.NumberValue
All Implemented Interfaces:
Value, Serializable, Cloneable, Comparable<Value>
Direct Known Subclasses:
DoubleValue, IntegerValue

public abstract class NumberValue
extends Object
implements Value

Values that operate on numbers.

All the operations are implemented as you would expect, the implementation is given in concrete subclasses.

Since:
v2.0
Author:
Steffen Zschaler
See Also:
Serialized Form

Constructor Summary
NumberValue(Number nbValue)
          Create a new NumberValue.
 
Method Summary
abstract  Object clone()
          Clone this value.
 Number getValue()
          Get the actual value of the object.
 boolean isAddZero()
          Check whether this is the zero element with respect to addition.
 boolean isGreaterZero()
           
 boolean isLessZero()
           
 boolean isMulOne()
          Check whether this is the one element with respect to multiplication.
 boolean isMulZero()
          Check whether this is the zero element with respect to multiplication.
 void setValue(Number nbValue)
          Set the actual value of the object.
 String toString()
          Return a String representation of the object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface data.Value
add, addAccumulating, divide, divideAccumulating, multiply, multiply, multiply, multiply, multiply, multiplyAccumulating, multiplyAccumulating, multiplyAccumulating, multiplyAccumulating, multiplyAccumulating, subtract, subtractAccumulating
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

NumberValue

public NumberValue(Number nbValue)
Create a new NumberValue.

Parameters:
nbValue - the actual initial value.
Method Detail

setValue

public void setValue(Number nbValue)
Set the actual value of the object.

Parameters:
nbValue - the new actual value.
Override:
Sometimes Override if you want to impose restrictions on the class of the actual value.

getValue

public Number getValue()
Get the actual value of the object.

Override:
Never

isAddZero

public boolean isAddZero()
Description copied from interface: Value
Check whether this is the zero element with respect to addition.

Specified by:
isAddZero in interface Value
Returns:
true if this is the zero element with respect to addition, i.e. if for any value v: (v.getClass() == this.getClass()) -> ((v.add (this).equals (v)) && (this.add (v).equals (v))).
Override:
Sometimes The default implementation returns
 (getValue().longValue() == 0)
 

isGreaterZero

public boolean isGreaterZero()
Override:
Sometimes The default implementation returns
 (getValue().longValue() > 0)
 

isLessZero

public boolean isLessZero()
Override:
Sometimes The default implementation returns
 (getValue().longValue() <= 0)
 

isMulZero

public boolean isMulZero()
Description copied from interface: Value
Check whether this is the zero element with respect to multiplication.

Specified by:
isMulZero in interface Value
Returns:
true if this is the zero element with respect to multiplication, i.e. if for any value v: (v.getClass() == this.getClass()) -> ((v.multiply (this).equals (this)) && (this.multiply (v).equals (this))).
Override:
Sometimes The default implementation returns
 isAddZero()
 

isMulOne

public boolean isMulOne()
Description copied from interface: Value
Check whether this is the one element with respect to multiplication.

Specified by:
isMulOne in interface Value
Returns:
true if this is the one element with respect to multiplication, i.e. if for any value v: (v.getClass() == this.getClass()) -> ((v.multiply (this).equals (v)) && (this.multiply (v).equals (v))).
Override:
Sometimes The default implementation returns
 (getValue().longValue() == 1)
 

clone

public abstract Object clone()
Description copied from interface: Value
Clone this value.

Specified by:
clone in interface Value
Overrides:
clone in class Object
Override:
Always

toString

public String toString()
Return a String representation of the object.

Overrides:
toString in class Object
Override:
Sometimes The default implementation returns
 getValue().toString()
 

SalesPoint v3.3 API