Access keysTop, Summary, Constructors,
Instance properties,
Instance methodsBaseTreeNode
| Kind of class: |
class |
| Inherits from: |
none |
| Known subclasses: |
|
| Version: |
20 July 2005 |
| Author: |
Arthur Clemens |
| Classpath: |
data.tree.BaseTreeNode |
| File last modified: |
Monday, 25 July 2005, 00:40:12 |
/*
Copyright 2005 by the authors of asapframework
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 data.tree.*;
/**
Bare bones tree node class of a position tree: nodes with children, no left/right nodes.
Every {@code BaseTreeNode} subclass should implement a custom constructor and the (private) method {@link #createNewNode}. That method is a Factory method; it returns for each subclass implementation the node with the desired type. When adding nodes to the Tree, all child nodes automatically 'inherit' the type from their parent.
@author Arthur Clemens
@version 20 July 2005
*/
class data.tree.BaseTreeNode {
private var mName:String; /**< Unique identifier. */
private var mNamePath:String; /**< Identifier path. */
private var mProperties:Object; /**< Value object with properties to store with this node. */
private var mDepth:Number; /**< Depth of the node. 0 is reserved for the root node. */
private var mOwner:Tree; /**< Reference to the Tree that owns the node. */
private var mParent:TreeNode; /**< Parent node. */
private var mChildren:Array; /*< Child nodes (typical of a position tree). */
private var mPosition:Number; /**< Position in children array */
function BaseTreeNode (inName:String, inProperties:Object)
{
// subclasses might want to have parameter checks here
mName = inName;
mProperties = inProperties;
}
/**
Creates a new node. Should be implemented by subclasses.
@param inName : name for the new node; the name should be unique and without spaces
@param inProperties : generic data object; intended to use as Value Object to store key/value pairs
@return The newly created node.
*/
private function createNewNode (inName:String, inProperties:Object) : BaseTreeNode
{
return new BaseTreeNode(inName, inProperties);
}
}
Bare bones tree node class of a position tree: nodes with children, no left/right nodes.
Every
BaseTreeNode subclass should implement a custom constructor and the (private) method
createNewNode. That method is a Factory method; it returns for each subclass implementation the node with the desired type. When adding nodes to the Tree, all child nodes automatically 'inherit' the type from their parent.
Constructor
BaseTreeNode
function BaseTreeNode (
inName:String,
inProperties:Object)
Instance properties
mChildren
private mChildren:Array
(read,write)
mDepth
private mDepth:Number
(read,write)
Depth of the node. 0 is reserved for the root node.
mName
private mName:String
(read,write)
Unique identifier.
mNamePath
private mNamePath:String
(read,write)
Identifier path.
mOwner
Reference to the Tree that owns the node.
mPosition
private mPosition:Number
(read,write)
Position in children array
mProperties
private mProperties:Object
(read,write)
Value object with properties to store with this node.
Instance methods
createNewNode
private function createNewNode (
Creates a new node. Should be implemented by subclasses.
Parameters:
inName :
name for the new node; the name should be unique and without spaces
inProperties:
generic data object; intended to use as Value Object to store key/value pairs
Returns:The newly created node.