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