NAME

PNI::Set - is a set of elements

SYNOPSIS

my $set = PNI::Set->new;

my $elem1 = PNI::Elem->new;
$set->add($elem1);

my $elem2 = PNI::Elem->new;
$set->add($elem2);

$set->list;    # ($elem1,$elem2)

my $elem1_id = $elem1->id;
$set->elem->{$elem1_id};     # $elem1

ATTRIBUTES

elem

my $elem_hashref = $set->elem;

Hash of elements contained in this PNI::Set.

my $elem_foo = $set->elem->{'foo_id'};

min

Minimum number of elements: default is 0.

max

Maximum number of elements: default is 0, which means infinity otherwise it would be the empty set.

METHODS

add

$set->add($elem);

Add a PNI::Elem to this PNI::Set.

cardinality

my $num_elems = $set->cardinality;

Returns the number of elements in the set.

del

$set->del($elem);

Remove a PNI::Elem from this PNI::Set.

ids

my @ids = $set->ids;

Returns a list containing every id of the elements cointained in the set.

list

my @elems = $set->list;

Returnx a list containing every element of the set.