Home » concurrent-sources » EDU.oswego.cs.dl.util.concurrent » [javadoc | source]
EDU.oswego.cs.dl.util.concurrent
public class: SynchronizedLong [javadoc | source]
java.lang.Object
   EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable
      EDU.oswego.cs.dl.util.concurrent.SynchronizedLong

All Implemented Interfaces:
    Cloneable, Comparable, Executor

Direct Known Subclasses:
    WaitableLong

A class useful for offloading synch for long instance variables.

[ Introduction to this package. ]
Field Summary
protected  long value_     
Fields inherited from EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable:
lock_
Constructor:
 public SynchronizedLong(long initialValue) 
 public SynchronizedLong(long initialValue,
    Object lock) 
    Make a new SynchronizedLong with the given initial value, and using the supplied lock. *
Method from EDU.oswego.cs.dl.util.concurrent.SynchronizedLong 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.SynchronizedLong Detail:
 public long add(long amount) 
    Add amount to value (i.e., set value += amount)
 public long and(long b) 
    Set value to value & b.
 public boolean commit(long assumedValue,
    long newValue) 
    Set value to newValue only if it is currently assumedValue.
 public int compareTo(long other) 
 public int compareTo(SynchronizedLong other) 
 public int compareTo(Object other) 
 public long complement() 
    Set the value to its complement
 public long decrement() 
    Decrement the value.
 public long divide(long factor) 
    Divide value by factor (i.e., set value /= factor)
 public boolean equals(Object other) 
 public final long get() 
    Return the current value
 public int hashCode() 
 public long increment() 
    Increment the value.
 public long multiply(long factor) 
    Multiply value by factor (i.e., set value *= factor)
 public long negate() 
    Set the value to the negative of its old value
 public long or(long b) 
    Set value to value | b.
 public long set(long newValue) 
    Set to newValue.
 public long subtract(long amount) 
    Subtract amount from value (i.e., set value -= amount)
 public long swap(SynchronizedLong other) 
    Atomically swap values with another SynchronizedLong. Uses identityHashCode to avoid deadlock when two SynchronizedLongs attempt to simultaneously swap with each other.
 public String toString() 
 public long xor(long b) 
    Set value to value ^ b.