|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pmease.quickbuild.plugin.report.engine.util.quantity.Amount<T,U>
T - the type of number the amount value is expressed inU - the type of unit that this amount quantifiespublic abstract class Amount<T extends java.lang.Number & java.lang.Comparable<T>,U extends Unit<U>>
Represents a value in a unit system and facilitates unambiguous communication
of amounts. Instances are created via static factory of(...) methods.
| Method Summary | ||
|---|---|---|
T |
as(U unit)
|
|
int |
compareTo(Amount<T,U> other)
|
|
boolean |
equals(java.lang.Object obj)
|
|
U |
getUnit()
|
|
T |
getValue()
|
|
int |
hashCode()
|
|
static
|
of(double number,
U unit)
Creates an amount that uses a double value. |
|
static
|
of(float number,
U unit)
Creates an amount that uses a float value. |
|
static
|
of(int number,
U unit)
Creates an amount that uses an int value. |
|
static
|
of(long number,
U unit)
Creates an amount that uses a long value. |
|
protected abstract T |
scale(double multiplier)
|
|
java.lang.String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public T getValue()
public U getUnit()
public T as(U unit)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Amount<T,U> other)
compareTo in interface java.lang.Comparable<Amount<T extends java.lang.Number & java.lang.Comparable<T>,U extends Unit<U>>>protected abstract T scale(double multiplier)
public static <U extends Unit<U>> Amount<java.lang.Double,U> of(double number,
U unit)
double value.
U - the type of unit that the returned amount quantifiesnumber - the number of units the returned amount should quantifyunit - the unit the returned amount is expressed in terms of
number of units
public static <U extends Unit<U>> Amount<java.lang.Float,U> of(float number,
U unit)
float value.
U - the type of unit that the returned amount quantifiesnumber - the number of units the returned amount should quantifyunit - the unit the returned amount is expressed in terms of
number of units
public static <U extends Unit<U>> Amount<java.lang.Long,U> of(long number,
U unit)
long value.
U - the type of unit that the returned amount quantifiesnumber - the number of units the returned amount should quantifyunit - the unit the returned amount is expressed in terms of
number of units
public static <U extends Unit<U>> Amount<java.lang.Integer,U> of(int number,
U unit)
int value.
U - the type of unit that the returned amount quantifiesnumber - the number of units the returned amount should quantifyunit - the unit the returned amount is expressed in terms of
number of units
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||