|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
ch.rgw.tools.Money
public class Money
A class representing Money (as you might have guessed) Simplifies and standardizes calculations with money (rounding, converting to and from strings etc.) The accepted formats of the string representation of an amount depends on the current locale by default the format of can be set to another locale if necessary (globally) The term "Amount" means here always the x.xx form of Money
Nested Class Summary | |
---|---|
static class |
Money.C
|
Constructor Summary | |
---|---|
Money()
Create empty Money |
|
Money(double amount)
Create Money with a specified amount |
|
Money(int cent)
Create Money with some cents |
|
Money(Money money)
Double your wealth |
|
Money(java.lang.String val)
Create Money with a specified amount as String This might fail if the string doesn't conform to the current locale's standard currency format |
Method Summary | |
---|---|
void |
addAmount(double amount)
Add some money as x.xx |
void |
addAmount(java.lang.String amount)
Add some money as "x.xx" |
void |
addCent(int cents)
Add some cents |
void |
addCent(java.lang.String cents)
Add some cents |
Money |
addMoney(Money money)
Add even more (or less) Money |
static java.lang.Number |
checkInput(java.lang.String rawValue)
Parse an amount given as string This might fail if the string doesn't conform to the current locale's standard currency format. |
int |
compareTo(Money other)
|
Money |
divideBy(double factor)
|
double |
doubleValue()
|
boolean |
equals(java.lang.Object obj)
|
float |
floatValue()
|
double |
getAmount()
return the collected amount as x.xx |
java.lang.String |
getAmountAsString()
return the amount as "x.xx" |
int |
getCents()
Return all the cents (but keep them anyway :-) |
java.lang.String |
getCentsAsString()
return the cents |
Money.C |
getCorrectness()
get the class of correctness this Money might have |
double |
getFrac()
Return what was over or missing after rounding |
java.lang.String |
getFracAsString()
|
static char |
getSeparator()
|
int |
hashCode()
|
int |
intValue()
|
boolean |
isMoreThan(Money other)
|
boolean |
isNegative()
Are you in dept? |
boolean |
isNeglectable()
Is it worth any effort? |
boolean |
isZero()
Are you broke? |
long |
longValue()
|
Money |
multiply(double factor)
Multiply your wealth |
Money |
negate()
Turn wealth into dept and vice versa |
Money |
roundTo5()
Round the collected amount to the nearest 0.05 |
void |
setCorrectness(Money.C correctness)
Declare this Money ist probably not exactly what it seems to be. |
static void |
setLocale(java.util.Locale locale)
Set a different locale for handling Money |
Money |
subtractMoney(Money money)
Reduce your wealth |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Number |
---|
byteValue, shortValue |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Money()
public Money(Money money)
public Money(int cent)
public Money(double amount)
public Money(java.lang.String val) throws java.text.ParseException
java.text.ParseException
Method Detail |
---|
public static java.lang.Number checkInput(java.lang.String rawValue) throws java.text.ParseException
val
- an amount
java.text.ParseException
public void addCent(java.lang.String cents)
public void addCent(int cents)
public void addAmount(double amount)
public void addAmount(java.lang.String amount) throws java.text.ParseException
java.text.ParseException
public Money addMoney(Money money)
public Money subtractMoney(Money money)
public int getCents()
public double getAmount()
public java.lang.String getCentsAsString()
public java.lang.String getAmountAsString()
public Money roundTo5()
public double getFrac()
public java.lang.String getFracAsString()
public Money multiply(double factor)
factor
- public Money divideBy(double factor)
public Money negate()
public boolean isZero()
public boolean isMoreThan(Money other)
public boolean isNegative()
public boolean isNeglectable()
public java.lang.String toString()
toString
in class java.lang.Object
public static void setLocale(java.util.Locale locale)
locale
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Money other)
compareTo
in interface java.lang.Comparable<Money>
public double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public static char getSeparator()
public void setCorrectness(Money.C correctness)
corectness.
- One ofpublic Money.C getCorrectness()
|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |