com.ds.fw.types.money
Class FwMoney

java.lang.Object
  |
  +--com.ds.fw.types.FwSimpleObject
        |
        +--com.ds.fw.types.money.FwMoney
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, FwCopyableIF, FwDisplayableIF, FwMoneyIF, FwSimpleObjectIF, java.io.Serializable

public class FwMoney
extends FwSimpleObject
implements FwMoneyIF

See Also:
Serialized Form

Field Summary
 com.ds.fw.types.money.FwCurrency _currency
           
 double _value
           
 
Constructor Summary
FwMoney()
           
 
Method Summary
 com.ds.fw.types.money.FwMoneyIF add(com.ds.fw.types.money.FwMoneyIF m)
          Adds value
 void addInPlace(com.ds.fw.types.money.FwMoneyIF m)
          Adds some value to the current value of the variable _value
 boolean allowsCopy()
           
 int compareTo(java.lang.Object e)
          Compares this FwMoney object to another Object.
 double convertPrice(com.ds.fw.types.money.FwCurrency targetCur)
           
static com.ds.fw.types.money.FwMoneyIF createMoney(double d)
          Creates a FwMoney object from a given double value
static com.ds.fw.types.money.FwMoneyIF createMoney(java.lang.String s)
          Creates a FwMoney object from some value (given as String) Converts the String to double value
 com.ds.fw.types.money.FwMoneyIF divideBy(double d)
          Divide the value of the variable _value with the double given as parameter
 void divideByInPlace(double d)
          Divide some value from the current value of variable _value
 boolean equals(java.lang.Object o)
          Verify if the this FwMoney object is equals to the object , given as parameter
 com.ds.fw.types.money.FwCurrency getCurrency()
           
 double getDoubleValue()
          Gets the value of the variable _value as double
 int getIntValue()
          Gets the value of the variable _value as int
 com.ds.fw.types.money.FwMoneyIF getMoneyCopy()
           
 boolean isGreaterThan(com.ds.fw.types.money.FwMoneyIF m)
          Verify if the value of the variable _value is greater than the value of the variable _value of the parameter m
 boolean isLessThan(com.ds.fw.types.money.FwMoneyIF m)
          Verify if the value of the variable _value is less than the value of the variable _value of the parameter m
 boolean isNegative()
          Verify if the value of the variable _value is negative
 boolean isPositive()
          Verify if the value of the variable _value is positive
 boolean isZero()
          Verify if the value of the variable _value() is equals to zero
 com.ds.fw.types.money.FwMoneyIF multiplyBy(double d)
          Multiply the value of the variable _value with the double given as parameter
 void multiplyByInPlace(double d)
          Multiply the value of the variable _value with the double , given as parameter
 void setCurrency(com.ds.fw.types.money.FwCurrency c)
           
 void setCurrency1(com.ds.fw.types.money.FwCurrency c)
           
 void setValue(double d)
          Sets the value of the variable _value
 void setValue(com.ds.fw.types.money.FwMoneyIF m)
          Sets the value of the variable _value
 void setValue(int i)
          Sets the value of the variable _value
 void setValue(java.lang.String s)
          Sets the value of the variable _value
 com.ds.fw.types.money.FwMoneyIF subtract(com.ds.fw.types.money.FwMoneyIF m)
          Substracts a value
 void subtractInPlace(com.ds.fw.types.money.FwMoneyIF m)
          Substract some value from the current value of the variable _value
 java.lang.String toStringValue()
          Get the string form of the object's value.
 
Methods inherited from class com.ds.fw.types.FwSimpleObject
getClassName, getClone, getCopy, getCopy, getDeepCopy, getDisplayString, getDisplayStringFor, postCopy, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ds.fw.types.FwSimpleObjectIF
getClassName, getClone, getCopy, getCopy, getDeepCopy, getDisplayString, getDisplayStringFor, postCopy, toString
 

Field Detail

_value

public double _value

_currency

public com.ds.fw.types.money.FwCurrency _currency
Constructor Detail

FwMoney

public FwMoney()
Method Detail

createMoney

public static com.ds.fw.types.money.FwMoneyIF createMoney(double d)
Creates a FwMoney object from a given double value

Parameters:
d - - a double value
Returns:

createMoney

public static com.ds.fw.types.money.FwMoneyIF createMoney(java.lang.String s)
Creates a FwMoney object from some value (given as String) Converts the String to double value

Parameters:
s -
Returns:

equals

public boolean equals(java.lang.Object o)
Verify if the this FwMoney object is equals to the object , given as parameter

Overrides:
equals in class java.lang.Object
Parameters:
o - - the reference object with which to compare
Returns:
true if the two objects are equals

isLessThan

public boolean isLessThan(com.ds.fw.types.money.FwMoneyIF m)
Verify if the value of the variable _value is less than the value of the variable _value of the parameter m

Specified by:
isLessThan in interface FwMoneyIF
Parameters:
m -
Returns:
true if the value of _value is less than this of the parameter m

isGreaterThan

public boolean isGreaterThan(com.ds.fw.types.money.FwMoneyIF m)
Verify if the value of the variable _value is greater than the value of the variable _value of the parameter m

