ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Scram/SearchIterator.pm
Revision: 1.3
Committed: Wed Nov 15 10:08:27 2000 UTC (24 years, 6 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: V1_0_1, V1_0_0, V1_pre0, SCRAM_V1, SCRAMV1_IMPORT, V0_19_7, V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3, V0_19_2, V0_19_1, V0_19_0, V0_18_5, V0_18_4, V_18_3_TEST, VO_18_3, V0_18_3, V0_18_2, V0_18_1
Branch point for: V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B
Changes since 1.2: +1 -1 lines
Log Message:
Import from V0_18_0

File Contents

# User Rev Content
1 williamc 1.2 #
2     # SearchIterator.pm
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     #
8     # Interface
9     # ---------
10 williamc 1.3 # new(searcher) : A new SearchIterator object
11 williamc 1.2 # reset() : reset the iteractor
12     # next() : return the next index value
13     # last() : Have we reached the end? 1=Yes 0=No
14    
15     package Scram::SearchIterator;
16     require 5.004;
17    
18     sub new {
19     my $class=shift;
20     $self={};
21     bless $self, $class;
22     $self->{searcher}=shift;
23     $self->reset();
24     return $self;
25     }
26    
27     sub reset {
28     my $self=shift;
29     $self->{index}=0;
30     }
31    
32     sub next {
33     my $self=shift;
34     $self->{index}++;
35     return ($self->{searcher}->get($self->{index}));
36     }
37    
38     sub last {
39     my $self=shift;
40     my $rv=0;
41     $rv=1, if ($self->{index} >= $self->{searcher}->levels());
42     return $rv;
43     }