A class useful for offloading waiting and signalling operations
on single double variables.
Method from EDU.oswego.cs.dl.util.concurrent.WaitableDouble Detail: |
public double add(double amount) {
synchronized (lock_) {
lock_.notifyAll();
return super.add(amount);
}
}
|
public boolean commit(double assumedValue,
double newValue) {
synchronized (lock_) {
boolean success = super.commit(assumedValue, newValue);
if (success) lock_.notifyAll();
return success;
}
}
|
public double divide(double factor) {
synchronized (lock_) {
lock_.notifyAll();
return super.divide(factor);
}
}
|
public double multiply(double factor) {
synchronized (lock_) {
lock_.notifyAll();
return super.multiply(factor);
}
}
|
public double set(double newValue) {
synchronized (lock_) {
lock_.notifyAll();
return super.set(newValue);
}
}
|
public double subtract(double amount) {
synchronized (lock_) {
lock_.notifyAll();
return super.subtract(amount);
}
}
|
public void whenEqual(double c,
Runnable action) throws InterruptedException {
synchronized(lock_) {
while (!(value_ == c)) lock_.wait();
if (action != null) action.run();
}
}
Wait until value equals c, then run action if nonnull.
The action is run with the synchronization lock held.
* |
public void whenGreater(double c,
Runnable action) throws InterruptedException {
synchronized (lock_) {
while (!(value_ > c)) lock_.wait();
if (action != null) action.run();
}
}
wait until value greater than c, then run action if nonnull.
The action is run with the synchronization lock held.
* |
public void whenGreaterEqual(double c,
Runnable action) throws InterruptedException {
synchronized (lock_) {
while (!(value_ >= c)) lock_.wait();
if (action != null) action.run();
}
}
wait until value greater than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
* |
public void whenLess(double c,
Runnable action) throws InterruptedException {
synchronized (lock_) {
while (!(value_ < c)) lock_.wait();
if (action != null) action.run();
}
}
wait until value less than c, then run action if nonnull.
The action is run with the synchronization lock held.
* |
public void whenLessEqual(double c,
Runnable action) throws InterruptedException {
synchronized (lock_) {
while (!(value_ < = c)) lock_.wait();
if (action != null) action.run();
}
}
wait until value less than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
* |
public void whenNotEqual(double c,
Runnable action) throws InterruptedException {
synchronized (lock_) {
while (!(value_ != c)) lock_.wait();
if (action != null) action.run();
}
}
wait until value not equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
* |