José Diaz Seng > DBIx-Table-TestDataGenerator-0.004 > DBIx::Table::TestDataGenerator::TreeUtils

Download:
DBIx-Table-TestDataGenerator-0.004.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

DBIx::Table::TestDataGenerator::TreeUtils - tree builder, used internally to handle self-references in the target table

DESCRIPTION ^

This module has nothing to do with databases and could be used on its own. It handles ordered directed graphs, we call them trees here for lack of a better word, but in general they are trees with the root node cut off. The trees are represented as hashes where the keys are seen as parent identifiers and the values are references to arrays containing the child identifiers as elements. It provides a method add_child which adds a node in a place automatically determined and satisfying constraints defined by the parameters passed to add_child. Branches where no more children will be added are removed from the tree in the process.

SUBROUTINES/METHODS ^

_stack

Stack containing the currently handled node and its ancestors, internal use only.

_handled

Contains the handled nodes, i.e. those not getting any more child nodes, internal use only.

_prune_tree ( $tree_ref, $base )

Arguments:

Removes the root node $base and all its descendants from the tree $tree_ref and returns a reference to the pruned tree, internal use only.

add_child

Arguments:

AUTHOR ^

Jose Diaz Seng, <josediazseng at gmx.de>

LICENSE AND COPYRIGHT ^

Copyright 2012 Jose Diaz Seng.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: