EDU.oswego.cs.dl.util.concurrent
public class SynchronizedBoolean extends SynchronizedVariable implements java.lang.Comparable, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
protected boolean |
value_ |
lock_
Constructor and Description |
---|
SynchronizedBoolean(boolean initialValue)
Make a new SynchronizedBoolean with the given initial value,
and using its own internal lock.
|
SynchronizedBoolean(boolean initialValue,
java.lang.Object lock)
Make a new SynchronizedBoolean with the given initial value,
and using the supplied lock.
|
Modifier and Type | Method and Description |
---|---|
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(boolean other) |
int |
compareTo(java.lang.Object other) |
int |
compareTo(SynchronizedBoolean other) |
boolean |
complement()
Set the value to its complement
|
boolean |
equals(java.lang.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.
|
java.lang.String |
toString() |
boolean |
xor(boolean b)
Set value to value ^ b.
|
execute, getLock
public SynchronizedBoolean(boolean initialValue)
public SynchronizedBoolean(boolean initialValue, java.lang.Object lock)
public final boolean get()
public boolean set(boolean newValue)
public boolean commit(boolean assumedValue, boolean newValue)
public boolean swap(SynchronizedBoolean other)
public boolean complement()
public boolean and(boolean b)
public boolean or(boolean b)
public boolean xor(boolean b)
public int compareTo(boolean other)
public int compareTo(SynchronizedBoolean other)
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object