org.omegahat.Numerics.Optimizers
Class BackgroundTaskManager

java.lang.Object
  |
  +--org.omegahat.Environment.TaskManagement.TaskManager
        |
        +--org.omegahat.Numerics.Optimizers.BackgroundTaskManager
All Implemented Interfaces:
DistributedTaskConstants, java.util.EventListener, IterationListener, java.lang.Runnable

public class BackgroundTaskManager
extends TaskManager
implements IterationListener


Field Summary
protected  java.util.Vector listeners
          A collection of listeners interested in events.
 
Fields inherited from class org.omegahat.Environment.TaskManagement.TaskManager
debug, tasks
 
Fields inherited from interface org.omegahat.Environment.TaskManagement.DistributedTaskConstants
SERVER_DISCARD, SERVER_POOL_CLEAR, SERVER_REJECT, TASK_COMPLETED, TASK_DISPATCH, TASK_ERROR
 
Constructor Summary
BackgroundTaskManager()
           
BackgroundTaskManager(TaskQueue q)
           
 
Method Summary
 int addListener(IterationListener l)
          Add the listener to the vector of listeners.
 boolean continueIteration(IterationEvent ev)
           
 java.lang.Object dispatchTask(Task t)
          Invoke the event() method of the task supplied as argument, and inform all the listeners about the resulting event.
 java.util.Vector listeners()
          Get the vector of listeners.
 java.util.Vector listeners(java.util.Vector v)
          Set the vector of listeners.
 void removeListener(IterationListener l)
          Remove this listener from the vector of listeners.
 
Methods inherited from class org.omegahat.Environment.TaskManagement.TaskManager
addListener, addTask, createQueue, getTask, getTask, isComplete, notify, notify, notify, removeListener, run, tasks, tasks, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected java.util.Vector listeners
A collection of listeners interested in events. The manager will take each event and dispatch the methods to those.
Constructor Detail

BackgroundTaskManager

public BackgroundTaskManager()

BackgroundTaskManager

public BackgroundTaskManager(TaskQueue q)
Method Detail

dispatchTask

public java.lang.Object dispatchTask(Task t)
Invoke the event() method of the task supplied as argument, and inform all the listeners about the resulting event. That is, for all the listeners registered with this task manager, pass the event object from the task to the continueIteration method of the listener.
Overrides:
dispatchTask in class TaskManager

continueIteration

public boolean continueIteration(IterationEvent ev)
Specified by:
continueIteration in interface IterationListener

addListener

public int addListener(IterationListener l)
Add the listener to the vector of listeners. Returns the size of the set of listeners.

removeListener

public void removeListener(IterationListener l)
Remove this listener from the vector of listeners.

listeners

public java.util.Vector listeners()
Get the vector of listeners.
Overrides:
listeners in class TaskManager

listeners

public java.util.Vector listeners(java.util.Vector v)
Set the vector of listeners.
Overrides:
listeners in class TaskManager