NAME

Hermes::Integer - Integer Range

SYNOPSIS

use Hermes::Integer;

my @a = ( 1, 3, 5 .. 10 );
my $a = Hermes::Integer->new()->load( \@a );

my %b = ( 1 => 1, 2 => 1, 4 => 1, 6 => 1 );
my $b = $a->new()->load( \%b );

my $c = $a->new()->load( 4, 10 );
my $d = $a->new()->load( $c );

$a->add( $b );
$c->intersect( \%b );

DATA METHODS

get( $o )

Extracts a set of elements from a supported object.

load( $o )

Loads from a supported object, or a pair of delimiting elements that indicate a contiguous range.

min()

Returns the smallest element in range

max()

Returns the largest element in range

count()

Returns number of elements in range.

list( %param )

Returns boundary pairs if skip is set, values of all elements otherwise.

value( @index )

Values of @index.

index( @value )

Indices of @value.

subset( @index )

Returns an object that contains the inclusive subset within two indices.

ARITHMETIC METHODS

( These methods modify the invoking object. )

add( $o )

Adds a supported object to object.

subtract( $o )

Subtracts a supported object from object.

intersect( $o )

Intersects with a supported object.

symdiff( $o )

Takes symmetric difference with a supported object.

insert( @value )

Insert elements delimited by two values. Returns invoking object.

remove( @value )

Remove elements delimited by two values. Returns object of removed elements.