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>
Object wrapper around a
BigDecimal so that it can be passed a final
object but is mutable.- Author:
- Philip Helger
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMutableBigDecimal(double dValue) MutableBigDecimal(long nValue) MutableBigDecimal(MutableBigDecimal aOther) MutableBigDecimal(BigDecimal aValue) -
Method Summary
Modifier and TypeMethodDescriptionintdec()dec(double dDelta) dec(long nDelta) dec(MutableBigDecimal aDelta) dec(BigDecimal aDelta) divide(double dDivisor, int nScale, RoundingMode eRoundingMode) divide(long nDivisor, int nScale, RoundingMode eRoundingMode) divide(MutableBigDecimal aDivisor, int nScale, RoundingMode eRoundingMode) divide(BigDecimal aDivisor, int nScale, RoundingMode eRoundingMode) doubleReturns the value of the specified number as adouble, which may involve rounding.booleanfloatReturns the value of the specified number as afloat, which may involve rounding.getClone()inthashCode()inc()Increment by 1 and return the modified value.inc(double dDelta) inc(long nDelta) inc(MutableBigDecimal aDelta) inc(BigDecimal aDelta) intintValue()Returns the value of the specified number as anint, which may involve rounding or truncation.booleanis0()booleanisGE0()booleanisGT0()booleanisLE0()booleanisLT0()longReturns the value of the specified number as along, which may involve rounding or truncation.multiply(double dMultiplicand) multiply(long nMultiplicand) multiply(MutableBigDecimal aMultiplicand) multiply(BigDecimal aMultiplicand) set(double dDelta) set(long nDelta) set(MutableBigDecimal aValue) set(BigDecimal aValue) toString()Methods inherited from class com.helger.commons.mutable.AbstractMutableNumeric
onAfterChangeMethods inherited from class java.lang.Number
byteValue, shortValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.compare.IComparable
isEQ, isGE, isGT, isLE, isLT, isNEMethods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsTMethods inherited from interface com.helger.commons.mutable.IMutableNumeric
getAsBigInteger, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInteger, getAsLong, getAsShort, isNot0Methods inherited from interface com.helger.commons.mutable.INumber
byteValue, shortValue
-
Constructor Details
-
MutableBigDecimal
public MutableBigDecimal(long nValue) -
MutableBigDecimal
public MutableBigDecimal(double dValue) -
MutableBigDecimal
-
MutableBigDecimal
-
-
Method Details
-
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
Increment by 1 and return the modified value.- Returns:
- The by 1 incremented value.
-
inc
-
inc
-
inc
-
inc
-
dec
-
dec
-
dec
-
dec
-
dec
-
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
-
multiply
-
multiply
-
multiply
-
set
-
set
-
set
-
set
-
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
-
incAndGet
-
compareTo
-
getClone
- Returns:
- A 100% deep-copy of the implementing class.
-
equals
-
hashCode
public int hashCode() -
toString
-