org.schmant.run
Class ManualTaskDependency

java.lang.Object
  extended by java.util.Observable
      extended by org.schmant.run.ManualTaskDependency
All Implemented Interfaces:
TaskDependency

public class ManualTaskDependency
extends Observable
implements TaskDependency

This is a task dependency that is handled manually. Calling setCompleted() satisfies the dependency.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
ManualTaskDependency()
           
 
Method Summary
 Observable getDependencyObservable()
          Observable that will fire with the dependency as argument when all dependencies are satisfied.
 Lock getSatisfiedStateLock()
          Get the Lock that protects the dependency's satisfied property.
 boolean isSatisfied()
          Is this dependency satisfied?
 void setCompleted()
          This satisfies the dependency.
 String toString()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManualTaskDependency

public ManualTaskDependency()
Method Detail

setCompleted

public void setCompleted()
This satisfies the dependency.


getDependencyObservable

public Observable getDependencyObservable()
Description copied from interface: TaskDependency
Observable that will fire with the dependency as argument when all dependencies are satisfied.

Implementation note: The thread firing an event must own the satisfied state lock on the task dependency object.

Specified by:
getDependencyObservable in interface TaskDependency
Returns:
An Observable to observe.

isSatisfied

public boolean isSatisfied()
Description copied from interface: TaskDependency
Is this dependency satisfied?

Implementation note: This method should be protected by the same lock that can be retrieved by calling TaskDependency.getSatisfiedStateLock().

Specified by:
isSatisfied in interface TaskDependency
Returns:
true if the dependency is satisfied.

getSatisfiedStateLock

public Lock getSatisfiedStateLock()
Description copied from interface: TaskDependency
Get the Lock that protects the dependency's satisfied property. This lock must be locked before the dependency's satisfied state can be update.

An external class can lock this to ensure that the satisfied state is not updated while it holds the lock.

Specified by:
getSatisfiedStateLock in interface TaskDependency
Returns:
The lock used to protect the satisfied state.
See Also:
TaskDependency.isSatisfied()

toString

public String toString()
Overrides:
toString in class Object