Revision: | 1.2 |
Committed: | Mon Aug 28 08:35:15 2000 UTC (24 years, 8 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.1: | +53 -0 lines |
Log Message: | remove Interface.pm |
# | 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 | } |