.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Paranoid::Data::AVLTree 3pm" .TH Paranoid::Data::AVLTree 3pm "2021-01-02" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Paranoid::Data::AVLTree \- AVL\-Balanced Tree Class .SH "VERSION" .IX Header "VERSION" \&\f(CW$Id:\fR lib/Paranoid/Data/AVLTree.pm, 2.08 2020/12/31 12:10:06 acorliss Exp $ .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # Preferred use \& tie %tree, \*(AqParanoid::Data::AVLTree\*(Aq; \& \& # Or, purely as an object \& $tree = new Paranoid::Data::AVLTree; \& $count = $tree\->count; \& $height = $tree\->height; \& @keys = $tree\->nodeKeys; \& $rv = $tree\->nodeExists($key): \& $val = $tree\->fetchVal($key); \& $rv = $tree\->addPair($key, $value); \& $rv = $tree\->delNode($key); \& $rv = $tree\->purgeNodes; \& $tree\->dumpKeys; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides an AVL-balance tree implementation, that can work both as an independent object or as a tied hash. Future versions will include methods to allow for simple spooling to and from disk. .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& $tree = new Paranoid::Data::AVLTree; .Ve .PP This creates a new tree object. .SS "count" .IX Subsection "count" .Vb 1 \& $count = $tree\->count; .Ve .PP This method returns a count of all the nodes in the tree. .SS "height" .IX Subsection "height" .Vb 1 \& $height = $tree\->height; .Ve .PP This method returns the height of the tree. .SS "nodeKeys" .IX Subsection "nodeKeys" .Vb 1 \& @keys = $tree\->nodeKeys; .Ve .PP This method returns a list of all keys for all nodes in the tree. .SS "nodeExists" .IX Subsection "nodeExists" .Vb 1 \& $rv = $tree\->nodeExists($key): .Ve .PP This method returns a boolean value indicating whether a node exists wtih a matching key. .SS "fetchVal" .IX Subsection "fetchVal" .Vb 1 \& $val = $tree\->fetchVal($key); .Ve .PP This method returns the associated value for the passed key. Like hashes, it will return undef for nonexistant keys. .SS "addPair" .IX Subsection "addPair" .Vb 1 \& $rv = $tree\->addPair($key, $value); .Ve .PP This method adds the requested key/value pair, or updates an existing node with the same key. It will return a boolean false if the key is an invalid value. .SS "delNode" .IX Subsection "delNode" .Vb 1 \& $rv = $tree\->delNode($key); .Ve .PP This method deletes the specified node if it exists. It will return boolean false should no matching node exist. .SS "purgeNodes" .IX Subsection "purgeNodes" .Vb 1 \& $rv = $tree\->purgeNodes; .Ve .PP This purges all nodes from the tree. .SS "dumpKeys" .IX Subsection "dumpKeys" .Vb 1 \& $tree\->dumpKeys; .Ve .PP This method exists purely for diagnostic purposes. It dumps a formatted tree structure to \fB\s-1STDERR\s0\fR showing all keys in the tree, along with the relative branch height and balance of every node, along with what side of the tree each node is attached. .SS "\s-1TIE METHODS\s0" .IX Subsection "TIE METHODS" These methods aren't intended for direct use, but to support tied hashes. .PP \fI\s-1CLEAR\s0\fR .IX Subsection "CLEAR" .PP \fI\s-1DELETE\s0\fR .IX Subsection "DELETE" .PP \fI\s-1EXISTS\s0\fR .IX Subsection "EXISTS" .PP \fI\s-1FETCH\s0\fR .IX Subsection "FETCH" .PP \fI\s-1FIRSTKEY\s0\fR .IX Subsection "FIRSTKEY" .PP \fI\s-1NEXTKEY\s0\fR .IX Subsection "NEXTKEY" .PP \fI\s-1SCALAR\s0\fR .IX Subsection "SCALAR" .PP \fI\s-1STORE\s0\fR .IX Subsection "STORE" .PP \fI\s-1TIEHASH\s0\fR .IX Subsection "TIEHASH" .PP \fI\s-1UNTIE\s0\fR .IX Subsection "UNTIE" .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" .IP "o" 4 .IX Item "o" Carp .IP "o" 4 .IX Item "o" Paranoid .IP "o" 4 .IX Item "o" Paranoid::Debug .IP "o" 4 .IX Item "o" Paranoid::Data::AVLTree::AVLNode .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" .SH "AUTHOR" .IX Header "AUTHOR" Arthur Corliss (corliss@digitalmages.com) .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" This software is free software. Similar to Perl, you can redistribute it and/or modify it under the terms of either: .PP .Vb 7 \& a) the GNU General Public License \& as published by the \& Free Software Foundation ; either version 1 \& , or any later version \& , or \& b) the Artistic License 2.0 \& , .Ve .PP subject to the following additional term: No trademark rights to \&\*(L"Paranoid\*(R" have been or are conveyed under any of the above licenses. However, \*(L"Paranoid\*(R" may be used fairly to describe this unmodified software, in good faith, but not as a trademark. .PP (c) 2005 \- 2020, Arthur Corliss (corliss@digitalmages.com) (tm) 2008 \- 2020, Paranoid Inc. (www.paranoid.com)