Package com.helger.commons.mutable
Class MutableShort
java.lang.Object
java.lang.Number
com.helger.commons.mutable.AbstractMutableNumeric<MutableShort>
com.helger.commons.mutable.AbstractMutableInteger<MutableShort>
com.helger.commons.mutable.MutableShort
- All Implemented Interfaces:
IComparable<MutableShort>,ICloneable<MutableShort>,IMutableInteger<MutableShort>,IMutableNumeric<MutableShort>,IMutableObject<MutableShort>,INumber,IGenericImplTrait<MutableShort>,Serializable,Comparable<MutableShort>
Object wrapper around a short so that it can be passed a final object but is
mutable.
- Author:
- Philip Helger
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMutableShort(int nValue) Initialize with a certain int value.MutableShort(short nValue) Initialize with a certain value.MutableShort(Number aValue) Initialize with a certain value. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(MutableShort rhs) intdec()intdec(int nDelta) intdoubleReturns 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.shortgetClone()inthashCode()intinc()Increment by 1 and return the modified value.intinc(int nDelta) intshortintintValue()Returns the value of the specified number as anint, which may involve rounding or truncation.booleanis0()booleanisEven()booleanisGE0()booleanisGT0()booleanisLE0()booleanisLT0()longReturns the value of the specified number as along, which may involve rounding or truncation.set(int nValue) set(short nValue) shortReturns the value of the specified number as ashort, which may involve rounding or truncation.toString()Methods inherited from class com.helger.commons.mutable.AbstractMutableNumeric
onAfterChangeMethods 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.IMutableInteger
isOddMethods inherited from interface com.helger.commons.mutable.IMutableNumeric
getAsBigDecimal, getAsBigInteger, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInteger, getAsLong, getAsShort, isNot0
-
Constructor Details
-
MutableShort
public MutableShort(int nValue) Initialize with a certain int value. If the value does not fit into a short, the value is cut!- Parameters:
nValue- The value to be used.
-
MutableShort
Initialize with a certain value.- Parameters:
aValue- The value to be used.
-
MutableShort
public MutableShort(short nValue) Initialize with a certain value.- Parameters:
nValue- The value to be used.
-
-
Method Details
-
shortValue
public short shortValue()Description copied from interface:INumberReturns the value of the specified number as ashort, which may involve rounding or truncation.This implementation returns the result of
INumber.intValue()cast to ashort.- Specified by:
shortValuein interfaceINumber- Overrides:
shortValuein classNumber- Returns:
- the numeric value represented by this object after conversion to
type
short.
-
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.
-
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.
-
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 int inc()Increment by 1 and return the modified value.- Returns:
- The by 1 incremented value.
-
inc
public int inc(int nDelta) -
inc
-
dec
public int dec() -
dec
public int dec(int nDelta) -
dec
-
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
-
isEven
public boolean isEven()- Returns:
trueif the value is even
-
getAndInc
public short getAndInc() -
incAndGet
public short incAndGet() -
compareTo
-
getClone
- Returns:
- A 100% deep-copy of the implementing class.
-
equals
-
hashCode
public int hashCode() -
toString
-