Package com.helger.commons.mutable
Class MutableBigDecimal
- java.lang.Object
-
- java.lang.Number
-
- com.helger.commons.mutable.AbstractMutableNumeric<MutableBigDecimal>
-
- com.helger.commons.mutable.MutableBigDecimal
-
- All Implemented Interfaces:
IComparable<MutableBigDecimal>,ICloneable<MutableBigDecimal>,IMutableNumeric<MutableBigDecimal>,IMutableObject<MutableBigDecimal>,INumber,IGenericImplTrait<MutableBigDecimal>,Serializable,Comparable<MutableBigDecimal>
@NotThreadSafe public class MutableBigDecimal extends AbstractMutableNumeric<MutableBigDecimal>
Object wrapper around aBigDecimalso that it can be passed a final object but is mutable.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MutableBigDecimal(double dValue)MutableBigDecimal(long nValue)MutableBigDecimal(MutableBigDecimal aOther)MutableBigDecimal(BigDecimal aValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(MutableBigDecimal rhs)BigDecimaldec()BigDecimaldec(double dDelta)BigDecimaldec(long nDelta)BigDecimaldec(MutableBigDecimal aDelta)BigDecimaldec(BigDecimal aDelta)BigDecimaldivide(double dDivisor, int nScale, RoundingMode eRoundingMode)BigDecimaldivide(long nDivisor, int nScale, RoundingMode eRoundingMode)BigDecimaldivide(MutableBigDecimal aDivisor, int nScale, RoundingMode eRoundingMode)BigDecimaldivide(BigDecimal aDivisor, int nScale, RoundingMode eRoundingMode)doubledoubleValue()Returns the value of the specified number as adouble, which may involve rounding.booleanequals(Object o)floatfloatValue()Returns the value of the specified number as afloat, which may involve rounding.BigDecimalgetAndInc()BigDecimalgetAsBigDecimal()MutableBigDecimalgetClone()inthashCode()BigDecimalinc()Increment by 1 and return the modified value.BigDecimalinc(double dDelta)BigDecimalinc(long nDelta)BigDecimalinc(MutableBigDecimal aDelta)BigDecimalinc(BigDecimal aDelta)BigDecimalincAndGet()intintValue()Returns the value of the specified number as anint, which may involve rounding or truncation.booleanis0()booleanisGE0()booleanisGT0()booleanisLE0()booleanisLT0()longlongValue()Returns the value of the specified number as along, which may involve rounding or truncation.BigDecimalmultiply(double dMultiplicand)BigDecimalmultiply(long nMultiplicand)BigDecimalmultiply(MutableBigDecimal aMultiplicand)BigDecimalmultiply(BigDecimal aMultiplicand)EChangeset(double dDelta)EChangeset(long nDelta)EChangeset(MutableBigDecimal aValue)EChangeset(BigDecimal aValue)StringtoString()-
Methods inherited from class com.helger.commons.mutable.AbstractMutableNumeric
onAfterChange
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.compare.IComparable
isEQ, isGE, isGT, isLE, isLT, isNE
-
Methods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsT
-
Methods inherited from interface com.helger.commons.mutable.IMutableNumeric
getAsBigInteger, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInteger, getAsLong, getAsShort, isNot0
-
Methods inherited from interface com.helger.commons.mutable.INumber
byteValue, shortValue
-
-
-
-
Constructor Detail
-
MutableBigDecimal
public MutableBigDecimal(long nValue)
-
MutableBigDecimal
public MutableBigDecimal(double dValue)
-
MutableBigDecimal
public MutableBigDecimal(@Nonnull MutableBigDecimal aOther)
-
MutableBigDecimal
public MutableBigDecimal(@Nonnull BigDecimal aValue)
-
-
Method Detail
-
getAsBigDecimal
@Nonnull public BigDecimal getAsBigDecimal()
-
doubleValue
public double doubleValue()
Description copied from interface:INumberReturns the value of the specified number as adouble, which may involve rounding.- Specified by:
doubleValuein interfaceINumber- Specified by:
doubleValuein classNumber- Returns:
- the numeric value represented by this object after conversion to
type
double.
-
floatValue
public float floatValue()
Description copied from interface:INumberReturns the value of the specified number as afloat, which may involve rounding.- Specified by:
floatValuein interfaceINumber- Specified by:
floatValuein classNumber- Returns:
- the numeric value represented by this object after conversion to
type
float.
-
intValue
public int intValue()
Description copied from interface:INumberReturns the value of the specified number as anint, which may involve rounding or truncation.
-
longValue
public long longValue()
Description copied from interface:INumberReturns the value of the specified number as along, which may involve rounding or truncation.
-
inc
@Nonnull public BigDecimal inc()
Increment by 1 and return the modified value.- Returns:
- The by 1 incremented value.
-
inc
@Nonnull public BigDecimal inc(long nDelta)
-
inc
@Nonnull public BigDecimal inc(double dDelta)
-
inc
@Nonnull public BigDecimal inc(@Nonnull MutableBigDecimal aDelta)
-
inc
@Nonnull public BigDecimal inc(@Nonnull BigDecimal aDelta)
-
dec
@Nonnull public BigDecimal dec()
-
dec
@Nonnull public BigDecimal dec(long nDelta)
-
dec
@Nonnull public BigDecimal dec(double dDelta)
-
dec
@Nonnull public BigDecimal dec(@Nonnull BigDecimal aDelta)
-
dec
@Nonnull public BigDecimal dec(@Nonnull MutableBigDecimal aDelta)
-
divide
@Nonnull public BigDecimal divide(long nDivisor, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
-
divide
@Nonnull public BigDecimal divide(double dDivisor, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
-
divide
@Nonnull public BigDecimal divide(@Nonnull MutableBigDecimal aDivisor, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
-
divide
@Nonnull public BigDecimal divide(@Nonnull BigDecimal aDivisor, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
-
multiply
@Nonnull public BigDecimal multiply(long nMultiplicand)
-
multiply
@Nonnull public BigDecimal multiply(double dMultiplicand)
-
multiply
@Nonnull public BigDecimal multiply(@Nonnull MutableBigDecimal aMultiplicand)
-
multiply
@Nonnull public BigDecimal multiply(@Nonnull BigDecimal aMultiplicand)
-
set
@Nonnull public EChange set(@Nonnull MutableBigDecimal aValue)
-
set
@Nonnull public EChange set(@Nonnull BigDecimal aValue)
-
is0
public boolean is0()
- Returns:
trueif the value is 0
-
isLT0
public boolean isLT0()
- Returns:
trueif the value is < 0
-
isLE0
public boolean isLE0()
- Returns:
trueif the value is ≤ 0
-
isGT0
public boolean isGT0()
- Returns:
trueif the value is > 0
-
isGE0
public boolean isGE0()
- Returns:
trueif the value is ≥ 0
-
getAndInc
@Nonnull public BigDecimal getAndInc()
-
incAndGet
@Nonnull public BigDecimal incAndGet()
-
compareTo
public int compareTo(@Nonnull MutableBigDecimal rhs)
-
getClone
@Nonnull public MutableBigDecimal getClone()
- Returns:
- A 100% deep-copy of the implementing class.
-
-