Yage3D.net
 

yage.core.tree

Authors:
Eric Poggel

License:
LGPL v3

class Tree (T): YageObject;
Implements an element that can be used in a tree, with parents and children. This is probably/maybe threadsafe.

Example:
 class Node : Tree!(Node) {}
 auto n = new Node();
 auto n2 = n.addChild(new Node());


template addChild (S : T)
Add a child element. Automatically detaches it from any other element's children.

Params:
child Node to add as a child of this element.

Returns:
A reference to the child.

S addChild (S child);
Add a child element. Automatically detaches it from any other element's children.

Params:
S child Node to add as a child of this element.

Returns:
A reference to the child.

template removeChild (S : T)
Remove a child element

Params:
child An element of type T or that inherits from type T.

Returns:
The child element. For convenience, the return type is templated to match the input type.

S removeChild (S child);
Remove a child element

Params:
S child An element of type T or that inherits from type T.

Returns:
The child element. For convenience, the return type is templated to match the input type.

T[] getChildren ();
Get an array of this element's children.

T getParent ();
Get / set the parent of this element (what it's attached to). Setting a new parent removes it from its old parent's children and returns a self-reference.

bool isChild (T elem);
Is elem a child of this element? This function will also return false if elem is null .

Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:27 2010