public class DOMSequence.TaskElement extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
TaskElement(Element src)
Constructs a new task element from an element.
|
| Modifier and Type | Method and Description |
|---|---|
private String[] |
extractAll(NodeList list)
Returns a string array of all first child nodes of the nodes found in
the list.
|
String[] |
getCommand()
Returns all command templates tied to this task.
|
private String |
getCommandAttribute(String template,
String att)
Returns the value of the attribute of the given name within the
command with the given template.
|
String |
getCommandID(String template)
Returns the command id-attribute linked to the command with
argumental command template.
|
String |
getCommandInit(String template)
Returns the command initialization string.
|
String |
getCommandParameter(String template)
Returns all parameter names linked to the command element whose
template name is equal to the argument.
|
String |
getCommandRef(String template)
Returns the command ref-attribute linked to the command with
argumental command template.
|
private String |
getCommandTemplate(Element command)
Returns the command template specified in this command-element.
|
String |
getComplete()
Returns the complete condition tied to this task.
|
String |
getCondition()
Returns the condition of this task element.
|
String[] |
getFalse()
Returns all triggers by name that get false as tied to this task.
|
String |
getID()
Returns the value of the id attribute of this task element.
|
Map<String,Object> |
getSet()
Returns a map of parameter names to new parameter values.
|
private NodeList |
getSub(String tag)
Returns a node list of elements with the given tag name.
|
String[] |
getTrue()
Returns all triggers by name that get true as tied to this task.
|
boolean |
isDone()
Returns true if the value of the done attribute of this task
element is true.
|
boolean |
isSending()
Returns true if the value of the done attribute of this task
element is sending.
|
void |
setCommand(String[] templates)
Sets the command templates tied to this task.
|
private void |
setCommandAttribute(String template,
String att,
String val)
Adds or updates an attribute of the given name within the command
with the given template.
|
void |
setCommandID(String template,
String id)
Sets the command id-attribute linked to the command with argumental
command template.
|
void |
setCommandInit(String template,
String init)
Sets the command parameter-attribute linked to the command with the
given template name.
|
void |
setCommandParameter(String template,
String parameter)
Sets the command parameter-attribute linked to the command with the
given template name.
|
void |
setCommandRef(String template,
String ref)
Sets the command ref-attribute linked to the command with argumental
command template.
|
void |
setDone(boolean to)
Sets the value of the done attribute.
|
void |
setSending()
Sets the value of the done attribute to
DTDConstants.SENDING. |
String |
toString()
String version of a task element is its ID plus info on done/sending
status if applicable.
|
private final Element anchor
protected TaskElement(Element src)
DTDConstants.TASK an
IllegalArgumentException is thrown.public String getID()
public boolean isDone()
public boolean isSending()
public void setDone(boolean to)
public void setSending()
DTDConstants.SENDING.
This method should be called after a condition is met, all the
command templates have been extracted and sent to the devices. After
this method has been called, further calls to getCommand()
return null to indicate that no more commands have to be
sent for this task.public String getCondition()
public String getComplete()
public String[] getCommand()
DTDConstants.SENDING (via the done attribute
of the task), null is returned.public String getCommandInit(String template)
public String getCommandParameter(String template)
public String getCommandID(String template)
public String getCommandRef(String template)
public void setCommandID(String template, String id)
public void setCommandRef(String template, String ref)
public void setCommandParameter(String template, String parameter)
public void setCommandInit(String template, String init)
public void setCommand(String[] templates)
public String[] getTrue()
public String[] getFalse()
public Map<String,Object> getSet()
DTDConstants.SET elements. Each DTDConstants.SET element has an
attribute, DTDConstants.SETNAME, which is used as a parameter name, i.e.
a key in the returned map. The first sub-text-node value of the
set-element is used as the new parameter value, i.e. is the value
matched to the key. If the DTDConstants.CLASS attribute is given, the
value object is of the stated class, constructed with the text-value
string.DTDConstants.SET elements is given.public String toString()
private String getCommandTemplate(Element command)
private String getCommandAttribute(String template, String att)
private void setCommandAttribute(String template, String att, String val)
template - The command which attribute should be set.att - The name of the attribute.val - The new value of the attribute.