Specified by:
isGreaterThan in interface FwMoneyIF
Parameters:
m -
Returns:
true if the value of _value is greater than this of the parameter m

compareTo

public int compareTo(java.lang.Object e)
Compares this FwMoney object to another Object. The Object is a FwMoney

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
e - - the object to be compared
Returns:
the value 0 if the argument Object, cast to FwMoneyIF is equal to this FwMoney object; a value -1 if this FwMoney object is numerically less than the argument; and a value 1 FwMoney is numerically greater than the argument .

isZero

public boolean isZero()
Verify if the value of the variable _value() is equals to zero

Specified by:
isZero in interface FwMoneyIF
Returns:
true if it is equals to zero, false - otherwise

isPositive

public boolean isPositive()
Verify if the value of the variable _value is positive

Specified by:
isPositive in interface FwMoneyIF
Returns:
true if it is positive , false - otherwise

isNegative

public boolean isNegative()
Verify if the value of the variable _value is negative

Specified by:
isNegative in interface FwMoneyIF
Returns:
true if it is negative , false - otherwise

setValue

public void setValue(com.ds.fw.types.money.FwMoneyIF m)
Sets the value of the variable _value

Specified by:
setValue in interface FwMoneyIF
Parameters:
m -

setValue

public void setValue(int i)
Sets the value of the variable _value

Specified by:
setValue in interface FwMoneyIF
Parameters:
i - - the new value

setValue

public void setValue(double d)
Sets the value of the variable _value

Specified by:
setValue in interface FwMoneyIF
Parameters:
d - - the new value

setValue

public void setValue(java.lang.String s)
Sets the value of the variable _value

Specified by:
setValue in interface FwMoneyIF
Parameters:
s - - the new value, given as string , if the string connot be parsed the value of _value is set to zero

getIntValue

public int getIntValue()
Gets the value of the variable _value as int

Specified by:
getIntValue in interface FwMoneyIF
Returns:
the int value of the variable _value

getDoubleValue

public double getDoubleValue()
Gets the value of the variable _value as double

Specified by:
getDoubleValue in interface FwMoneyIF
Returns:
the double value of the variable _value

add

public com.ds.fw.types.money.FwMoneyIF add(com.ds.fw.types.money.FwMoneyIF m)
Adds value

Specified by:
add in interface FwMoneyIF
Parameters:
m -
Returns:

subtract

public com.ds.fw.types.money.FwMoneyIF subtract(com.ds.fw.types.money.FwMoneyIF m)
Substracts a value

Specified by:
subtract in interface FwMoneyIF
Parameters:
m -
Returns:

multiplyBy

public com.ds.fw.types.money.FwMoneyIF multiplyBy(double d)
Multiply the value of the variable _value with the double given as parameter

Specified by:
multiplyBy in interface FwMoneyIF
Parameters:
d - - the double value
Returns:

divideBy

public com.ds.fw.types.money.FwMoneyIF divideBy(double d)
Divide the value of the variable _value with the double given as parameter

Specified by:
divideBy in interface FwMoneyIF
Parameters:
d - - a double value
Returns:

addInPlace

public void addInPlace(com.ds.fw.types.money.FwMoneyIF m)
Adds some value to the current value of the variable _value

Specified by:
addInPlace in interface FwMoneyIF
Parameters:
m -

subtractInPlace

public void subtractInPlace(com.ds.fw.types.money.FwMoneyIF m)
Substract some value from the current value of the variable _value

Specified by:
subtractInPlace in interface FwMoneyIF
Parameters:
m -

multiplyByInPlace

public void multiplyByInPlace(double d)
Multiply the value of the variable _value with the double , given as parameter

Specified by:
multiplyByInPlace in interface FwMoneyIF
Parameters:
d - - a double

divideByInPlace

public void divideByInPlace(double d)
Divide some value from the current value of variable _value

Specified by:
divideByInPlace in interface FwMoneyIF
Parameters:
d - - a double

allowsCopy

public boolean allowsCopy()

getMoneyCopy

public com.ds.fw.types.money.FwMoneyIF getMoneyCopy()
Specified by:
getMoneyCopy in interface FwMoneyIF

toStringValue

public java.lang.String toStringValue()
Description copied from interface: FwDisplayableIF
Get the string form of the object's value. This string should not include the class name. The string should be one line and relatively short. Null is returned if there is not meaningful value for this instance. If the value is non-null it should be included in the toString result.

Specified by:
toStringValue in interface FwSimpleObjectIF
Overrides:
toStringValue in class FwSimpleObject

getCurrency

public com.ds.fw.types.money.FwCurrency getCurrency()
Specified by:
getCurrency in interface FwMoneyIF

setCurrency

public void setCurrency(com.ds.fw.types.money.FwCurrency c)
Specified by:
setCurrency in interface FwMoneyIF

setCurrency1

public void setCurrency1(com.ds.fw.types.money.FwCurrency c)
Specified by:
setCurrency1 in interface FwMoneyIF

convertPrice

public double convertPrice(com.ds.fw.types.money.FwCurrency targetCur)
Specified by:
convertPrice in interface FwMoneyIF