Top Description Fields Constructors Methods
EDU.oswego.cs.dl.util.concurrent

public Class WaitableFloat

extends SynchronizedFloat
Class Inheritance

A class useful for offloading waiting and signalling operations on single float variables.

See Also
Introduction to this package.

Field Summary

Inherited from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat:
value_

Constructor Summary

AccessConstructor and Description
public
WaitableFloat(float initialValue)

Make a new WaitableFloat with the given initial value, and using its own internal lock.

public
WaitableFloat(float initialValue, Object lock)

Make a new WaitableFloat with the given initial value, and using the supplied lock.

Method Summary

Modifier and TypeMethod and Description
public float
add(float amount)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.add.

Add amount to value (i.e., set value += amount)
public boolean
commit(float assumedValue, float newValue)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.commit.

Set value to newValue only if it is currently assumedValue.
public float
divide(float factor)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.divide.

Divide value by factor (i.e., set value /= factor)
public float
multiply(float factor)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.multiply.

Multiply value by factor (i.e., set value *= factor)
public float
set(float newValue)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.set.

Set to newValue.
public float
subtract(float amount)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.subtract.

Subtract amount from value (i.e., set value -= amount)
public void
whenEqual(float c, Runnable action)

Wait until value equals c, then run action if nonnull.

public void
whenGreater(float c, Runnable action)

wait until value greater than c, then run action if nonnull.

public void
whenGreaterEqual(float c, Runnable action)

wait until value greater than or equal to c, then run action if nonnull.

public void
whenLess(float c, Runnable action)

wait until value less than c, then run action if nonnull.

public void
whenLessEqual(float c, Runnable action)

wait until value less than or equal to c, then run action if nonnull.

public void
whenNotEqual(float c, Runnable action)

wait until value not equal to c, then run action if nonnull.

Inherited from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat:
compareTocompareTocompareToequalsgethashCodeswaptoString

Constructor Detail

WaitableFloatback to summary
public WaitableFloat(float initialValue)

Make a new WaitableFloat with the given initial value, and using its own internal lock.

WaitableFloatback to summary
public WaitableFloat(float initialValue, Object lock)

Make a new WaitableFloat with the given initial value, and using the supplied lock.

Method Detail

addback to summary
public float add(float amount)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.add.

Doc from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.add.

Add amount to value (i.e., set value += amount)

Returns:float

the new value

commitback to summary
public boolean commit(float assumedValue, float newValue)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.commit.

Doc from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.commit.

Set value to newValue only if it is currently assumedValue.

Returns:boolean

true if successful

divideback to summary
public float divide(float factor)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.divide.

Doc from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.divide.

Divide value by factor (i.e., set value /= factor)

Returns:float

the new value

multiplyback to summary
public float multiply(float factor)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.multiply.

Doc from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.multiply.

Multiply value by factor (i.e., set value *= factor)

Returns:float

the new value

setback to summary
public float set(float newValue)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.set.

Doc from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.set.

Set to newValue.

Returns:float

the old value

subtractback to summary
public float subtract(float amount)

Overrides EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.subtract.

Doc from EDU.oswego.cs.dl.util.concurrent.SynchronizedFloat.subtract.

Subtract amount from value (i.e., set value -= amount)

Returns:float

the new value

whenEqualback to summary
public void whenEqual(float c, Runnable action) throws InterruptedException

Wait until value equals c, then run action if nonnull. The action is run with the synchronization lock held.

whenGreaterback to summary
public void whenGreater(float c, Runnable action) throws InterruptedException

wait until value greater than c, then run action if nonnull. The action is run with the synchronization lock held.

whenGreaterEqualback to summary
public void whenGreaterEqual(float c, Runnable action) throws InterruptedException

wait until value greater than or equal to c, then run action if nonnull. The action is run with the synchronization lock held.

whenLessback to summary
public void whenLess(float c, Runnable action) throws InterruptedException

wait until value less than c, then run action if nonnull. The action is run with the synchronization lock held.

whenLessEqualback to summary
public void whenLessEqual(float c, Runnable action) throws InterruptedException

wait until value less than or equal to c, then run action if nonnull. The action is run with the synchronization lock held.

whenNotEqualback to summary
public void whenNotEqual(float c, Runnable action) throws InterruptedException

wait until value not equal to c, then run action if nonnull. The action is run with the synchronization lock held.