Package com.helger.commons.mutable
Class MutableDouble
- java.lang.Object
-
- java.lang.Number
-
- com.helger.commons.mutable.AbstractMutableNumeric<MutableDouble>
-
- com.helger.commons.mutable.MutableDouble
-
- All Implemented Interfaces:
IComparable<MutableDouble>,ICloneable<MutableDouble>,IMutableNumeric<MutableDouble>,IMutableObject<MutableDouble>,INumber,IGenericImplTrait<MutableDouble>,Serializable,Comparable<MutableDouble>
@NotThreadSafe public class MutableDouble extends AbstractMutableNumeric<MutableDouble>
Object wrapper around a double so that it can be passed a final object but is mutable.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MutableDouble(double dValue)MutableDouble(Number aValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(MutableDouble rhs)doubledec()doubledec(double dDelta)doubledec(Number aDelta)doubledivide(double dDivisor)doubledivide(Number aDivisor)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.doublegetAndInc()MutableDoublegetClone()inthashCode()doubleinc()Increment by 1 and return the modified value.doubleinc(double dDelta)doubleinc(Number aDelta)doubleincAndGet()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.doublemultiply(double dMultiplicand)doublemultiply(Number aMultiplicand)EChangeset(double dValue)EChangeset(Number 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
getAsBigDecimal, getAsBigInteger, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInteger, getAsLong, getAsShort, isNot0
-
Methods inherited from interface com.helger.commons.mutable.INumber
byteValue, shortValue
-
-
-
-
Method Detail
-
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
public double inc()
Increment by 1 and return the modified value.- Returns:
- The by 1 incremented value.
-
inc
public double inc(double dDelta)
-
dec
public double dec()
-
dec
public double dec(double dDelta)
-
divide
public double divide(double dDivisor)
-
multiply
public double multiply(double dMultiplicand)
-
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
public double getAndInc()
-
incAndGet
public double incAndGet()
-
compareTo
public int compareTo(@Nonnull MutableDouble rhs)
-
getClone
@Nonnull public MutableDouble getClone()
- Returns:
- A 100% deep-copy of the implementing class.
-
-