Class TreeNode

Description

This is the building piece of the Tree data structure used for the backbone of the hierarchy.

  • version: $Id: TreeNode.class.php,v 1.8 2007/09/04 20:25:42 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/oki2/hierarchy/tree/TreeNode.class.php (line 17)

TreeNodeInterface
   |
   --TreeNode
Variable Summary
array $_children
string $_id
array $_parents
Method Summary
TreeNode TreeNode (string $id)
void addChild (ref $child)
void detachChild (ref $child)
ref getChildren ()
integer getChildrenCount ()
string getId ()
ref getParents ()
integer getParentsCount ()
boolean hasChildren ()
boolean hasParents ()
boolean isChild (ref $node)
boolean isDescendantOf (object node $node)
boolean isParent (ref $node)
Variables
array $_children (line 45)

The children of this node. The index of each element of the array is the string representation of the Id of the corresponding Node.

  • var: _children
  • access: protected
string $_id (line 25)

The id (string representation) for this node.

  • var: _id
  • access: protected
array $_parents (line 35)

The parents of this node. The index of each element of the array is the string representation of the Id of the corresponding Node.

  • var: _parent
  • access: protected
Methods
Constructor TreeNode (line 53)

Constructor.

TreeNode TreeNode (string $id)
  • string $id: The id of this Node.
addChild (line 93)

Adds a new child for this node.

  • access: public
void addChild (ref $child)
  • ref $child: object child The child node to add.

Redefinition of:
TreeNodeInterface::addChild()
Adds a new child for this node.
detachChild (line 137)

Detaches the child from this node. The child remains in the hierarchy.

  • access: public
void detachChild (ref $child)
  • ref $child: object child The child node to detach.

Redefinition of:
TreeNodeInterface::detachChild()
Detaches the child from this node. The child remains in the hierarchy.
getChildren (line 195)

Returns the children of this node in the order they were added.

  • return: array An array of the children nodes of this node.
  • access: public
ref getChildren ()

Redefinition of:
TreeNodeInterface::getChildren()
Returns the children of this node in the order they were added.
getChildrenCount (line 205)

Returns the number of children for this node.

  • return: The number of children for this node.
  • access: public
integer getChildrenCount ()

Redefinition of:
TreeNodeInterface::getChildrenCount()
Returns the number of children for this node.
getId (line 260)

Returns the id of this node.

  • return: The id of this node.
  • access: public
string getId ()

Redefinition of:
TreeNodeInterface::getId()
Returns the id of this node.
getParents (line 164)

Returns the parent node of this node.

  • return: array The parent nodes of this node.
  • access: public
ref getParents ()

Redefinition of:
TreeNodeInterface::getParents()
Returns the parent node of this node.
getParentsCount (line 174)

Returns the number of parents for this node.

  • return: The number of parents for this node.
  • access: public
integer getParentsCount ()

Redefinition of:
TreeNodeInterface::getParentsCount()
Returns the number of parents for this node.
hasChildren (line 216)

Determines if this node has any children.

  • return:
    1. true
    if this node has at least one child;
    1. false
    , otherwise.
  • access: public
boolean hasChildren ()

Redefinition of:
TreeNodeInterface::hasChildren()
Determines if this node has any children.
hasParents (line 185)

Determines if this node has any parents.

  • return:
    1. true
    if this node has at least one parent;
    1. false
    , otherwise.
  • access: public
boolean hasParents ()

Redefinition of:
TreeNodeInterface::hasParents()
Determines if this node has any parents.
isChild (line 227)

Checks if the given node is a child of this node.

  • return:
    1. true
    if
    1. $node
    is a child of this node.
  • access: public
boolean isChild (ref $node)
  • ref $node: object node The child node to check.

Redefinition of:
TreeNodeInterface::isChild()
Checks if the given node is a child of this node.
isDescendantOf (line 72)

Returns true if this TreeNode is among the children of the given node.

  • return: True, if this TreeNode is among the children of
    1. $node
    .
  • access: public
boolean isDescendantOf (object node $node)
  • object node $node: The node to start recursing from.
isParent (line 244)

Checks if the given node is a parent of this node.

  • return:
    1. true
    if
    1. $node
    is a parent of this node.
  • access: public
boolean isParent (ref $node)
  • ref $node: object node The child node to check.

Redefinition of:
TreeNodeInterface::isParent()
Checks if the given node is a parent of this node.

Inherited Methods

Inherited From TreeNodeInterface

TreeNodeInterface::addChild()
TreeNodeInterface::detachChild()
TreeNodeInterface::getChildren()
TreeNodeInterface::getChildrenCount()
TreeNodeInterface::getId()
TreeNodeInterface::getParents()
TreeNodeInterface::getParentsCount()
TreeNodeInterface::hasChildren()
TreeNodeInterface::hasParents()
TreeNodeInterface::isChild()
TreeNodeInterface::isParent()

Documentation generated on Wed, 19 Sep 2007 10:27:34 -0400 by phpDocumentor 1.3.0RC3