edu.memphis.ccrg.lida.framework.gui.commands
Class CommandImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.gui.commands.CommandImpl
All Implemented Interfaces:
Command
Direct Known Subclasses:
AddPanelCommand, AddTicksCommand, EnableTicksModeCommand, PauseRunningThreadsCommand, QuitAllCommand, ResetEnvironmentCommand, ResumeRunningThreadsCommand, SetTimeScaleCommand

public abstract class CommandImpl
extends java.lang.Object
implements Command

Abstract implementation of Command. Extend from this base class to create new commands overriding execute(Agent).

Author:
Javier Snaider

Field Summary
protected  java.lang.Object result
          Result of the command's execution.
 
Constructor Summary
CommandImpl()
           
 
Method Summary
abstract  void execute(Agent agent)
          Executes this command performing the necessary actions in the model (the Agent).
 java.lang.Object getParameter(java.lang.String name)
          Gets a parameter by name.
 java.lang.Object getResult()
          Returns result of the command.
 void setParameter(java.lang.String name, java.lang.Object value)
          Set single parameter for command.
 void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Sets optional parameters for command.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

result

protected java.lang.Object result
Result of the command's execution. May be set during the execution of the execute(Agent) method.

Constructor Detail

CommandImpl

public CommandImpl()
Method Detail

execute

public abstract void execute(Agent agent)
Description copied from interface: Command
Executes this command performing the necessary actions in the model (the Agent).

Specified by:
execute in interface Command
Parameters:
agent - Agent Object

getParameter

public java.lang.Object getParameter(java.lang.String name)
Description copied from interface: Command
Gets a parameter by name.

Specified by:
getParameter in interface Command
Parameters:
name - retrieved parameter
Returns:
the parameter

getResult

public java.lang.Object getResult()
Description copied from interface: Command
Returns result of the command.

Specified by:
getResult in interface Command
Returns:
the result of the command's execution

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: Command
Set single parameter for command.

Specified by:
setParameter in interface Command
Parameters:
name - name of parameter
value - default value to use if parameter cannot be found

setParameters

public void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Description copied from interface: Command
Sets optional parameters for command.

Specified by:
setParameters in interface Command
Parameters:
parameters - parameters

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object