ccs.utils
Class WritableInteger

java.lang.Object
  extended by ccs.utils.WritableInteger

public class WritableInteger
extends java.lang.Object

This class is similar to an Integer, except you can write to it and the static utility methods aren't there. There are circumstances where you want to put a mutable integer into a container as a value (not suitable as a key), but without causing a garbage geyser if you have to change it a lot. MT-UNSAFE.


Constructor Summary
WritableInteger(int value)
          Create a WritableInteger wrapping the given value.
 
Method Summary
 void decrement()
          Decrement, the -- operator on a primitive int.
 int getValue()
          Get.
 void increment()
          Increment, the ++ operator on a primitive int.
 void setValue(int value)
          Set.
 java.lang.String toString()
          This integer as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WritableInteger

public WritableInteger(int value)
Create a WritableInteger wrapping the given value.

Parameters:
value - The value.
Method Detail

getValue

public int getValue()
Get.

Returns:
The integer.

setValue

public void setValue(int value)
Set.

Parameters:
value - the value of the integer.

increment

public void increment()
Increment, the ++ operator on a primitive int.


decrement

public void decrement()
Decrement, the -- operator on a primitive int.


toString

public java.lang.String toString()
This integer as a string.

Overrides:
toString in class java.lang.Object
Returns:
the String representation of the integer.