|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.metasyntactic.thread.concurrent.SynchronizedVariable | +--org.metasyntactic.thread.concurrent.SynchronizedBoolean
A class useful for offloading synch for boolean instance variables.
Field Summary | |
protected boolean |
value
|
Fields inherited from class org.metasyntactic.thread.concurrent.SynchronizedVariable |
lock |
Constructor Summary | |
SynchronizedBoolean()
Creates a new SynchBoolean instantiated to the value 'false' just like a java boolean |
|
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. |
Method Summary | |
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. |
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. |
Methods inherited from class org.metasyntactic.thread.concurrent.SynchronizedVariable |
execute, getLock |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean value
Constructor Detail |
public SynchronizedBoolean()
public SynchronizedBoolean(boolean initialValue)
public SynchronizedBoolean(boolean initialValue, java.lang.Object lock)
Method Detail |
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 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |