ubiware.core.commands
Class BlockingCommand<E>

java.lang.Object
  extended by ubiware.core.commands.BlockingCommand<E>
All Implemented Interfaces:
UbiwareAgentCommand<E>

public class BlockingCommand<E>
extends java.lang.Object
implements UbiwareAgentCommand<E>

Implementation of a command that has an extra method waitForExecution() which only returns once the command has been executed. 15.3.2010

Author:
Michael Cochez for UBIWARE project

Constructor Summary
BlockingCommand(UbiwareAgentCommand<E> command)
          Create the command with the wrapped command.
 
Method Summary
 E getResult()
          Get the result of the action performed.
 void performCommand(UbiwareAgent agent)
          The code which will get executed by the agent.
 E waitForExecution()
          This method only returns once the wrapped command has been executed It returns the same value as getResult returns after this call has been made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockingCommand

public BlockingCommand(UbiwareAgentCommand<E> command)
Create the command with the wrapped command.

Parameters:
command - The wrapped command
Method Detail

performCommand

public void performCommand(UbiwareAgent agent)
Description copied from interface: UbiwareAgentCommand
The code which will get executed by the agent.

Specified by:
performCommand in interface UbiwareAgentCommand<E>
Parameters:
agent - The agent which is executing the command

waitForExecution

public E waitForExecution()
This method only returns once the wrapped command has been executed It returns the same value as getResult returns after this call has been made.


getResult

public E getResult()
Description copied from interface: UbiwareAgentCommand
Get the result of the action performed. If the UbiwareAgentCommand.performCommand(UbiwareAgent) has not been executed, the behavior of this method is undefined.

Specified by:
getResult in interface UbiwareAgentCommand<E>
Returns:
The result of the performed action