|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable EDU.oswego.cs.dl.util.concurrent.SynchronizedInt EDU.oswego.cs.dl.util.concurrent.WaitableInt
public class WaitableInt
A class useful for offloading waiting and signalling operations on single int variables.
[ Introduction to this package. ]
Field Summary |
---|
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedInt |
---|
value_ |
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
lock_ |
Constructor Summary | |
---|---|
WaitableInt(int initialValue)
Make a new WaitableInt with the given initial value, and using its own internal lock. |
|
WaitableInt(int initialValue,
java.lang.Object lock)
Make a new WaitableInt 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 |
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) |
int |
increment()
Increment the value. |
int |
multiply(int factor)
Multiply value by factor (i.e., set value *= factor) |
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) |
void |
whenEqual(int c,
java.lang.Runnable action)
Wait until value equals c, then run action if nonnull. |
void |
whenGreater(int c,
java.lang.Runnable action)
wait until value greater than c, then run action if nonnull. |
void |
whenGreaterEqual(int c,
java.lang.Runnable action)
wait until value greater than or equal to c, then run action if nonnull. |
void |
whenLess(int c,
java.lang.Runnable action)
wait until value less than c, then run action if nonnull. |
void |
whenLessEqual(int c,
java.lang.Runnable action)
wait until value less than or equal to c, then run action if nonnull. |
void |
whenNotEqual(int c,
java.lang.Runnable action)
wait until value not equal to c, then run action if nonnull. |
int |
xor(int b)
Set value to value ^ b. |
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedInt |
---|
compareTo, compareTo, compareTo, equals, get, hashCode, negate, swap, toString |
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
execute, getLock |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WaitableInt(int initialValue)
public WaitableInt(int initialValue, java.lang.Object lock)
Method Detail |
---|
public int set(int newValue)
SynchronizedInt
set
in class SynchronizedInt
public boolean commit(int assumedValue, int newValue)
SynchronizedInt
commit
in class SynchronizedInt
public int increment()
SynchronizedInt
increment
in class SynchronizedInt
public int decrement()
SynchronizedInt
decrement
in class SynchronizedInt
public int add(int amount)
SynchronizedInt
add
in class SynchronizedInt
public int subtract(int amount)
SynchronizedInt
subtract
in class SynchronizedInt
public int multiply(int factor)
SynchronizedInt
multiply
in class SynchronizedInt
public int divide(int factor)
SynchronizedInt
divide
in class SynchronizedInt
public int complement()
complement
in class SynchronizedInt
public int and(int b)
and
in class SynchronizedInt
public int or(int b)
or
in class SynchronizedInt
public int xor(int b)
xor
in class SynchronizedInt
public void whenEqual(int c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenNotEqual(int c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenLessEqual(int c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenLess(int c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenGreaterEqual(int c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
public void whenGreater(int c, java.lang.Runnable action) throws java.lang.InterruptedException
java.lang.InterruptedException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |