|
|||||||||
| Home >> All >> org >> ematgine >> utils >> [ concurrent overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.ematgine.utils.concurrent
Class WaitableInt

java.lang.Objectorg.ematgine.utils.concurrent.SynchronizedVariable
org.ematgine.utils.concurrent.SynchronizedInt
org.ematgine.utils.concurrent.WaitableInt
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable, Executor
- public class WaitableInt
- extends SynchronizedInt
A class useful for offloading waiting and signalling operations on single int variables.
[ Introduction to this package. ]
| Field Summary |
| Fields inherited from class org.ematgine.utils.concurrent.SynchronizedInt |
value_ |
| Fields inherited from class org.ematgine.utils.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) |
boolean |
commit(int assumedValue,
int newValue)
Set value to newValue only if it is currently assumedValue. |
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 |
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. |
| Methods inherited from class org.ematgine.utils.concurrent.SynchronizedInt |
and, compareTo, compareTo, compareTo, complement, equals, get, hashCode, negate, or, swap, toString, xor |
| Methods inherited from class org.ematgine.utils.concurrent.SynchronizedVariable |
execute, getLock |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
WaitableInt
public WaitableInt(int initialValue)
- Make a new WaitableInt with the given initial value,
and using its own internal lock.
WaitableInt
public WaitableInt(int initialValue,
java.lang.Object lock)
- Make a new WaitableInt with the given initial value,
and using the supplied lock.
| Method Detail |
set
public int set(int newValue)
- Description copied from class:
SynchronizedInt - Set to newValue.
- Overrides:
setin classSynchronizedInt
commit
public boolean commit(int assumedValue,
int newValue)
- Description copied from class:
SynchronizedInt - Set value to newValue only if it is currently assumedValue.
- Overrides:
commitin classSynchronizedInt
increment
public int increment()
- Description copied from class:
SynchronizedInt - Increment the value.
- Overrides:
incrementin classSynchronizedInt
decrement
public int decrement()
- Description copied from class:
SynchronizedInt - Decrement the value.
- Overrides:
decrementin classSynchronizedInt
add
public int add(int amount)
- Description copied from class:
SynchronizedInt - Add amount to value (i.e., set value += amount)
- Overrides:
addin classSynchronizedInt
subtract
public int subtract(int amount)
- Description copied from class:
SynchronizedInt - Subtract amount from value (i.e., set value -= amount)
- Overrides:
subtractin classSynchronizedInt
multiply
public int multiply(int factor)
- Description copied from class:
SynchronizedInt - Multiply value by factor (i.e., set value *= factor)
- Overrides:
multiplyin classSynchronizedInt
divide
public int divide(int factor)
- Description copied from class:
SynchronizedInt - Divide value by factor (i.e., set value /= factor)
- Overrides:
dividein classSynchronizedInt
whenEqual
public void whenEqual(int c,
java.lang.Runnable action)
throws java.lang.InterruptedException
- Wait until value equals c, then run action if nonnull.
The action is run with the synchronization lock held.
whenNotEqual
public void whenNotEqual(int c,
java.lang.Runnable action)
throws java.lang.InterruptedException
- wait until value not equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
whenLessEqual
public void whenLessEqual(int c,
java.lang.Runnable action)
throws java.lang.InterruptedException
- wait until value less than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
whenLess
public void whenLess(int c,
java.lang.Runnable action)
throws java.lang.InterruptedException
- wait until value less than c, then run action if nonnull.
The action is run with the synchronization lock held.
whenGreaterEqual
public void whenGreaterEqual(int c,
java.lang.Runnable action)
throws java.lang.InterruptedException
- wait until value greater than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
whenGreater
public void whenGreater(int c,
java.lang.Runnable action)
throws java.lang.InterruptedException
- wait until value greater than c, then run action if nonnull.
The action is run with the synchronization lock held.
|
|||||||||
| Home >> All >> org >> ematgine >> utils >> [ concurrent overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC