NAME
Set::Infinite::Simple - an interval of 2 scalars
SYNOPSIS
use Set::Infinite::Simple;
$a = Set::Infinite::Simple->new(1,2);
print $a->union(5,6);
DESCRIPTION
This is a building block for Set::Infinite.
Please use Set::Infinite instead.
USAGE
$a = Set::Infinite::Simple->new();
$a = Set::Infinite::Simple->new(1);
$a = Set::Infinite::Simple->new(1,2);
$a = Set::Infinite::Simple->new( a => 1, b => 2, tolerance => 1); # integer interval
$a = Set::Infinite::Simple->new(@b);
$a = Set::Infinite::Simple->new($b);
parameters can be:
undef
SCALAR => means an interval like (1,1)
SCALAR,SCALAR
ARRAY of SCALAR
<removed!> HASH containing 'a'
<removed!> HASH containing 'a' and 'b'
Set::Infinite::Simple
$a->real;
$a->integer;
$logic = $a->intersects($b);
$logic = $a->contains($b);
$logic = $a->is_null;
$i = $a->union($b);
NOTE: union returns a list if result is ($a, $b)
$i = $a->intersection($b);
$i = $a->complement($b);
$i = $a->complement;
$i = $a->min;
$i = $a->max;
$i = $a->size; # SCALAR, size of interval.
$i = $a->span; # INTERVAL, (min .. max); has no meaning here
@b = sort @a;
print $a;
tie $a, 'Set::Infinite::Simple', 1,2;
SCALAR behaves like a string "min .. max"
tie @a, 'Set::Infinite::Simple', 1,2;
$a[0], $a[1] are min and max
POP, PUSH, SHIFT, UNSHIFT, SPLICE, DELETE, and EXISTS are not defined
$i = tied(@a)->size;
$a->open_end(1) open-end: elements are < end
$a->open_begin(1) open-start: elements are > begin
$a->open_end(0) close-end: elements are <= end
$a->open_begin(0) close-start: elements are >= begin
Global: separators(@i) chooses the separators. default are [ ] ( ) '..' ','.
infinite returns an 'infinite' number.
minus_infinite returns '- infinite' number.
null returns 'null'.
type($i) chooses an object data type.
default is none (a normal perl $something variable).
example: 'Math::BigFloat', 'Math::BigInt'
tolerance(0) defaults to real sets (default)
tolerance(1) defaults to integer sets
real defaults to real sets (default)
integer defaults to integer sets
Internal: $a->tolerance(1); works in integer mode $a->tolerance(0); works in real mode (default) $a->add($b) changes contents to $b
TODO
formatted string input like '[0..1]'
CHANGES
v0.15
Functions moved to Element_Inf:
null($i) chooses 'null' name. default is 'null'
infinite($i) chooses 'infinite' name. default is 'inf'
SEE ALSO
Other options for working with sets:
Set::IntRange
Works on integers only
use Bit::Vector for storage
Set::Window
Works on integers only
AUTHOR
Flavio Soibelmann Glock <fglock@pucrs.br>