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()intdivide(double other) divide(double other, RoundingMode roundingMode) doublebooleanbooleanformat(NumberFormat format) getGreater(Price other) Deprecated.Deprecated.Usemin(Price)insteadbooleangreaterThan(Price other) booleangreaterThanOrEqual(Price other) booleanbooleangrossToNetPercent(int rate) grossToNetPercent(int rate, RoundingMode roundingMode) grossToTaxPercent(double rate) grossToTaxPercent(double rate, RoundingMode roundingMode) grossToTaxPercent(int rate) grossToTaxPercent(int rate, RoundingMode roundingMode) inthashCode()booleanbooleanlessThanOrEqual(Price other) booleanbooleanmultiply(double other) multiply(double other, RoundingMode roundingMode) multiply(int other) negate()negative()Deprecated.Usenegate()insteadstatic PricenullToZero(Price value) static Priceparse(String source, DecimalFormat format) static Price[]splitProportionately(Price total, Price[] weights) longstore()intstatic PricestoreOf(long store) static Pricestatic PricetoString()Returns a string representation of this price.Returns a string representation of this price without trailing zeros.static PricevalueOf(double value) static PricevalueOf(double value, RoundingMode roundingMode) static PricevalueOf(BigDecimal value) static PricevalueOf(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:
compareToin 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