hades.simulator
Class CommandQueue

java.lang.Object
  extended byhades.simulator.CommandQueue

public final class CommandQueue
extends java.lang.Object

a simple queue data structure used to manager simulator commands. This class realizes a queue data structure used to hold (interactive) simulator commands (e.g. pauseSimulation). It is implemented using a doubly-linked list with root node, and it synchronizes all accessor method to provide a thread-safe (if possible deadlocking) ordering of queue entries.


Nested Class Summary
(package private)  class CommandQueue.SelftestFeeder
           
(package private)  class CommandQueue.SelftestFetcher
           
 
Constructor Summary
CommandQueue()
          constructor for an empty command queue.
 
Method Summary
 void append(java.lang.Object o)
          append data to the end of this queue
 int countAppends()
           
 int countFetches()
           
 java.lang.Object fetch()
           
 void first()
          set the cursor to the first node of this list
 java.lang.Object getData()
          get data of the cursor node
 boolean isEmpty()
          is this list empty?
 void last()
          set the cursor to the last node of this list
static void main(java.lang.String[] argv)
          main(): simple self test
 void next()
          move the cursor to the next node, if any
 void prev()
          move the cursor to the previous node, if any
 void setData(java.lang.Object o)
          set data of the cursor node
 java.lang.String toString()
          dump text rep of queue
static void usage()
          usage(): how to use the CommandQueue selftest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandQueue

public CommandQueue()
constructor for an empty command queue.

Method Detail

first

public void first()
set the cursor to the first node of this list


last

public final void last()
set the cursor to the last node of this list


next

public final void next()
move the cursor to the next node, if any


prev

public final void prev()
move the cursor to the previous node, if any


getData

public final java.lang.Object getData()
get data of the cursor node


setData

public final void setData(java.lang.Object o)
set data of the cursor node


append

public void append(java.lang.Object o)
append data to the end of this queue


fetch

public java.lang.Object fetch()

isEmpty

public boolean isEmpty()
is this list empty?


countAppends

public int countAppends()

countFetches

public int countFetches()

toString

public java.lang.String toString()
dump text rep of queue


usage

public static void usage()
usage(): how to use the CommandQueue selftest


main

public static void main(java.lang.String[] argv)
main(): simple self test