public class Command
extends java.lang.Object
CMD_SYNTAX| Constructor and Description |
|---|
Command(java.lang.String cmd,
java.lang.String remark,
Parameter[] parameter)
Constructor for CommandFrame, used for template generation
used by CommandFactory.createCommand(cmd, remark, parameter).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(java.lang.String key,
java.lang.String value)
Add a parameter in commands parameter-array
|
void |
addParameterCat(java.lang.String key,
java.lang.String[] value)
Add a parameter with value-compnents (e.g. coordinates) in commands parameter-array
|
desmoj.extensions.visualization2d.engine.command.CommandFrame |
clone()
creates a clone of a command
|
void |
execute(Model model)
This method describes for every command-type, how it's modeled in animation.model.Model.
|
static boolean |
existCommand(java.lang.String cmd)
checks if a command with name cmd in cmdTemplate exist.
|
java.lang.String |
getCmd()
Geter of command-name (command-type)
|
static Command |
getCommandInit(java.lang.String cmd,
long initTime)
Get a clone of command-template with name cmd
for init-phase
|
static Command |
getCommandTime(java.lang.String cmd,
long time)
Get a clone of command-template with name cmd
for run-phase time-value
|
Parameter |
getParameter(int i)
Get's i.th parameter from command's parameter-array
|
java.lang.String[] |
getParameterSplit(java.lang.String key,
int i)
Get the i.th parameter-value of type key.
|
Parameter |
getParameterType(java.lang.String type)
Get's the parameter of type from command's parameter-array
The parameter-type is unique in parameter-array
|
java.lang.String |
getRemark()
Geter of command-remark
|
long |
getTime()
get's time-value of command, makes sense only in run-phase
|
static void |
init_cmdTemplate()
Reads CommandSyntax, creates for each a templeate and store them in cmdTemplate
|
boolean |
isInit()
check if command belongs to init-phase
|
boolean |
isTempleate()
check if command is a template
|
static void |
main(java.lang.String[] args)
only for testing
|
static desmoj.extensions.visualization2d.engine.command.CommandFrame |
parseCommand(java.lang.String cmd)
Makes a syntax-check for cmd-string and create a CommandFrame of parsed cmd-string
|
void |
setInit(long startTime)
when set this, command belongs to init-phase
|
void |
setNoTemplate()
when set this, this command is no template
|
void |
setRemark(java.lang.String remark)
Setter of command-remark
|
void |
setTime(long time)
when set this, command belongs to run-phase with time-value time
|
boolean |
syntaxCheck()
Makes a syntax-check of command
|
java.lang.String |
toString()
Creates an information-string of command, used for log-file
|
static java.lang.String |
writeTemplates()
Write a information-string with all existing command-templates
|
public Command(java.lang.String cmd,
java.lang.String remark,
Parameter[] parameter)
cmd - command-nameremark - remark about templateparameter - Array of Parameter's where each parameter must have a different typepublic static Command getCommandInit(java.lang.String cmd, long initTime) throws CommandException
cmd - CommandExceptionpublic static Command getCommandTime(java.lang.String cmd, long time) throws CommandException
cmd - time - CommandExceptionpublic void execute(Model model) throws CommandException, ModelException
CommandExceptionModelExceptionpublic static void main(java.lang.String[] args)
args - no argspublic static void init_cmdTemplate()
throws CommandException
CommandExceptionpublic static boolean existCommand(java.lang.String cmd)
cmd - public static desmoj.extensions.visualization2d.engine.command.CommandFrame parseCommand(java.lang.String cmd)
throws CommandException
cmd - CommandExceptionpublic static java.lang.String writeTemplates()
throws CommandException
CommandExceptionpublic java.lang.String getCmd()
public java.lang.String getRemark()
public void setRemark(java.lang.String remark)
remark - public Parameter getParameter(int i)
i - public Parameter getParameterType(java.lang.String type)
type - public void addParameter(java.lang.String key,
java.lang.String value)
throws CommandException
key - parameter-typevalue - parameter-valueCommandException, - when parameter-type is not valid (why no quantifier check????)CommandExceptionpublic void addParameterCat(java.lang.String key,
java.lang.String[] value)
throws CommandException
key - parameter-typevalue - parameter-componentsCommandException, - when parameter-type is not validCommandExceptionpublic java.lang.String[] getParameterSplit(java.lang.String key,
int i)
throws CommandException
key - i - CommandExceptionpublic void setInit(long startTime)
public void setTime(long time)
time - public void setNoTemplate()
public boolean isInit()
public boolean isTempleate()
public long getTime()
public boolean syntaxCheck()
throws CommandException
CommandExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic desmoj.extensions.visualization2d.engine.command.CommandFrame clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException