de.adom.jade.kernel
Class ActorQueue

java.lang.Object
  extended by de.adom.jade.kernel.ActorQueue
All Implemented Interfaces:
java.io.Serializable

public class ActorQueue
extends java.lang.Object
implements java.io.Serializable

Manages a queue of actors sorted by the points in time when they are going to act. The idea behind this class is that each map manages its own actor queue with all the actors acting on that map. The world also manages a global actor map.

See Also:
Serialized Form

Constructor Summary
ActorQueue()
          Creates a new empy queue for actors.
 
Method Summary
 void addActor(Actor actor)
          Adds an actor to the queue.
 boolean contains(Actor actor)
          Checks whether a given actor is already contained in the queue.
 Actor getNextActor()
          Returns the next actor from the queue.
 boolean isEmpty()
          Determines whether no more actors are left in the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActorQueue

public ActorQueue()
Creates a new empy queue for actors.

Method Detail

addActor

public void addActor(Actor actor)
Adds an actor to the queue. The actor is sorted into the queue according to the point in time at which it will act.

Parameters:
actor - the actor to add

getNextActor

public Actor getNextActor()
Returns the next actor from the queue. The actor is immediately removed from the queue.

Returns:
the next actor in the queue

isEmpty

public boolean isEmpty()
Determines whether no more actors are left in the queue.

Returns:
a boolean value determining whether no more actors are left in the queue

contains

public boolean contains(Actor actor)
Checks whether a given actor is already contained in the queue.

Parameters:
actor - the actor to check
Returns:
a boolean value indicating if the actor is already contained in the queue