bcds.tools
Class IntVar

java.lang.Object
  extended by java.lang.Number
      extended by java.util.concurrent.atomic.AtomicInteger
          extended by bcds.tools.IntVar
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IntVar>

public class IntVar
extends java.util.concurrent.atomic.AtomicInteger
implements java.lang.Comparable<IntVar>

Implements a mutable int (an integer variable). java.util.concurrent.atomic.AtomicInteger is used as base class for its "mutability" (values can be incremented without requering object re-creation). Contrary to AtomicInteger, however, this class implements the Comparable interface.

Author:
Juan Segovia S.
See Also:
Serialized Form

Constructor Summary
IntVar()
          Default constructor; value is set to 0.
IntVar(int initial)
           
 
Method Summary
 void add(int incr)
          Increments this object with the given value, which can be positive, negative or zero.
 int compareTo(IntVar b)
           
 
Methods inherited from class java.util.concurrent.atomic.AtomicInteger
addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, incrementAndGet, intValue, lazySet, longValue, set, toString, weakCompareAndSet
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntVar

public IntVar()
Default constructor; value is set to 0.


IntVar

public IntVar(int initial)
Method Detail

add

public void add(int incr)
Increments this object with the given value, which can be positive, negative or zero. This is a convenience wrapper on AtomicInteger.getAndAdd.


compareTo

public int compareTo(IntVar b)
Specified by:
compareTo in interface java.lang.Comparable<IntVar>