Access keysTop, Summary, Constructors,
Class properties,
Instance properties,
Instance methodsFlowTreeNode
| Kind of class: |
class |
| Inherits from: |
TreeNode
|
| Version: |
20 July 2005 |
| Author: |
Arthur Clemens |
| Classpath: |
playground.classes.data.tree.FlowTreeNode |
| File last modified: |
Wednesday, 13 September 2006, 11:43:37 |
/*
Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import playground.classes.data.KeyValueList;
import playground.classes.data.tree.*;
import org.asapframework.util.StringUtilsSplit;
/**
FlowTreeNode is an instruction storage class used by {@link FlowController}.
This is a typical instruction line:
<code>
question2, label=This is question 2, text="Was Mick Jagger the lead singer of the Beatles?", type=condition, yes=trunk1end, no=screen5
</code>
FlowTreeNode lists a number of reserved instruction attributes:
<ul>
<li>{@link #type}</li>
<li>{@link #label}</li>
<li>{@link #text}</li>
<li>{@link #method}</li>
<li>{@link #await}</li>
<li>{@link #timeout}</li>
<li>{@link #parameters}</li>
</ul>
Other attributes can be used, with arbitrary names. For instance, you might want to use the attributes {@code wrong} and {@code right}:
<code>
question2, label=This is question 2, text="Was Mick Jagger the lead singer of the Beatles?", type=condition, wrong=trunk1end, right=screen5
</code>
The attribute values of these names can be retrieved with {@link TreeNode#getValueForKey}.
@author Arthur Clemens
@version 20 July 2005
*/
class playground.classes.data.tree.FlowTreeNode extends TreeNode {
private var mParameters:Array;
private var mConditions:Array;
private static var DELIMITER:String = ",";
/**
Creates a new FlowTreeNode.
*/
function FlowTreeNode (inName:String,
inProperties:KeyValueList)
{
super(inName, inProperties);
}
/**
The node's type attribute. Possible types:
<ul>
<li>condition</li>
<li>action</li>
<li>await</li>
<li>exit</li>
</ul>
See {@link FlowController#run} to see how FlowController deals with these types.
*/
public function get type () : String
{
return String(mProperties.getValueForKey("type"));
}
/**
The node's label attribute.
*/
public function get label () : String
{
return String(mProperties.getValueForKey("label"));
}
/**
The node's text attribute.
*/
public function get text () : String
{
return String(mProperties.getValueForKey("text"));
}
/**
The node's method attribute.
*/
public function get method () : String
{
return String(mProperties.getValueForKey("method"));
}
/**
The node's await attribute.
*/
public function get await () : String
{
return String(mProperties.getValueForKey("await"));
}
/**
The node's timeout attribute.
*/
public function get timeout () : String
{
return String(mProperties.getValueForKey("timeout"));
}
/**
The node's method parameters attribute.
*/
public function get parameters () : Array
{
if (mParameters == undefined) {
var params:String = String(mProperties.getValueForKey("parameters"));
mParameters = StringUtilsSplit.splitAndPreserveQuotes(params, FlowTreeNode.DELIMITER);
}
return mParameters;
}
/**
The node's evaluate conditions attribute.
*/
public function get conditions () : Array
{
if (mConditions == undefined) {
var conditions:String = String(mProperties.getValueForKey("conditions"))
mConditions = StringUtilsSplit.splitAndPreserveQuotes(conditions, FlowTreeNode.DELIMITER);
}
return mConditions;
}
/**
@exclude
*/
public function toString () : String
{
return "(FlowTreeNode) name=" + mName + "; depth=" + mDepth + "; parent name=" + mParent.name + "; child count=" + mChildren.length + "; owner=" + mOwner + "\n\t type=" + type + "\n\t label=" + label + "\n\t text=" + text + "\n\t parameters=" + parameters + "\n\t conditions=" + conditions;
}
// PRIVATE METHODS
/**
This method must be implemented by all subclasses of {@link TreeNode}.
*/
private function createNewNode (inName:String, inProperties:KeyValueList) : FlowTreeNode
{
return new FlowTreeNode(inName, inProperties);
}
}
This is a typical instruction line:
question2, label=This is question 2, text="Was Mick Jagger the lead singer of the Beatles?", type=condition, yes=trunk1end, no=screen5
FlowTreeNode lists a number of reserved instruction attributes:
Other attributes can be used, with arbitrary names. For instance, you might want to use the attributes
wrong and
right:
question2, label=This is question 2, text="Was Mick Jagger the lead singer of the Beatles?", type=condition, wrong=trunk1end, right=screen5
The attribute values of these names can be retrieved with
TreeNode.getValueForKey.
Summary
Class properties
Class properties inherited from TreeNode
Instance properties
Instance properties inherited from TreeNode
children,
count,
depth,
firstChild,
mChildren,
mDepth,
mName,
mNamePath,
mParent,
mPosition,
mProperties,
mTree,
name,
namePath,
owner,
parent,
position,
properties
Instance methods
Instance methods inherited from TreeNode
addChild,
createNamePath,
createNewNode,
deleteChildren,
doGetNodeWithPath,
getCount,
getLastNode,
getNode,
getNodes,
getNodeWithAbsolutePath,
getNodeWithRelativePath,
getValueForKey,
kill,
printNodes,
toString
Constructor
FlowTreeNode
Creates a new FlowTreeNode.
Class properties
DELIMITER
static private DELIMITER:String = ","
(read,write)
Instance properties
await
The node's await attribute.
conditions
The node's evaluate conditions attribute.
label
The node's label attribute.
mConditions
private mConditions:Array
(read,write)
method
The node's method attribute.
mParameters
private mParameters:Array
(read,write)
parameters
The node's method parameters attribute.
text
The node's text attribute.
timeout
The node's timeout attribute.
type
The node's type attribute. Possible types:
See
FlowController.run to see how FlowController deals with these types.
Instance methods
createNewNode
private function createNewNode (
This method must be implemented by all subclasses of
TreeNode.