1Tree::Simple::Visitor::UBsreeradCtohnFtirTrirsbetueTt:re:adSviePmrepsrlalel:(D:3oV)ciusmietnotra:t:iBorneadthFirstTraversal(3)
2
3
4

NAME

6       Tree::Simple::Visitor::BreadthFirstTraversal - A Visitor for
7       breadth-first traversal a Tree::Simple hierarchy
8

SYNOPSIS

10         use Tree::Simple::Visitor::BreadthFirstTraversal;
11
12         # create an visitor
13         my $visitor = Tree::Simple::Visitor::BreadthFirstTraversal->new();
14
15         # pass our visitor to the tree
16         $tree->accept($visitor);
17
18         # print our results
19         print join ", " => $visitor->getResults();
20
21         # this will print this:
22         #   1, 2, 3, 1.1, 1.2, 2.1, 3.1, 1.1.1
23         # assuming your tree is like this:
24         #   1
25         #     1.1
26         #       1.1.1
27         #     1.2
28         #   2
29         #     2.1
30         #   3
31         #     3.1
32

DESCRIPTION

34       This implements a breadth-first traversal of a Tree::Simple hierarchy.
35       This can be an alternative to the built in depth-first traversal of the
36       Tree::Simple "traverse" method.
37

METHODS

39       new There are no arguments to the constructor the object will be in its
40           default state. You can use the  "setNodeFilter" method to customize
41           its behavior.
42
43       includeTrunk ($boolean)
44           Based upon the value of $boolean, this will tell the visitor to
45           include the trunk of the tree in the traversal as well.
46
47       setNodeFilter ($filter_function)
48           This method accepts a CODE reference as its $filter_function
49           argument and throws an exception if it is not a code reference.
50           This code reference is used to filter the tree nodes as they are
51           collected. This can be used to customize output, or to gather
52           specific information from a more complex tree node. The filter
53           function should accept a single argument, which is the current
54           Tree::Simple object.
55
56       visit ($tree)
57           This is the method that is used by Tree::Simple's "accept" method.
58           It can also be used on its own, it requires the $tree argument to
59           be a Tree::Simple object (or derived from a Tree::Simple object),
60           and will throw and exception otherwise.
61
62       getResults
63           This method returns the accumulated results of the application of
64           the node filter to the tree.
65

BUGS

67       None that I am aware of. Of course, if you find a bug, let me know, and
68       I will be sure to fix it.
69

CODE COVERAGE

71       See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more
72       information.
73

SEE ALSO

75       These Visitor classes are all subclasses of Tree::Simple::Visitor,
76       which can be found in the Tree::Simple module, you should refer to that
77       module for more information.
78

AUTHOR

80       stevan little, <stevan@iinteractive.com>
81
83       Copyright 2004, 2005 by Infinity Interactive, Inc.
84
85       <http://www.iinteractive.com>
86
87       This library is free software; you can redistribute it and/or modify it
88       under the same terms as Perl itself.
89
90
91
92perl v5.30.0                   Tre2e0:1:9S-i0m7p-l2e6::Visitor::BreadthFirstTraversal(3)
Impressum