[Bio] / Sprout / FidCheck.pm Repository:
ViewVC logotype

Annotation of /Sprout/FidCheck.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     package FidCheck;
4 :    
5 :     require Exporter;
6 :     @ISA = ('Exporter');
7 :     @EXPORT = qw();
8 :     @EXPORT_OK = qw();
9 :    
10 :     use strict;
11 :     use Tracer;
12 :    
13 :     =head1 Feature ID Checker
14 :    
15 :     =head2 Introduction
16 :    
17 :     This object supports the C<is_deleted_fid> method to determine whether or not
18 :     a feature exists in a Sprout or FIG data store.
19 :    
20 :     =head2 Public Methods
21 :    
22 :     =head3 new
23 :    
24 :     C<< my $fidCheck = FidCheck->new($sprout_or_fig); >>
25 :    
26 :     Construct a new FidCheck object from a specified Sprout, FIG, or SFXlate object.
27 :    
28 :     =over 4
29 :    
30 :     =item sprout_or_fig
31 :    
32 :     A Sprout object that may be used to access the database, or a FIG object that
33 :     may be used to access the data store.
34 :    
35 :     =back
36 :    
37 :     =cut
38 :    
39 :     sub new {
40 :     # Get the parameters.
41 :     my ($class, $sprout_or_fig) = @_;
42 :     # Declare the return variable.
43 :     my $retVal;
44 :     # Check the object type.
45 :     if (ref($sprout_or_fig) eq 'Sprout') {
46 :     # Here we have a Sprout object.
47 :     $retVal = { db => $sprout_or_fig };
48 :     bless $retVal, $class;
49 :     } else {
50 :     # Return the object unmodified. It already has the required method.
51 :     $retVal = $sprout_or_fig;
52 :     }
53 :     # Return the new object.
54 :     return $retVal;
55 :     }
56 :    
57 :     =head3 is_deleted_fid
58 :    
59 :     C<< my $flag = $fidCheck->is_deleted_fid($fid); >>
60 :    
61 :     Return TRUE if the specified feature does not exist, else FALSE.
62 :    
63 :     =over 4
64 :    
65 :     =item fid
66 :    
67 :     ID of the feature whose existence is to be checked.
68 :    
69 :     =item RETURN
70 :    
71 :     Returns TRUE if the feature does NOT exist, else FALSE.
72 :    
73 :     =back
74 :    
75 :     =cut
76 :    
77 :     sub is_deleted_fid {
78 :     # Get the parameters.
79 :     my ($self, $fid) = @_;
80 :     # Test for existence of the feature.
81 :     my $flag = $self->{db}->Exists('Feature', $fid);
82 :     # Return the result.
83 :     return ! $flag;
84 :     }
85 :    
86 :     1;
87 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3