jerklib.tasks
Class TaskImpl

java.lang.Object
  extended by jerklib.tasks.TaskImpl
All Implemented Interfaces:
IRCEventListener, Task
Direct Known Subclasses:
NickServAuthPlugin

public abstract class TaskImpl
extends Object
implements Task

An impl of the Task interface. This impl also provides methods for notifications to listeners.

Author:
mohadib
See Also:
Session.onEvent(Task), Session.onEvent(jerklib.tasks.Task, jerklib.events.IRCEvent.Type...), IRCEvent.Type

Constructor Summary
TaskImpl(String name)
           
 
Method Summary
 void addTaskListener(TaskCompletionListener listener)
          Add a listener to be notified by this Task
 void cancel()
          Cancel a task.
 String getName()
          Gets the name of a task
 List<TaskCompletionListener> getTaskListeners()
          get a list of TaskCompletionListeners
 boolean isCanceled()
           
 boolean removeTaskListener(TaskCompletionListener listener)
          remove a listener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jerklib.listeners.IRCEventListener
receiveEvent
 

Constructor Detail

TaskImpl

public TaskImpl(String name)
Method Detail

getName

public String getName()
Description copied from interface: Task
Gets the name of a task

Specified by:
getName in interface Task
Returns:
name of task

cancel

public void cancel()
Description copied from interface: Task
Cancel a task. This task will not run again. If the task is currently running it will finish then not run again.

Specified by:
cancel in interface Task

isCanceled

public boolean isCanceled()
Specified by:
isCanceled in interface Task
Returns:
true if task is canceled , else false

addTaskListener

public void addTaskListener(TaskCompletionListener listener)
Add a listener to be notified by this Task

Parameters:
listener -
See Also:
taskComplete(Object)

removeTaskListener

public boolean removeTaskListener(TaskCompletionListener listener)
remove a listener

Parameters:
listener -
Returns:
true if a listener was removed , else false

getTaskListeners

public List<TaskCompletionListener> getTaskListeners()
get a list of TaskCompletionListeners

Returns:
list of listeners