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

View of /Sprout/FidCheck.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Sun Jun 25 00:00:18 2006 UTC (13 years, 5 months ago) by parrello
Branch: MAIN
Created to allow a slimmer shim to be passed to the similarities method.

#!/usr/bin/perl -w

package FidCheck;

    require Exporter;
    @ISA = ('Exporter');
    @EXPORT = qw();
    @EXPORT_OK = qw();

    use strict;
    use Tracer;

=head1 Feature ID Checker

=head2 Introduction

This object supports the C<is_deleted_fid> method to determine whether or not
a feature exists in a Sprout or FIG data store.

=head2 Public Methods

=head3 new

C<< my $fidCheck = FidCheck->new($sprout_or_fig); >>

Construct a new FidCheck object from a specified Sprout, FIG, or SFXlate object.

=over 4

=item sprout_or_fig

A Sprout object that may be used to access the database, or a FIG object that
may be used to access the data store.

=back

=cut

sub new {
    # Get the parameters.
    my ($class, $sprout_or_fig) = @_;
    # Declare the return variable.
    my $retVal;
    # Check the object type.
    if (ref($sprout_or_fig) eq 'Sprout') {
        # Here we have a Sprout object.
        $retVal = { db => $sprout_or_fig };
        bless $retVal, $class;
    } else {
        # Return the object unmodified. It already has the required method.
        $retVal = $sprout_or_fig;
    }
    # Return the new object.
    return $retVal;
}

=head3 is_deleted_fid

C<< my $flag = $fidCheck->is_deleted_fid($fid); >>

Return TRUE if the specified feature does not exist, else FALSE.

=over 4

=item fid

ID of the feature whose existence is to be checked.

=item RETURN

Returns TRUE if the feature does NOT exist, else FALSE.

=back

=cut

sub is_deleted_fid {
    # Get the parameters.
    my ($self, $fid) = @_;
    # Test for existence of the feature.
    my $flag = $self->{db}->Exists('Feature', $fid);
    # Return the result.
    return ! $flag;
}

1;


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3