EDU.oswego.cs.dl.util.concurrent
Class SynchronizedBoolean
- Cloneable, Comparable, Executor
public class SynchronizedBoolean
implements Comparable, Cloneable
SynchronizedBoolean(boolean initialValue) - Make a new SynchronizedBoolean with the given initial value,
and using its own internal lock.
|
SynchronizedBoolean(boolean initialValue, Object lock) - Make a new SynchronizedBoolean with the given initial value,
and using the supplied lock.
|
boolean | and(boolean b) - Set value to value & b.
|
boolean | commit(boolean assumedValue, boolean newValue) - Set value to newValue only if it is currently assumedValue.
|
int | compareTo(SynchronizedBoolean other)
|
int | compareTo(Object other)
|
int | compareTo(boolean other)
|
boolean | complement() - Set the value to its complement
|
boolean | equals(Object other)
|
boolean | get() - Return the current value
|
int | hashCode()
|
boolean | or(boolean b) - Set value to value | b.
|
boolean | set(boolean newValue) - Set to newValue.
|
boolean | swap(SynchronizedBoolean other) - Atomically swap values with another SynchronizedBoolean.
|
String | toString()
|
boolean | xor(boolean b) - Set value to value ^ b.
|
value_
protected boolean value_
SynchronizedBoolean
public SynchronizedBoolean(boolean initialValue)
Make a new SynchronizedBoolean with the given initial value,
and using its own internal lock.
SynchronizedBoolean
public SynchronizedBoolean(boolean initialValue,
Object lock)
Make a new SynchronizedBoolean with the given initial value,
and using the supplied lock.
and
public boolean and(boolean b)
Set value to value & b.
- the new value
commit
public boolean commit(boolean assumedValue,
boolean newValue)
Set value to newValue only if it is currently assumedValue.
- true if successful
compareTo
public int compareTo(Object other)
compareTo
public int compareTo(boolean other)
complement
public boolean complement()
Set the value to its complement
- the new value
equals
public boolean equals(Object other)
get
public final boolean get()
Return the current value
hashCode
public int hashCode()
or
public boolean or(boolean b)
Set value to value | b.
- the new value
set
public boolean set(boolean newValue)
Set to newValue.
- the old value
swap
public boolean swap(SynchronizedBoolean other)
Atomically swap values with another SynchronizedBoolean.
Uses identityHashCode to avoid deadlock when
two SynchronizedBooleans 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.)
- the new value
toString
public String toString()
xor
public boolean xor(boolean b)
Set value to value ^ b.
- the new value