Package org.atlanmod.commons.mutable
Class MutableInteger
- java.lang.Object
-
- java.lang.Number
-
- org.atlanmod.commons.mutable.MutableInteger
-
- All Implemented Interfaces:
Serializable,Comparable<MutableInteger>,Mutable<Integer>
public class MutableInteger extends Number implements Comparable<MutableInteger>, Mutable<Integer>
A mutable int wrapper.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MutableInteger()Constructs a new MutableIntegerMutableInteger(int newValue)Constructs a new MutableInteger and stores the specified value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(MutableInteger other)voiddecrement()Decrements by 1 the stored valueintdecrementAndGet()Decrements by 1 the stored value and gets the new valuedoubledoubleValue()booleanequals(Object other)floatfloatValue()intget()Gets the value of the stored intintgetAndDecrement()Decrements by 1 the stored value and gets the previous stored valueintgetAndIncrement()Increments by 1 the stored value and gets the previous stored valueIntegergetValue()Gets the value of this mutable.inthashCode()voidincrement()Increments by 1 the stored valueintincrementAndGet()Increments by 1 the stored value and gets the new valueintintValue()longlongValue()voidset(int newValue)Sets the value of the stored intvoidsetValue(Integer newValue)Sets the value of this mutable-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Method Detail
-
set
public void set(int newValue)
Sets the value of the stored int- Parameters:
newValue- the new value to store
-
get
public int get()
Gets the value of the stored int- Returns:
- the stored int
-
increment
public void increment()
Increments by 1 the stored value
-
incrementAndGet
public int incrementAndGet()
Increments by 1 the stored value and gets the new value- Returns:
- the stored value, after it is incremented
-
getAndIncrement
public int getAndIncrement()
Increments by 1 the stored value and gets the previous stored value- Returns:
- the store valued prior to the increment
-
decrement
public void decrement()
Decrements by 1 the stored value
-
decrementAndGet
public int decrementAndGet()
Decrements by 1 the stored value and gets the new value- Returns:
- the stored value, after it is decremented
-
getAndDecrement
public int getAndDecrement()
Decrements by 1 the stored value and gets the previous stored value- Returns:
- the store valued prior to the increment
-
getValue
public Integer getValue()
Description copied from interface:MutableGets the value of this mutable.
-
setValue
public void setValue(Integer newValue)
Description copied from interface:MutableSets the value of this mutable
-
compareTo
public int compareTo(@Nonnull MutableInteger other)- Specified by:
compareToin interfaceComparable<MutableInteger>
-
floatValue
public float floatValue()
- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()
- Specified by:
doubleValuein classNumber
-
-