org.sandev.basics.util
Class IntReference

java.lang.Object
  extended by org.sandev.basics.util.IntReference

public class IntReference
extends java.lang.Object

Holds a reference to an int. This is useful if you are doing a recursive traversal through a tree structure and want to keep track of which line you are on without using a state variable in the current class. This essentially gives you an int state variable that can be referenced from wherever you are regardless of recursion level.


Field Summary
protected  int value
          The int reference.
 
Constructor Summary
IntReference()
           
 
Method Summary
 int decrementValue()
          Return the current value and then decrement it.
 int getValue()
          Accessor for value.
 int incrementValue()
          Return the current value and then increment it.
 void setValue(int val)
          Mutator for value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected int value
The int reference.

Constructor Detail

IntReference

public IntReference()
Method Detail

setValue

public void setValue(int val)
Mutator for value.


getValue

public int getValue()
Accessor for value.


incrementValue

public int incrementValue()
Return the current value and then increment it.


decrementValue

public int decrementValue()
Return the current value and then decrement it.