EDU.oswego.cs.dl.util.concurrent
public class SynchronizedLong extends SynchronizedVariable implements Comparable, Cloneable
Field Summary | |
---|---|
protected long | value_ |
Constructor Summary | |
---|---|
SynchronizedLong(long initialValue)
Make a new SynchronizedLong with the given initial value,
and using its own internal lock.
| |
SynchronizedLong(long initialValue, Object lock)
Make a new SynchronizedLong with the given initial value,
and using the supplied lock.
|
Method Summary | |
---|---|
long | add(long amount)
Add amount to value (i.e., set value += amount) |
long | and(long b)
Set value to value & b. |
boolean | commit(long assumedValue, long newValue)
Set value to newValue only if it is currently assumedValue. |
int | compareTo(long other) |
int | compareTo(SynchronizedLong other) |
int | compareTo(Object other) |
long | complement()
Set the value to its complement |
long | decrement()
Decrement the value. |
long | divide(long factor)
Divide value by factor (i.e., set value /= factor) |
boolean | equals(Object other) |
long | get()
Return the current value
|
int | hashCode() |
long | increment()
Increment the value. |
long | multiply(long factor)
Multiply value by factor (i.e., set value *= factor) |
long | negate()
Set the value to the negative of its old value |
long | or(long b)
Set value to value | b. |
long | set(long newValue)
Set to newValue. |
long | subtract(long amount)
Subtract amount from value (i.e., set value -= amount) |
long | swap(SynchronizedLong other)
Atomically swap values with another SynchronizedLong.
|
String | toString() |
long | xor(long b)
Set value to value ^ b. |
Returns: the new value
Returns: the new value
Returns: true if successful
Returns: the new value
Returns: the new value
Returns: the new value
Returns: the new value
Returns: the new value
Returns: the new value
Returns: the new value
Returns: the old value
Returns: the new value
Returns: the new value
Returns: the new value