|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.mospace.lang.RunnableQueue
public class RunnableQueue
A queue for Runnables that adhere to the RunnableQueue.Job interface,
enqueued jobs are run one after the other in the order in which they have
been enqueued.
Runnable| Nested Class Summary | |
|---|---|
static interface |
RunnableQueue.Job
A Runnable that can be enqueued to a RunnableQueue. |
| Constructor Summary | |
|---|---|
RunnableQueue()
Creates a new RunnableQueue with no jobs. |
|
RunnableQueue(RunnableQueue.Job[] commands)
Creates a new RunnableQueue with the specified jobs. |
|
| Method Summary | |
|---|---|
void |
addChangeListener(ChangeListener l)
Registers a listener that will be notified whenever this runnable queue starts or stops executing. |
void |
clear()
Removes all jobs from the queue. |
boolean |
dequeue(RunnableQueue.Job p)
Removes the first occurrence in this queue of the specified job. |
void |
enqueue(RunnableQueue.Job p)
Adds a new job to the end of this queue. |
protected void |
fireStateChanged()
Notifies all registered listeners that this runnable queue has started or stopped executing. |
RunnableQueue.Job |
getNextRunnable()
Returns the job that will next start executing. |
RunnableQueue.Job |
getRunningRunnable()
Returns the currently running job. |
void |
handleInput(String input)
Forwards text input to the currently running job if it does not have another source of input. |
void |
interrupt()
Stops execution of this queue. |
boolean |
isRunning()
Returns whether this queue is currently running. |
void |
registerExceptionHandler(ExceptionHandler xh)
Registers an exception handler for all jobs in this queue and for all threads started with this queue's start()
method. |
void |
removeChangeListener(ChangeListener l)
Requests that the specified listener no longer be notified when this runnable queue starts or stops executing. |
void |
run()
Executes this queue. |
void |
start()
Starts to execute this queue in a new thread. |
void |
stop()
Stops the currently running job in this queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RunnableQueue(RunnableQueue.Job[] commands)
commands - an array of non-null jobs to initialize the queue withpublic RunnableQueue()
| Method Detail |
|---|
public void run()
run in interface RunnableIllegalStateException - when this queue is already runningpublic void registerExceptionHandler(ExceptionHandler xh)
start()
method.
xh - an exception handlerRunnableQueue.Job.registerExceptionHandler(de.mospace.lang.ExceptionHandler)public RunnableQueue.Job getNextRunnable()
null if no job is awaiting execution in the queuepublic RunnableQueue.Job getRunningRunnable()
null
if no job is running.public void enqueue(RunnableQueue.Job p)
run() or
start() is called.
p - the job to add to the queuepublic boolean dequeue(RunnableQueue.Job p)
p - the job to dequeue
List.remove(Object)public boolean isRunning()
public void start()
IllegalStateException - when this queue is already runningpublic void stop()
RunnableQueue.Job.stop()public void interrupt()
RunnableQueue.Job.stop()public void clear()
public void handleInput(String input)
throws IOException
input - text input for the currently running job
IOExceptionRunnableQueue.Job.hasInput()public void addChangeListener(ChangeListener l)
event.getSource().isRunning(), this will return
true iff the queue has started.
l - a change listener to be notified of future changes in this
queue's statepublic void removeChangeListener(ChangeListener l)
l - the change listener to removeprotected void fireStateChanged()
event.getSource().isRunning(), this will return
true iff the queue has started.
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||