public class Money extends AbstractDoubleScalarRel<MoneyUnit,Money>
DoubleScalar.Rel<MoneyUnit> value = new DoubleScalar.Rel<MoneyUnit>(100.0, MoneyUnit.SI);we can now write:
Money value = new Money(100.0, MoneyUnit.SI);The compiler will automatically recognize which units belong to which quantity, and whether the quantity type and the unit used are compatible.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
$LastChangedDate: 2019-02-27 23:44:43 +0100 (Wed, 27 Feb 2019) $, @version $Revision: 333 $, by $Author: averbraeck $,
initial version Sep 5, 2015
si
NUMBER_PATTERN
Constructor and Description |
---|
Money(double value,
MoneyUnit unit)
Construct Money scalar.
|
Money(Money value)
Construct Money scalar.
|
Modifier and Type | Method and Description |
---|---|
MoneyPerArea |
divideBy(Area v)
Calculate the division of Money and Area, which results in a MoneyPerArea scalar.
|
MoneyPerDuration |
divideBy(Duration v)
Calculate the division of Money and Duration, which results in a MoneyPerDuration scalar.
|
MoneyPerEnergy |
divideBy(Energy v)
Calculate the division of Money and Energy, which results in a MoneyPerEnergy scalar.
|
MoneyPerLength |
divideBy(Length v)
Calculate the division of Money and Length, which results in a MoneyPerLength scalar.
|
MoneyPerMass |
divideBy(Mass v)
Calculate the division of Money and Mass, which results in a MoneyPerMass scalar.
|
Dimensionless |
divideBy(Money v)
Calculate the division of Money and Money, which results in a Dimensionless scalar.
|
MoneyPerVolume |
divideBy(Volume v)
Calculate the division of Money and Volume, which results in a MoneyPerVolume scalar.
|
Money |
instantiateRel(double value,
MoneyUnit unit)
Construct a new Relative Immutable DoubleScalar of the right type.
|
static Money |
interpolate(Money zero,
Money one,
double ratio)
Interpolate between two values.
|
static Money |
max(Money r1,
Money r2)
Return the maximum value of two monetary scalars.
|
static Money |
max(Money r1,
Money r2,
Money... rn)
Return the maximum value of more than two monetary scalars.
|
static Money |
min(Money r1,
Money r2)
Return the minimum value of two monetary scalars.
|
static Money |
min(Money r1,
Money r2,
Money... rn)
Return the minimum value of more than two monetary scalars.
|
MoneyPerDuration |
multiplyBy(Frequency v)
Calculate the multiplication of Money and Frequency, which results in a MoneyPerDuration scalar.
|
MoneyPerLength |
multiplyBy(LinearDensity v)
Calculate the multiplication of Money and LinearDensity, which results in a MoneyPerLength scalar.
|
abs, ceil, divideBy, floor, minus, multiplyBy, neg, plus, rint, round
compareTo, doubleValue, eq, eq0, equals, floatValue, ge, ge0, getInUnit, getInUnit, getSI, gt, gt0, hashCode, intValue, le, le0, longValue, lt, lt0, ne, ne0, toString, toString, toString, toString
expressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelative, setDisplayUnit, stringOf, stringOfDefaultLocale, textualStringOf, textualStringOfDefaultLocale
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
DIV, MULT, POW
public Money(double value, MoneyUnit unit)
value
- double valueunit
- unit for the double valuepublic Money(Money value)
value
- Scalar from which to construct this instancepublic final Money instantiateRel(double value, MoneyUnit unit)
instantiateRel
in class AbstractDoubleScalarRel<MoneyUnit,Money>
value
- double; the double valueunit
- U; the unitpublic static Money interpolate(Money zero, Money one, double ratio)
zero
- the low valueone
- the high valueratio
- the ratio between 0 and 1, inclusivepublic static Money max(Money r1, Money r2)
r1
- the first scalarr2
- the second scalarpublic static Money max(Money r1, Money r2, Money... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic static Money min(Money r1, Money r2)
r1
- the first scalarr2
- the second scalarpublic static Money min(Money r1, Money r2, Money... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic final Dimensionless divideBy(Money v)
v
- Money scalarpublic final MoneyPerArea divideBy(Area v)
v
- Money scalarpublic final MoneyPerEnergy divideBy(Energy v)
v
- Money scalarpublic final MoneyPerLength divideBy(Length v)
v
- Money scalarpublic final MoneyPerLength multiplyBy(LinearDensity v)
v
- Money scalarpublic final MoneyPerMass divideBy(Mass v)
v
- Money scalarpublic final MoneyPerDuration divideBy(Duration v)
v
- Money scalarpublic final MoneyPerDuration multiplyBy(Frequency v)
v
- Money scalarpublic final MoneyPerVolume divideBy(Volume v)
v
- Money scalarCopyright © 2015–2019 Delft University of Technology. All rights reserved.