|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Holds every CommandEvent for a particular Commandable (such as a Monster, Player or Spell) waiting to be executed by the game scheduler.
You almost never need to use an EventQueue directly - you can issue commands to a monster, player or other commandable by invoking either of these methods:
Method Summary | |
void |
clear()
Dumps all the events in the queue. |
void |
destroy()
Shuts down the event queue, permanently. |
void |
enqueue(CommandEvent event)
Puts an event at the end of the queue, to be executed after all other events ahead of it finish executing. |
CommandEvent |
find(GenericPredicate p)
Looks for the first event in the queue that matches the passed predicate. |
Commandable |
getOwner()
Gets the agent to which this queue belongs. |
boolean |
isDead()
Checks if the queue is dead (i.e. has been destroyed). |
boolean |
isEmpty()
Returns true if the queue has no events in it. |
boolean |
isIdle()
Returns true if current queue state is QueueState.IDLE |
boolean |
isWaiting()
Returns true if getState() == QueueState.WAITING |
CommandEvent |
peek()
Returns the next item in the queue without removing it. |
void |
pushFront(CommandEvent event)
Puts an event at the front of the queue, so it'll be executed next. |
boolean |
remove(CommandEvent event)
Removes an event from the queue. |
void |
requestEvent()
Notify the producer for this queue (if any) that the queue is ready to receive another event. |
void |
setProducer(AI producer)
Registers an AI with a queue, so when the queue needs another command, it can notify the AI. |
java.lang.String |
shortString()
Returns a short description of the queue. |
int |
size()
Returns the number of events currently in the queue. |
Methods inherited from interface java.lang.Runnable |
run |
Method Detail |
public void setProducer(AI producer)
producer
- an AI. There should be no reason to set
this to anything but an AI. The queue will notify the
AI when it's ready to receive another command.public void requestEvent()
public void enqueue(CommandEvent event)
event
- the Event object to enqueuepublic void pushFront(CommandEvent event)
event
- the event to execute nextpublic void clear()
public boolean remove(CommandEvent event)
public void destroy()
public CommandEvent peek()
public CommandEvent find(GenericPredicate p)
p
- a wyvern.lib.Predicate that returns true if
the event meets whatever criteria the caller is looking for.
public boolean isEmpty()
public int size()
public boolean isWaiting()
public boolean isIdle()
public boolean isDead()
public Commandable getOwner()
public java.lang.String shortString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |