.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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::AVLNode 3pm" .TH Paranoid::Data::AVLTree::AVLNode 3pm 2024-03-07 "perl v5.38.2" "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::AVLNode \- AVL Tree Node Object Class .SH VERSION .IX Header "VERSION" \&\f(CW$Id:\fR lib/Paranoid/Data/AVLTree/AVLNode.pm, 2.10 2022/03/08 00:01:04 acorliss Exp $ .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 10 \& $node = Paranoid::Data::AVLTree::AVLNode\->new($key, $val); \& $key = $node\->key; \& $val = $node\->val; \& $rv = $node\->setVal($val); \& $ref = $node\->right; \& $rv = $node\->setRight($node); \& $ref = $node\->left; \& $rv = $node\->setLeft($node); \& $rv = $node\->incrRHeight; \& $rv = $node\->incrLHeight; \& $rv = $node\->addRHeight($n); \& $rv = $node\->addLHeight($n); \& $rv = $node\->decrRHeight; \& $rv = $node\->decrLHeight; \& $balance = $node\->balance; \& $count = $node\->count; \& $height = $node\->height; \& $height = $node\->rHeight; \& $height = $node\->lHeight; \& $rv = $node\->updtHeights; \& @crefs = $node\->children; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This class provides the core data objects that comprise an AVL-balanced tree. .SH SUBROUTINES/METHODS .IX Header "SUBROUTINES/METHODS" .SS new .IX Subsection "new" .Vb 1 \& $node = Paranoid::Data::AVLTree::AVLNode\->new($key, $val); .Ve .PP This method creates a new AVLNode object. Like hashes, the key must be defined, but it cannot be a zero-length string. In those cases, this method will return undef. .SS key .IX Subsection "key" .Vb 1 \& $key = $node\->key; .Ve .PP This method returns the key for the node. .SS val .IX Subsection "val" .Vb 1 \& $val = $node\->val; .Ve .PP This method returns the associated value for the node. It can be undef. .SS setVal .IX Subsection "setVal" .Vb 1 \& $rv = $node\->setVal($val); .Ve .PP This method sets the assocated value for the node. .SS right .IX Subsection "right" .Vb 1 \& $ref = $node\->right; .Ve .PP This method retrieves a reference to the next right-side node in the branch, if any. .SS setRight .IX Subsection "setRight" .Vb 1 \& $rv = $node\->setRight($node); .Ve .PP This method sets/removes the reference to the next right-side node in the branch. .SS left .IX Subsection "left" .Vb 1 \& $ref = $node\->left; .Ve .PP This method retrieves a reference to the next left-side node in the branch, if any. .SS setLeft .IX Subsection "setLeft" .Vb 1 \& $rv = $node\->setLeft($node); .Ve .PP This method sets/removes the reference to the next left-side node in the branch. .SS incrRHeight .IX Subsection "incrRHeight" .Vb 1 \& $rv = $node\->incrRHeight; .Ve .PP This method increments the height counter for the ride-side sub-branch. .SS incrLHeight .IX Subsection "incrLHeight" .Vb 1 \& $rv = $node\->incrLHeight; .Ve .PP This method increments the height counter for the left-side sub-branch. .SS addRHeight .IX Subsection "addRHeight" .Vb 1 \& $rv = $node\->addRHeight($n); .Ve .PP This method adds the passed value to the height counter for the right-side sub-branch. .SS addLHeight .IX Subsection "addLHeight" .Vb 1 \& $rv = $node\->addLHeight($n); .Ve .PP This method adds the passed value to the height counter for the left-side sub-branch. .SS decrRHeight .IX Subsection "decrRHeight" .Vb 1 \& $rv = $node\->decrRHeight; .Ve .PP This method decrements the height counter for the right-side sub-branch. .SS decrLHeight .IX Subsection "decrLHeight" .Vb 1 \& $rv = $node\->decrLHeight; .Ve .PP This method decrements the height counter for the left-side sub-branch. .SS balance .IX Subsection "balance" .Vb 1 \& $balance = $node\->balance; .Ve .PP This returns the node balance, which is a relative indidcator of the disparity in heights of the right & left sub-branches. A negative number denotes a longer left-side branch, zero means equal sub-branch heights, and a positive integer denotes a longer right-side branch. .SS count .IX Subsection "count" .Vb 1 \& $count = $node\->count; .Ve .PP This method returns the count of nodes, including all nodes in linked sub-branches. .SS height .IX Subsection "height" .Vb 1 \& $height = $node\->height; .Ve .PP This method returns the longest height of the node and any attached sub-branches. .SS rHeight .IX Subsection "rHeight" .Vb 1 \& $height = $node\->rHeight; .Ve .PP This method returns the height of the right-side sub-branch, or zero if there is no linked branch. .SS lHeight .IX Subsection "lHeight" .Vb 1 \& $height = $node\->lHeight; .Ve .PP This method returns the height of the left-side sub-branch, or zero if there is no linked branch. .SS updtHeights .IX Subsection "updtHeights" .Vb 1 \& $rv = $node\->updtHeights; .Ve .PP This method performs a brute force recalculation of all attached sub-branches. .SS children .IX Subsection "children" .Vb 1 \& @crefs = $node\->children; .Ve .PP This returns references to the next nodes in any attadhed sub-branches. .SH DEPENDENCIES .IX Header "DEPENDENCIES" .IP o 4 .IX Item "o" Carp .IP o 4 .IX Item "o" Paranoid .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 "Paranoid" have been or are conveyed under any of the above licenses. However, "Paranoid" 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)