1package Heap::Elem::NumRev;
2
3use strict;
4use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
5use Heap::Elem;
6
7require Exporter;
8
9@ISA = qw(Exporter Heap::Elem);
10
11# No names exported.
12@EXPORT = ( );
13
14# Available for export: NumRElem (to allocate a new Heap::Elem::NumRev value)
15@EXPORT_OK = qw( NumRElem );
16
17$VERSION = '0.80';
18
19sub NumRElem {	# exportable synonym for new
20    Heap::Elem::NumRev->new(@_);
21}
22
23# compare two NumR elems (reverse order)
24sub cmp {
25    return $_[1][0] <=> $_[0][0];
26}
27
281;
29__END__
30
31=head1 NAME
32
33Heap::Elem::NumRev - Reversed Numeric Heap Elements
34
35=head1 SYNOPSIS
36
37  use Heap::Elem::NumRev( NumRElem );
38  use Heap::Fibonacci;
39
40  my $heap = Heap::Fibonacci->new;
41  my $elem;
42
43  foreach $i ( 1..100 ) {
44      $elem = NumRElem( $i );
45      $heap->add( $elem );
46  }
47
48  while( defined( $elem = $heap->extract_top ) ) {
49      print "Largest is ", $elem->val, "\n";
50  }
51
52=head1 DESCRIPTION
53
54Heap::Elem::NumRev is used to wrap numeric values into an element
55that can be managed on a heap.  The top of the heap will have
56the largest element still remaining.  (See L<Heap::Elem::Num>
57if you want the heap to always return the smallest element.)
58
59The details of the Elem interface are described in L<Heap::Elem>.
60
61The details of using a Heap interface are described in L<Heap>.
62
63=head1 AUTHOR
64
65John Macdonald, john@perlwolf.com
66
67=head1 COPYRIGHT
68
69Copyright 1998-2007, O'Reilly & Associates.
70
71This code is distributed under the same copyright terms as perl itself.
72
73=head1 SEE ALSO
74
75Heap(3), Heap::Elem(3), Heap::Elem::Num(3).
76
77=cut
78