1RefRev(3)             User Contributed Perl Documentation            RefRev(3)
2
3
4

NAME

6       Heap::Elem::RefRev - Perl extension for reversed Object Reverence Heap
7       Elements
8

SYNOPSIS

10         use Heap::Elem::RefRev( RefRElem );
11         use Heap::Fibonacci;
12
13         my $heap = Heap::Fibonacci->new;
14         my $elem;
15
16         foreach $i ( 1..100 ) {
17             $obj = myObject->new( $i );
18             $elem = RefRElem( $obj );
19             $heap->add( $elem );
20         }
21
22         while( defined( $elem = $heap->extract_top ) ) {
23             # assume that myObject object have a method I<printable>
24             print "Largest is ", $elem->val->printable, "\n";
25         }
26

DESCRIPTION

28       Heap::Elem::RefRev is used to wrap object reference values into an ele‐
29       ment that can be managed on a heap.  Each referenced object must have a
30       method cmp which can compare itself with any of the other objects that
31       have references on the same heap.  These comparisons must be consistant
32       with normal arithmetic.  The top of the heap will have the largest
33       (according to cmp) element still remaining.  (See Heap::Elem::Ref if
34       you want the heap to always return the smallest element.)
35
36       The details of the Elem interface are described in Heap::Elem.
37
38       The details of using a Heap interface are described in Heap.
39

AUTHOR

41       John Macdonald, jmm@perlwolf.com
42
44       Copyright 1998-2003, O'Reilly & Associates.
45
46       This code is distributed under the same copyright terms as perl itself.
47

SEE ALSO

49       Heap(3), Heap::Elem(3), Heap::Elem::Ref(3).
50
51
52
53perl v5.8.8                       2004-06-17                         RefRev(3)
Impressum