org.kalmeo.util.worker
Class Worker

java.lang.Object
  extended by org.kalmeo.util.worker.Worker
All Implemented Interfaces:
java.lang.Runnable

public class Worker
extends java.lang.Object
implements java.lang.Runnable

Author:
bbeaulant

Field Summary
static Worker instance
           
 
Constructor Summary
Worker()
           
 
Method Summary
 int getFrameDuration()
           
 boolean isCurrentThread()
           
 boolean isRunning()
           
 void pushTask(WorkerTask task)
          Push a task to th worker task list.
 void removeAllTasks()
          Remove all instances of WorkerTask from task list.
 boolean removeTask(WorkerTask task)
          Remove the first instance of a WorkerTask instance from task list
 void run()
           
 void setFrameDuration(int frameDuration)
           
 void setWorkerErrorListener(WorkerErrorListener workerErrorListener)
           
 void start()
          Start the worker
 void stop()
          Stop the worker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final Worker instance
Constructor Detail

Worker

public Worker()
Method Detail

setWorkerErrorListener

public void setWorkerErrorListener(WorkerErrorListener workerErrorListener)
Parameters:
workerErrorListener -

isCurrentThread

public boolean isCurrentThread()
Returns:
true if the current Thread is the Worker thread

isRunning

public boolean isRunning()
Returns:
the running

getFrameDuration

public int getFrameDuration()
Returns:
the frameDuration

setFrameDuration

public void setFrameDuration(int frameDuration)
Parameters:
frameDuration - the frameDuration to set in milliseconds

pushTask

public void pushTask(WorkerTask task)
Push a task to th worker task list.

Parameters:
task -

removeTask

public boolean removeTask(WorkerTask task)
Remove the first instance of a WorkerTask instance from task list

Parameters:
task -
Returns:
true if the task is correctly removed

removeAllTasks

public void removeAllTasks()
Remove all instances of WorkerTask from task list. The action is possible only if the worker is not running.


start

public void start()
Start the worker


stop

public void stop()
Stop the worker


run

public void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 2007-2008 Kalmeo. All Rights Reserved.