Class MutableBigDecimal

All Implemented Interfaces:
ICloneable<MutableBigDecimal>, IComparable<MutableBigDecimal>, INumber, IMutableNumeric<MutableBigDecimal>, IMutableObject<MutableBigDecimal>, IGenericImplTrait<MutableBigDecimal>, Serializable, Comparable<MutableBigDecimal>

@NotThreadSafe public class MutableBigDecimal extends AbstractMutableNumeric<MutableBigDecimal>
Object wrapper around a BigDecimal so that it can be passed a final object but is mutable.
Author:
Philip Helger
See Also:
  • Constructor Details

    • MutableBigDecimal

      public MutableBigDecimal(long nValue)
    • MutableBigDecimal

      public MutableBigDecimal(double dValue)
    • MutableBigDecimal

      public MutableBigDecimal(@Nonnull MutableBigDecimal aOther)
    • MutableBigDecimal

      public MutableBigDecimal(@Nonnull BigDecimal aValue)
  • Method Details

    • getAsBigDecimal

      @Nonnull public BigDecimal getAsBigDecimal()
    • doubleValue

      public double doubleValue()
      Description copied from interface: INumber
      Returns the value of the specified number as a double, which may involve rounding.
      Specified by:
      doubleValue in interface INumber
      Specified by:
      doubleValue in class Number
      Returns:
      the numeric value represented by this object after conversion to type double.
    • floatValue

      public float floatValue()
      Description copied from interface: INumber
      Returns the value of the specified number as a float, which may involve rounding.
      Specified by:
      floatValue in interface INumber
      Specified by:
      floatValue in class Number
      Returns:
      the numeric value represented by this object after conversion to type float.
    • intValue

      public int intValue()
      Description copied from interface: INumber
      Returns the value of the specified number as an int, which may involve rounding or truncation.
      Specified by:
      intValue in interface INumber
      Specified by:
      intValue in class Number
      Returns:
      the numeric value represented by this object after conversion to type int.
    • longValue

      public long longValue()
      Description copied from interface: INumber
      Returns the value of the specified number as a long, which may involve rounding or truncation.
      Specified by:
      longValue in interface INumber
      Specified by:
      longValue in class Number
      Returns:
      the numeric value represented by this object after conversion to type long.
    • 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(long nDelta)
    • set

      @Nonnull public EChange set(double dDelta)
    • set

      @Nonnull public EChange set(@Nonnull MutableBigDecimal aValue)
    • set

      @Nonnull public EChange set(@Nonnull BigDecimal aValue)
    • is0

      public boolean is0()
      Returns:
      true if the value is 0
    • isLT0

      public boolean isLT0()
      Returns:
      true if the value is < 0
    • isLE0

      public boolean isLE0()
      Returns:
      true if the value is ≤ 0
    • isGT0

      public boolean isGT0()
      Returns:
      true if the value is > 0
    • isGE0

      public boolean isGE0()
      Returns:
      true if 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.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object