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-01-18 00:35:01 +0100 (Fri, 18 Jan 2019) $, @version $Revision: 324 $, by $Author: averbraeck $,
initial version Sep 5, 2015
si
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
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
DIV, MULT, POW
public Money(double value, MoneyUnit unit)
value
- double; double valueunit
- MoneyUnit; unit for the double valuepublic Money(Money value)
value
- Money; 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
- Money; the low valueone
- Money; the high valueratio
- double; the ratio between 0 and 1, inclusivepublic static Money max(Money r1, Money r2)
r1
- Money; the first scalarr2
- Money; the second scalarpublic static Money max(Money r1, Money r2, Money... rn)
r1
- Money; the first scalarr2
- Money; the second scalarrn
- Money...; the other scalarspublic static Money min(Money r1, Money r2)
r1
- Money; the first scalarr2
- Money; the second scalarpublic static Money min(Money r1, Money r2, Money... rn)
r1
- Money; the first scalarr2
- Money; the second scalarrn
- Money...; the other scalarspublic final Dimensionless divideBy(Money v)
v
- Money; Money scalarpublic final MoneyPerArea divideBy(Area v)
v
- Area; Money scalarpublic final MoneyPerEnergy divideBy(Energy v)
v
- Energy; Money scalarpublic final MoneyPerLength divideBy(Length v)
v
- Length; Money scalarpublic final MoneyPerLength multiplyBy(LinearDensity v)
v
- LinearDensity; Money scalarpublic final MoneyPerMass divideBy(Mass v)
v
- Mass; Money scalarpublic final MoneyPerDuration divideBy(Duration v)
v
- Duration; Money scalarpublic final MoneyPerDuration multiplyBy(Frequency v)
v
- Frequency; Money scalarpublic final MoneyPerVolume divideBy(Volume v)
v
- Volume; Money scalarCopyright © 2015–2019 Delft University of Technology. All rights reserved.