nl.tudelft.goal.ut2004.actions
Class ActionQueue

Package class diagram package ActionQueue
java.lang.Object
  extended by nl.tudelft.goal.ut2004.actions.ActionQueue

public final class ActionQueue
extends Object

Smart queue for actions. There is a limited bandwidth to transfer actions between GOAL and the UT2004Bot. GOAL will send actions at a high rate and could saturate the queue. To prevent this we check which actions are in the queue before adding a new action. There are three possible scenarios:

Author:
mpkorstanje

Constructor Summary
ActionQueue(int capacity)
           
 
Method Summary
 Collection<Action> drain()
          Drains all actions from the queue.
 void put(Action action)
          Puts an action on the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionQueue

public ActionQueue(int capacity)
Method Detail

put

public void put(Action action)
         throws InterruptedException
Puts an action on the queue. If the queue is full this method will block. The action is added intelligently to the queue. Should the results of this action happened to override or cancel out an action already in the queue the action in the queue will be removed.

Parameters:
action -
Throws:
InterruptedException

drain

public Collection<Action> drain()
Drains all actions from the queue.

Returns:
a collection of actions to be executed.


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.