SalesPoint v3.3 API

data
Class DoubleValue

java.lang.Object
  extended by data.NumberValue
      extended by data.DoubleValue
All Implemented Interfaces:
Value, Serializable, Cloneable, Comparable<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
Author:
Steffen Zschaler
See Also:
Serialized Form

Constructor Summary
DoubleValue(double dlValue)
          Create a new DoubleValue.
DoubleValue(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.
 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(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 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(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(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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

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.
Override:
Never

compareTo

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

Throws:
ClassCastException - if the given object cannot be casted into a NumberValue.
Override:
Never

clone

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

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

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))).
Override:
Never

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))).
Override:
Never

SalesPoint v3.3 API