org.salespointframework.core.data
Class DoubleValue

java.lang.Object
  extended by org.salespointframework.core.data.NumberValue
      extended by org.salespointframework.core.data.DoubleValue
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Value>, Value

public class DoubleValue
extends NumberValue

A NumberValue that is based on a Double object.

All operations are implemented as one might expect.

Since:
v2.0
Version:
2.0 19/08/1999
Author:
Steffen Zschaler

Constructor Summary
DoubleValue(double dlValue)
          Create a new DoubleValue.
DoubleValue(java.lang.Number nbValue)
          Create a new DoubleValue.
 
Method Summary
 Value add(Value v)
          Add the given value to this one, and return the result.
 void addAccumulating(Value v)
          Add the given value to this one, changing this value.
 java.lang.Object clone()
          Clone this value.
 int compareTo(Value v)
          Compare this value to the given one.
 Value divide(Value v)
          Divide this value by the given one, and return the result.
 void divideAccumulating(Value v)
          Divide this value by the given one, changing this value.
 boolean isAddZero()
          Correctly checks getValue().doubleValue().
 boolean isMulOne()
          Correctly checks getValue().doubleValue().
 Value multiply(double dl)
          Multiply this value by the given 'scalar', and return the result.
 Value multiply(float fl)
          Multiply this value by the given 'scalar', and return the result.
 Value multiply(int n)
          Multiply this value by the given 'scalar', and return the result.
 Value multiply(long l)
          Multiply this value by the given 'scalar', and return the result.
 Value multiply(Value v)
          Multiply this value by the given one, and return the result.
 void multiplyAccumulating(double dl)
          Multiply this value by the given 'scalar', changing this value.
 void multiplyAccumulating(float fl)
          Multiply this value by the given 'scalar', changing this value.
 void multiplyAccumulating(int n)
          Multiply this value by the given 'scalar', changing this value.
 void multiplyAccumulating(long l)
          Multiply this value by the given 'scalar', changing this value.
 void multiplyAccumulating(Value v)
          Multiply the given value by this one, changing this value.
 void setValue(java.lang.Number nbValue)
          Convert the given value to a Double before setting the actual value of the object.
 Value subtract(Value v)
          Subtract the given value from this one, and return the result.
 void subtractAccumulating(Value v)
          Subtract the given value from this one, changing this value.
 
Methods inherited from class org.salespointframework.core.data.NumberValue
getValue, isGreaterZero, isLessZero, isMulZero, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleValue

public DoubleValue(java.lang.Number nbValue)
Create a new DoubleValue.

Parameters:
nbValue - the initial value of the object. Will be converted to a Double.

DoubleValue

public DoubleValue(double dlValue)
Create a new DoubleValue.

Parameters:
dlValue - the initial value of the object.
Method Detail

setValue

public void setValue(java.lang.Number nbValue)
Convert the given value to a Double before setting the actual value of the object.

Overrides:
setValue in class NumberValue
Parameters:
nbValue - the new actual value.

addAccumulating

public void addAccumulating(Value v)
Description copied from interface: Value
Add the given value to this one, changing this value.

Parameters:
v - the value to be added.

subtractAccumulating

public void subtractAccumulating(Value v)
Description copied from interface: Value
Subtract the given value from this one, changing this value.

Parameters:
v - the value to be subtracted.

multiplyAccumulating

public void multiplyAccumulating(Value v)
Description copied from interface: Value
Multiply the given value by this one, changing this value.

Parameters:
v - the value to be multplied by.

multiplyAccumulating

public void multiplyAccumulating(double dl)
Description copied from interface: Value
Multiply this value by the given 'scalar', changing this value.

Parameters:
dl - the value by which to multiply.

multiplyAccumulating

public void multiplyAccumulating(float fl)
Description copied from interface: Value
Multiply this value by the given 'scalar', changing this value.

Parameters:
fl - the value by which to multiply.

multiplyAccumulating

public void multiplyAccumulating(long l)
Description copied from interface: Value
Multiply this value by the given 'scalar', changing this value.

Parameters:
l - the value by which to multiply.

multiplyAccumulating

public void multiplyAccumulating(int n)
Description copied from interface: Value
Multiply this value by the given 'scalar', changing this value.

Parameters:
n - the value by which to multiply.

divideAccumulating

public void divideAccumulating(Value v)
Description copied from interface: Value
Divide this value by the given one, changing this value.

Parameters:
v - the value by which to divide.

add

public Value add(Value v)
Description copied from interface: Value
Add the given value to this one, and return the result.

Parameters:
v - the value to be added.

subtract

public Value subtract(Value v)
Description copied from interface: Value
Subtract the given value from this one, and return the result.

Parameters:
v - the value to be subtracted.

multiply

public Value multiply(Value v)
Description copied from interface: Value
Multiply this value by the given one, and return the result.

Parameters:
v - the value by which to multiply.

multiply

public Value multiply(double dl)
Description copied from interface: Value
Multiply this value by the given 'scalar', and return the result.

Parameters:
dl - the 'scalar' by which to multiply.

multiply

public Value multiply(float fl)
Description copied from interface: Value
Multiply this value by the given 'scalar', and return the result.

Parameters:
fl - the 'scalar' by which to multiply.

multiply

public Value multiply(long l)
Description copied from interface: Value
Multiply this value by the given 'scalar', and return the result.

Parameters:
l - the 'scalar' by which to multiply.

multiply

public Value multiply(int n)
Description copied from interface: Value
Multiply this value by the given 'scalar', and return the result.

Parameters:
n - the 'scalar' by which to multiply.

divide

public Value divide(Value v)
Description copied from interface: Value
Divide this value by the given one, and return the result.

Parameters:
v - the value by which to divide.

compareTo

public int compareTo(Value v)
Compare this value to the given one.

Throws:
java.lang.ClassCastException - if the given object cannot be casted into a NumberValue.

clone

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

Specified by:
clone in interface Value
Specified by:
clone in class NumberValue

isAddZero

public boolean isAddZero()
Correctly checks getValue().doubleValue().

Specified by:
isAddZero in interface Value
Overrides:
isAddZero in class NumberValue
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))).

isMulOne

public boolean isMulOne()
Correctly checks getValue().doubleValue().

Specified by:
isMulOne in interface Value
Overrides:
isMulOne in class NumberValue
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))).