Package nl.rrd.wool.model.command
Class WoolActionCommand
- java.lang.Object
-
- nl.rrd.wool.model.command.WoolCommand
-
- nl.rrd.wool.model.command.WoolAttributesCommand
-
- nl.rrd.wool.model.command.WoolActionCommand
-
- All Implemented Interfaces:
Cloneable
public class WoolActionCommand extends WoolAttributesCommand
This command models the <<action ...>> command in WOOL. It specifies an action that should be performed along with a statement. It can be part of aWoolNodeBody(along with an agent statement) or aWoolReply(to be performed when the user chooses the reply). Three different action commands are supported:- image
- video
- generic
-
-
Field Summary
Fields Modifier and Type Field Description static StringTYPE_GENERICstatic StringTYPE_IMAGEstatic StringTYPE_VIDEO
-
Constructor Summary
Constructors Constructor Description WoolActionCommand(String type, WoolVariableString value)WoolActionCommand(WoolActionCommand other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(String name, WoolVariableString value)WoolActionCommandclone()Returns a deep copy of this command.voidexecuteBodyCommand(Map<String,Object> variables, WoolNodeBody processedBody)This method is called if this command occurs in a statement body.WoolReplyfindReplyById(int replyId)Tries to find a reply with the specified ID within this command.voidgetNodePointers(Set<WoolNodePointer> pointers)Retrieves all node pointers that occur in this command and adds them to the specified list.Map<String,WoolVariableString>getParameters()voidgetReadVariableNames(Set<String> varNames)Retrieves all variable names that are read in this command and adds them to the specified set.StringgetType()Returns the type of thisWoolActionCommandas a String.WoolVariableStringgetValue()voidgetWriteVariableNames(Set<String> varNames)Retrieves all variable names that are written in this command and adds them to the specified set.static WoolActionCommandparse(WoolBodyToken cmdStartToken, CurrentIterator<WoolBodyToken> tokens, WoolNodeState nodeState)voidsetParameters(Map<String,WoolVariableString> parameters)voidsetType(String type)Sets the type of thisWoolActionCommand, which should be one of "image", "video", or "generic".voidsetValue(WoolVariableString value)StringtoString()-
Methods inherited from class nl.rrd.wool.model.command.WoolAttributesCommand
parseAttributesCommand, readAttr, readIntAttr, readPlainTextAttr, readVariableAttr
-
-
-
-
Field Detail
-
TYPE_IMAGE
public static final String TYPE_IMAGE
- See Also:
- Constant Field Values
-
TYPE_VIDEO
public static final String TYPE_VIDEO
- See Also:
- Constant Field Values
-
TYPE_GENERIC
public static final String TYPE_GENERIC
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WoolActionCommand
public WoolActionCommand(String type, WoolVariableString value)
- Parameters:
type- the type of thisWoolActionCommandas a String, which should be one of "image", "video", or "generic".value- the value of this command
-
WoolActionCommand
public WoolActionCommand(WoolActionCommand other)
-
-
Method Detail
-
getType
public String getType()
Returns the type of thisWoolActionCommandas a String.- Returns:
- the type of this
WoolActionCommandas a String.
-
setType
public void setType(String type)
Sets the type of thisWoolActionCommand, which should be one of "image", "video", or "generic".- Parameters:
type- the type of thisWoolActionCommand.
-
getValue
public WoolVariableString getValue()
-
setValue
public void setValue(WoolVariableString value)
-
getParameters
public Map<String,WoolVariableString> getParameters()
-
setParameters
public void setParameters(Map<String,WoolVariableString> parameters)
-
addParameter
public void addParameter(String name, WoolVariableString value)
-
findReplyById
public WoolReply findReplyById(int replyId)
Description copied from class:WoolCommandTries to find a reply with the specified ID within this command. If no such reply is found, this method returns null.- Specified by:
findReplyByIdin classWoolCommand- Parameters:
replyId- the reply ID- Returns:
- the reply or null
-
getReadVariableNames
public void getReadVariableNames(Set<String> varNames)
Description copied from class:WoolCommandRetrieves all variable names that are read in this command and adds them to the specified set.- Specified by:
getReadVariableNamesin classWoolCommand- Parameters:
varNames- the set to which the variable names are added
-
getWriteVariableNames
public void getWriteVariableNames(Set<String> varNames)
Description copied from class:WoolCommandRetrieves all variable names that are written in this command and adds them to the specified set.- Specified by:
getWriteVariableNamesin classWoolCommand- Parameters:
varNames- the set to which the variable names are added
-
getNodePointers
public void getNodePointers(Set<WoolNodePointer> pointers)
Description copied from class:WoolCommandRetrieves all node pointers that occur in this command and adds them to the specified list.- Specified by:
getNodePointersin classWoolCommand- Parameters:
pointers- the list to which the node pointers are added
-
executeBodyCommand
public void executeBodyCommand(Map<String,Object> variables, WoolNodeBody processedBody) throws EvaluationException
Description copied from class:WoolCommandThis method is called if this command occurs in a statement body. It executes the command with respect to the specified variable map. Any body content that should be sent to the client, is added to "processedBody". This content can be text or client commands, with all variables resolved.- Specified by:
executeBodyCommandin classWoolCommand- Parameters:
variables- the variable mapprocessedBody- the processed body- Throws:
EvaluationException- if an expression cannot be evaluated
-
parse
public static WoolActionCommand parse(WoolBodyToken cmdStartToken, CurrentIterator<WoolBodyToken> tokens, WoolNodeState nodeState) throws LineNumberParseException
- Throws:
LineNumberParseException
-
clone
public WoolActionCommand clone()
Description copied from class:WoolCommandReturns a deep copy of this command.- Specified by:
clonein classWoolCommand- Returns:
- a deep copy of this command
-
-