ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Scram/ProjectSearcher.pm
Revision: 1.1.2.1
Committed: Thu May 4 07:53:40 2000 UTC (25 years ago) by williamc
Content type: text/plain
Branch: V0_9branch
CVS Tags: BuildSystemProto1, V0_18_0, V0_18_0model, V0_17_1, V0_18_0alpha, V0_17_0, V0_16_4, V0_16_3, V0_16_2, V0_16_1, V0_16_0, V0_15_1, V0_15_0, V0_15_0beta, V0_14_0, V0_12_12_4, V0_12_12_3, V0_13_3, V0_13_2, V0_12_12_2, V0_12_12_1, V0_12_12_0, PlayGround_0, V0_13_1, V0_13_0, V0_12_12, V0_12_11, V0_12_9b, V0_12_10, V0_12_9, V0_12_8, V0_12_7, V0_12_6, V0_12_5, V0_12_4, V0_12_3
Branch point for: V0_17branch, V0_16branch, V0_15branch, HPWbranch
Changes since 1.1: +53 -0 lines
Log Message:
new initialaisations

File Contents

# User Rev Content
1 williamc 1.1.2.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     }