NAME
TPath::Index - tree-specific database
VERSION
version 1.007
SYNOPSIS
my $f = MyForester->new; # hypothetical forester for my sort of tree
my $root = next_tree(); # generate my sort of tree
my $index = $f->index($root); # construct reusable index for $root
DESCRIPTION
A cache of information about a particular tree. Reuse indices to save effort.
The chief function of an index is to enable an expression to map a node to its ancestors for those trees that provide this mapping themselves. All tree-specific caches belong here, though.
You should regard the methods and attributes of a TPath::Index as private. The public function of an index is to be the optional second argument of a TPath::Expression's select
method.
ATTRIBUTES
indexed
The map from ids to nodes.
root
The root of the indexed tree.
METHODS
is_root
Expects a node. Returns whether this node is the root of the tree indexed by this index.
index
Cause this index to walk its tree and perform all necessary indexation.
parent
Expects a node and returns the parent of this node.
pc_index
Record the link from child to parent. If this index is unnecessary for a particular variety of tree -- nodes know their parents -- then you should override this method to be a no-op. It assumes all nodes are references and will throw an error if this is not the case.
id
Returns the unique identifier, if any, that identifies this node. This method delegates to the forester's id
method.
The TPath::Forester that generated this index.
AUTHOR
David F. Houghton <dfhoughton@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by David F. Houghton.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 180:
Unknown directive: =attribute