Home » concurrent-sources » EDU.oswego.cs.dl.util.concurrent » [javadoc | source]
public class: SynchronizedInt [javadoc | source]

All Implemented Interfaces:
    Cloneable, Comparable, Executor

Direct Known Subclasses:

A class useful for offloading synch for int instance variables.

[ Introduction to this package. ]
Field Summary
protected  int value_     
Fields inherited from EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable:
 public SynchronizedInt(int initialValue) 
 public SynchronizedInt(int initialValue,
    Object lock) 
    Make a new SynchronizedInt with the given initial value, and using the supplied lock. *
Method from EDU.oswego.cs.dl.util.concurrent.SynchronizedInt Summary:
add,   and,   commit,   compareTo,   compareTo,   compareTo,   complement,   decrement,   divide,   equals,   get,   hashCode,   increment,   multiply,   negate,   or,   set,   subtract,   swap,   toString,   xor
Methods from EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable:
execute,   getLock
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from EDU.oswego.cs.dl.util.concurrent.SynchronizedInt Detail:
 public int add(int amount) 
    Add amount to value (i.e., set value += amount)
 public int and(int b) 
    Set value to value & b.
 public boolean commit(int assumedValue,
    int newValue) 
    Set value to newValue only if it is currently assumedValue.
 public int compareTo(int other) 
 public int compareTo(SynchronizedInt other) 
 public int compareTo(Object other) 
 public int complement() 
    Set the value to its complement
 public int decrement() 
    Decrement the value.
 public int divide(int factor) 
    Divide value by factor (i.e., set value /= factor)
 public boolean equals(Object other) 
 public final int get() 
    Return the current value
 public int hashCode() 
 public int increment() 
    Increment the value.
 public synchronized int multiply(int factor) 
    Multiply value by factor (i.e., set value *= factor)
 public int negate() 
    Set the value to the negative of its old value
 public int or(int b) 
    Set value to value | b.
 public int set(int newValue) 
    Set to newValue.
 public int subtract(int amount) 
    Subtract amount from value (i.e., set value -= amount)
 public int swap(SynchronizedInt other) 
    Atomically swap values with another SynchronizedInt. Uses identityHashCode to avoid deadlock when two SynchronizedInts attempt to simultaneously swap with each other. (Note: Ordering via identyHashCode is not strictly guaranteed by the language specification to return unique, orderable values, but in practice JVMs rely on them being unique.)
 public String toString() 
 public int xor(int b) 
    Set value to value ^ b.