org.jagatoo.commands
Interface Command

All Known Subinterfaces:
NoParamCommand
All Known Implementing Classes:
CommandBase, InputActionCommand, NoParamCommandBase

public interface Command

An interface for a command to be processed.


Method Summary
 java.lang.Object[] createParametersArray(java.util.ArrayList<java.lang.String> parameters)
          Creates a parameters array for the given command line.
 java.lang.String execute(java.lang.Boolean inputInfo, CommandLine commandLine)
          Executes this command.
 java.lang.String execute(java.lang.Boolean inputInfo, java.lang.Object[] parameters)
          Executes this command.
 java.lang.String execute(CommandLine commandLine)
          Executes this command.
 java.lang.String execute(java.lang.Object[] parameters)
          Executes this command.
 java.lang.String getKey()
           
 java.lang.String getLocalizedText()
           
 int getNumParameters()
           
 java.lang.String[] getParameterTypes()
           
 java.lang.String getText()
           
 

Method Detail

getKey

java.lang.String getKey()
Returns:
this command's key (like "bind" or "jump").

getText

java.lang.String getText()
Returns:
a descriptive text for this Command.
See Also:
getLocalizedText()

getLocalizedText

java.lang.String getLocalizedText()
Returns:
a localozed descriptive text for this Command. You should prefer this method over getText().

getNumParameters

int getNumParameters()
Returns:
the number of expected parameters.

getParameterTypes

java.lang.String[] getParameterTypes()
Returns:
an array containing the String representation of the parameter types used for highlighting.

createParametersArray

java.lang.Object[] createParametersArray(java.util.ArrayList<java.lang.String> parameters)
Creates a parameters array for the given command line.


execute

java.lang.String execute(java.lang.Boolean inputInfo,
                         java.lang.Object[] parameters)
                         throws CommandException
Executes this command.
If a CommandException is thrown, then only its info text is displayed.

Parameters:
inputInfo - this Boolean is true for a key-down or wheel-up and false for a key-up or wheel-down. The Command implementation must be aware of the fact, that this Boolean can be null.
parameters - the command's parameters
Returns:
this command's result if successful. Used to give the user a textual response to the command execution. May be null for simple commands.
Throws:
CommandException

execute

java.lang.String execute(java.lang.Object[] parameters)
                         throws CommandException
Executes this command.
If a CommandException is thrown, then only its info text is displayed.

Parameters:
parameters - the command's parameters
Returns:
this command's result if successful. Used to give the user a textual response to the command execution. May be null for simple commands.
Throws:
CommandException
java.lang.Throwable

execute

java.lang.String execute(java.lang.Boolean inputInfo,
                         CommandLine commandLine)
                         throws CommandException
Executes this command.
If a CommandException is thrown, then only its info text is displayed.

Parameters:
inputInfo - this Boolean is true for a key-down or wheel-up and false for a key-up or wheel-down. The Command implementation must be aware of the fact, that this Boolean can be null.
commandLine - the CommandLine to extract the parameters array from
Returns:
this command's result if successful. Used to give the user a textual response to the command execution. May be null for simple commands.
Throws:
CommandException

execute

java.lang.String execute(CommandLine commandLine)
                         throws CommandException
Executes this command.
If a CommandException is thrown, then only its info text is displayed.

Parameters:
commandLine - the CommandLine to extract the parameters array from
Returns:
this command's result if successful. Used to give the user a textual response to the command execution. May be null for simple commands.
Throws:
CommandException
java.lang.Throwable