AlignDB-IntSpan

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

 INTERFACE: Set cardinality

 cardinality

    Returns the number of elements in $set.

 is_empty

    Return true if the set is empty.

 is_not_empty

    Return true if the set is not empty.

 is_neg_inf

    Return true if the set is negtive infinite.

 is_pos_inf

    Return true if the set is positive infinite.

lib/AlignDB/IntSpan.pm  view on Meta::CPAN

package AlignDB::IntSpan;
use strict;
use warnings;

use Carp;
use Scalar::Util;
use Scalar::Util::Numeric;

use overload (
    q{0+}   => sub { Carp::confess "Can't numerify an AlignDB::IntSpan\n" },
    q{bool} => q{is_not_empty},
    q{""}   => q{as_string},

    # use Perl standard behaviours for other operations
    fallback => 1,
);

our $VERSION = '1.1.1';

my $POS_INF = 2_147_483_647 - 1;             # INT_MAX - 1
my $NEG_INF = ( -2_147_483_647 - 1 ) + 1;    # INT_MIN + 1

lib/AlignDB/IntSpan.pm  view on Meta::CPAN


    return $cardinality;
}

sub is_empty {
    my $self = shift;
    my $result = $self->edge_size == 0 ? 1 : 0;
    return $result;
}

sub is_not_empty {
    my $self = shift;
    return !$self->is_empty;
}

sub is_neg_inf {
    my $self = shift;
    return $self->edges_ref->[0] == $NEG_INF;
}

sub is_pos_inf {

lib/AlignDB/IntSpan.pm  view on Meta::CPAN

    );

    return $new;
}

#@returns AlignDB::IntSpan
sub cover {
    my $self = shift;

    my $cover = Scalar::Util::blessed($self)->new;
    if ( $self->is_not_empty ) {
        $cover->add_pair( $self->min, $self->max );
    }
    return $cover;
}

#@returns AlignDB::IntSpan
sub holes {
    my $self = shift;

    my $holes = Scalar::Util::blessed($self)->new;

lib/AlignDB/IntSpan.pm  view on Meta::CPAN

=head2 B<INTERFACE: Set cardinality>

=head2 cardinality

Returns the number of elements in $set.

=head2 is_empty

Return true if the set is empty.

=head2 is_not_empty

Return true if the set is not empty.

=head2 is_neg_inf

Return true if the set is negtive infinite.

=head2 is_pos_inf

Return true if the set is positive infinite.



( run in 0.658 second using v1.01-cache-2.11-cpan-cc502c75498 )