jsim.animator
Class AnimationQueue

java.lang.Object
  extended by jsim.animator.AnimationQueue

public class AnimationQueue
extends java.lang.Object

This class implements a queue to hold AnimationMessages It is a shared data structure between Animator and Simulator Simulator puts messages on the queue and Animator takes messages off the queue


Constructor Summary
AnimationQueue()
          Contructor Initializes the queue
 
Method Summary
 AnimationMessage dequeue()
          Return and remove the message at the front of the queue Blocks using wait until message is available
 void enqueue(AnimationMessage am)
          Add a message to the end of the queue Then notify any threads that may be waiting for this
 boolean isEmpty()
           
 AnimationMessage top()
          Return but do not remove the message at the front of the queue Blocks using wait until message is available
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationQueue

public AnimationQueue()
Contructor Initializes the queue

Method Detail

enqueue

public void enqueue(AnimationMessage am)
Add a message to the end of the queue Then notify any threads that may be waiting for this

Parameters:
am - AnimationMessage to be enqueued

top

public AnimationMessage top()
Return but do not remove the message at the front of the queue Blocks using wait until message is available

Returns:
the first message on the queue

dequeue

public AnimationMessage dequeue()
Return and remove the message at the front of the queue Blocks using wait until message is available

Returns:
the first message on the queue

isEmpty

public boolean isEmpty()
Returns:
true if there are no messages on the queue false otherwise