ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Scram/ProjectSearcher.pm
Revision: 1.3
Committed: Fri Apr 29 16:13:47 2005 UTC (20 years ago) by sashby
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Files moved from Scram to SCRAM.

File Contents

# Content
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 }