Documentation
¶
Overview ¶
Package actTree implements a double-linked tree data structure. Features: (tiny footprint intended)
- create a new tree: actTree.New()
- add a node or merge a subtree: Add(), AddNode()
- go over all nodes by preferred order: WalkThrough()
- goto a neighbor node: Prev(), Next()
- split the tree at a node being the root of a subtree: Cut()
- remove a node and its kids: Remove()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Node ¶
type Node struct {
Value interface{} //user-defined content value to associate with the node
// contains filtered or unexported fields
}
type Tree ¶
type Tree struct {
Root *Node //first node of the tree
}
func (*Tree) AddNode ¶
AddNode adds a new kid or sibling node to the tree. The new node will be added after the prev node. When the prev node has no kid, new node is added as firstKid, or it is added as a sibling of firstKid. Note that the new node can be the root of another tree, making it a merge(join) function of trees.
Click to show internal directories.
Click to hide internal directories.