ist.palcom.communication.ast
Class Command

java.lang.Object
  extended by ist.palcom.communication.ast.ASTNode
      extended by ist.palcom.communication.ast.ControlItem
          extended by ist.palcom.communication.ast.Command
All Implemented Interfaces:
Cloneable

public class Command
extends ControlItem
implements Cloneable


Field Summary
static String DIRECTION_IN
           
static String DIRECTION_OUT
           
 
Fields inherited from class ist.palcom.communication.ast.ASTNode
CHANGE, children, generatedWithCacheCycle, generatedWithCircularEnabled, IN_CIRCLE, LAST_CYCLE, numChildren, parent
 
Constructor Summary
Command()
           
Command(CommandInfo p0, List p1)
           
Command(String id, String direction)
           
 
Method Summary
 void addParam(Param node)
           
 void addParamAndInfo(Param param)
           
 Object clone()
           
 ASTNode copy()
           
 ControlItem findItem(String id)
          Returns the ControlItem within the sub-tree rooted at this ControlItem that has the sought ID, or null if none exists.
 Command findMatchingCommand(Command command)
          Implements this method for Commands (overrides the one in ControlItem).
 void flushCache()
           
 ASTNode fullCopy()
           
 Command getCopy()
          Returns a copy of this command, with the same ID and the same parameters and parameter values.
 String getDirection()
           
 String getHelp()
           
 CommandInfo getInfo()
           
 Info getInfoAsInfo()
          Workaround for static typing.
 CommandInfo getInfoNoTransform()
           
 int getNumParam()
           
 Param getParam(int i)
           
 Param getParam(String id)
          Returns a param with ID id, or null if none is found.
 List getParamList()
           
 List getParamListNoTransform()
           
 void invoke()
          Invoke this command.
 boolean isAboutTheSameEntityAs(Info info)
           
protected  boolean matches(Command command)
          Returns true if this Command matches command.
protected  int numChildren()
           
 void setDataRefsAndAddDataToList(ArrayList dataList)
           
 void setDataAccordingToDataRefs(byte[][] data)
           
 void setHelp(String help)
           
 void setInfo(CommandInfo node)
           
 void setParam(Param node, int i)
           
 void setParamList(List list)
           
 void update(Command command)
          Update this Command with the parameter values in command.
 
Methods inherited from class ist.palcom.communication.ast.ControlItem
getID, getMessage, getServiceProxy, getTagName, initializeFromElement, writeStartTagAndAttributes, writeXMLElement
 
Methods inherited from class ist.palcom.communication.ast.ASTNode
addChild, getChild, getChildNoTransform, getIndexOfChild, getNumChild, getParent, insertChild, remove, removeChild, setChild, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, println, toString
 

Field Detail

DIRECTION_IN

public static final String DIRECTION_IN
See Also:
Constant Field Values

DIRECTION_OUT

public static final String DIRECTION_OUT
See Also:
Constant Field Values
Constructor Detail

Command

public Command()

Command

public Command(CommandInfo p0,
               List p1)

Command

public Command(String id,
               String direction)
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class ControlItem
Throws:
CloneNotSupportedException

copy

public ASTNode copy()
Overrides:
copy in class ASTNode

fullCopy

public ASTNode fullCopy()
Overrides:
fullCopy in class ASTNode

flushCache

public void flushCache()
Overrides:
flushCache in class ControlItem

numChildren

protected int numChildren()
Overrides:
numChildren in class ControlItem

setInfo

public void setInfo(CommandInfo node)

getInfo

public CommandInfo getInfo()

getInfoNoTransform

public CommandInfo getInfoNoTransform()

setParamList

public void setParamList(List list)

getNumParam

public int getNumParam()

getParam

public Param getParam(int i)

addParam

public void addParam(Param node)

setParam

public void setParam(Param node,
                     int i)

getParamList

public List getParamList()

getParamListNoTransform

public List getParamListNoTransform()

isAboutTheSameEntityAs

public boolean isAboutTheSameEntityAs(Info info)

getInfoAsInfo

public Info getInfoAsInfo()
Description copied from class: ControlItem
Workaround for static typing.

Specified by:
getInfoAsInfo in class ControlItem

getDirection

public String getDirection()

getHelp

public String getHelp()

setHelp

public void setHelp(String help)

findItem

public ControlItem findItem(String id)
Description copied from class: ControlItem
Returns the ControlItem within the sub-tree rooted at this ControlItem that has the sought ID, or null if none exists. This method is overridden in appropriate subclasses.

Overrides:
findItem in class ControlItem

findMatchingCommand

public Command findMatchingCommand(Command command)
Implements this method for Commands (overrides the one in ControlItem). Returns this Command if it matches command, and null if not.

Overrides:
findMatchingCommand in class ControlItem

setDataRefsAndAddDataToList

public void setDataRefsAndAddDataToList(ArrayList dataList)
Specified by:
setDataRefsAndAddDataToList in class ControlItem

setDataAccordingToDataRefs

public void setDataAccordingToDataRefs(byte[][] data)
Specified by:
setDataAccordingToDataRefs in class ControlItem

getCopy

public Command getCopy()
Returns a copy of this command, with the same ID and the same parameters and parameter values.


getParam

public Param getParam(String id)
Returns a param with ID id, or null if none is found.


invoke

public void invoke()
Invoke this command. This means that it will be sent to registered receivers in the surrounding ServiceProxy, with the current parameter values. Which receivers that are notified depends on the actual type of this object. If there is no surrounding ServiceProxy, nothing will happen.


matches

protected boolean matches(Command command)
Returns true if this Command matches command. A Command is considered to match if it has the same ID, and if all params have the same ID and the same types, and are in the same order.


update

public void update(Command command)
Update this Command with the parameter values in command. If command does not match this Command, nothing happens.


addParamAndInfo

public void addParamAndInfo(Param param)