ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Scram/ProjectSearcher.pm
(Generate patch)

Comparing COMP/SCRAM/src/Scram/ProjectSearcher.pm (file contents):
Revision 1.1 by williamc, Thu May 4 07:53:40 2000 UTC vs.
Revision 1.2 by williamc, Mon Aug 28 08:35:15 2000 UTC

# Line 0 | Line 1
1 + #
2 + # ProjectSearcher.pm
3 + #
4 + # Originally Written by Christopher Williams
5 + #
6 + # Description
7 + #
8 + # Interface
9 + # ---------
10 + # new(ScramProjectDB)      : A new ProjectSearcher object
11 + # addproject(name,version) : add the name,version of a project
12 + # get(level)               : return the item corresponding to the nth level
13 + # newiterator()            : return an iterator;
14 + # levels                   : return the number of levels available
15 +
16 + package Scram::ProjectSearcher;
17 + use Scram::SearchIterator;
18 + require 5.004;
19 +
20 + sub new {
21 +        my $class=shift;
22 +        $self={};
23 +        bless $self, $class;
24 +        $self->{db}=shift;
25 +        $self->{level}=0;
26 +        return $self;
27 + }
28 +
29 + sub get {
30 +        my $self=shift;
31 +        my $level=shift;
32 +
33 +        # instantiate object
34 +        return $self->{db}->getarea(@{$self->{projects}[$level]});
35 + }
36 +
37 + sub addproject {
38 +        my $self=shift;
39 +        my $name=shift;
40 +        my $version=shift;
41 +
42 +        $self->{projects}[$self->{level}++]=[ $name, $version ];
43 + }
44 +
45 + sub newiterator {
46 +        my $self=shift;
47 +        return Scram::SearchIterator->new($self);
48 + }
49 +
50 + sub levels {
51 +        my $self=shift;
52 +        return $self->{level}-1;
53 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines