Package com.exedio.cope.pattern
Class Price
java.lang.Object
com.exedio.cope.pattern.Price
- All Implemented Interfaces:
Serializable
,Comparable<Price>
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbigValue()
int
divide
(double other) divide
(double other, RoundingMode roundingMode) double
boolean
boolean
format
(NumberFormat format) getGreater
(Price other) Deprecated.Deprecated.Usemin(Price)
insteadboolean
greaterThan
(Price other) boolean
greaterThanOrEqual
(Price other) boolean
boolean
grossToNetPercent
(int rate) grossToNetPercent
(int rate, RoundingMode roundingMode) grossToTaxPercent
(double rate) grossToTaxPercent
(double rate, RoundingMode roundingMode) grossToTaxPercent
(int rate) grossToTaxPercent
(int rate, RoundingMode roundingMode) int
hashCode()
boolean
boolean
lessThanOrEqual
(Price other) boolean
boolean
multiply
(double other) multiply
(double other, RoundingMode roundingMode) multiply
(int other) negate()
negative()
Deprecated.Usenegate()
insteadstatic Price
nullToZero
(Price value) static Price
parse
(String source, DecimalFormat format) static Price[]
splitProportionately
(Price total, Price[] weights) long
store()
int
static Price
storeOf
(long store) static Price
static Price
toString()
Returns a string representation of this price.Returns a string representation of this price without trailing zeros.static Price
valueOf
(double value) static Price
valueOf
(double value, RoundingMode roundingMode) static Price
valueOf
(BigDecimal value) static Price
valueOf
(BigDecimal value, RoundingMode roundingMode)
-
Field Details
-
MIN_VALUE
-
MAX_VALUE
-
ZERO
- See Also:
-
-
Method Details
-
storeOf
-
storeOf
-
storeOf
-
store
public long store() -
storeIntExact
public int storeIntExact() -
equals
-
hashCode
public int hashCode() -
toString
Returns a string representation of this price. The result has trailing zeros, such as "1.20" or "1.00". If you don't want trailing zeros, usetoStringShort()
instead. -
toStringShort
Returns a string representation of this price without trailing zeros. If you want trailing zeros, usetoString()
instead. -
format
-
parse
- Throws:
ParseException
-
nullToZero
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Price>
-
equalsZero
public boolean equalsZero() -
lessThanZero
public boolean lessThanZero() -
greaterThanZero
public boolean greaterThanZero() -
lessThanOrEqualZero
public boolean lessThanOrEqualZero() -
greaterThanOrEqualZero
public boolean greaterThanOrEqualZero() -
lessThan
-
greaterThan
-
lessThanOrEqual
-
greaterThanOrEqual
-
min
- Returns:
- this if this price is lower than the other one; otherwise the other one
- See Also:
-
max
- Returns:
- this if this price is greater than the other one; otherwise the other one
- See Also:
-
negate
- See Also:
-
add
- See Also:
-
subtract
- See Also:
-
multiply
- See Also:
-
multiply
- See Also:
-
multiply
- See Also:
-
divide
- See Also:
-
divide
- See Also:
-
grossToNetPercent
- Throws:
IllegalArgumentException
- if rate is negative
-
grossToNetPercent
- Throws:
IllegalArgumentException
- if rate is negative
-
grossToTaxPercent
- Throws:
IllegalArgumentException
- if rate is negative
-
grossToTaxPercent
- Throws:
IllegalArgumentException
- if rate is negative
-
grossToTaxPercent
- Throws:
IllegalArgumentException
- if rate is negative
-
grossToTaxPercent
- Throws:
IllegalArgumentException
- if rate is negative
-
splitProportionately
- Throws:
IllegalArgumentException
- if weights has length of 0.
-
valueOf
- See Also:
-
valueOf
- See Also:
-
doubleValue
public double doubleValue()- See Also:
-
valueOf
-
valueOf
-
bigValue
-
getLower
Deprecated.Usemin(Price)
instead -
getGreater
Deprecated.Usemax(Price)
instead -
negative
Deprecated.Usenegate()
instead
-
max(Price)
instead