NAME

Set::IntegerRange - Sets of Integers

Easy manipulation of sets of integers (arbitrary intervals)

SYNOPSIS

  • use Set::IntegerRange;

  • $set = new Set::IntegerRange($lowerbound, $upperbound);

    the set object constructor method

  • $set = Set::IntegerRange->new($lowerbound, $upperbound);

    alternate way of calling the set object constructor method

  • $set->Empty();

    deletes all elements in the set

  • $set->Fill();

    inserts all possible elements into the set

  • $set->Insert($index);

    inserts a given element

  • $set->Delete($index);

    deletes a given element

  • $set->in($index);

    tests the presence of a given element

  • $set->Norm();

    calculates the norm (number of elements) of the set

  • $set->Min();

    returns the minimum of the set ( min({}) := +infinity )

  • $set->Max();

    returns the maximum of the set ( max({}) := -infinity )

  • $set1->Union($set2,$set3);

    calculates the union of set2 and set3 and stores the result in set1 (in-place is also possible)

  • $set1->Intersection($set2,$set3);

    calculates the intersection of set2 and set3 and stores the result in set1 (in-place is also possible)

  • $set1->Difference($set2,$set3);

    calculates set2 "minus" set3 ( = set2 \ set3 ) and stores the result in set1 (in-place is also possible)

  • $set1->ExclusiveOr($set2,$set3);

    calculates the symmetric difference of set2 and set3 and stores the result in set1 (in-place is also possible)

  • $set1->Complement($set2);

    calculates the complement of set2 and stores the result in set1 (in-place is also possible)

  • $set1->equal($set2);

    tests if set1 is the same as set2

  • $set1->inclusion($set2);

    tests if set1 is contained in set2

  • $set1->lexorder($set2);

    tests if set1 comes lexically before set2, i.e., if (set1 <= set2) holds, as though the two bit vectors used to represent the two sets were two large numbers in binary representation

    (Note that this is an arbitrary order relationship!)

  • $set1->Compare($set2);

    lexically compares set1 and set2 and returns -1, 0 or 1 if (set1 < set2), (set1 == set2) or (set1 > set2) holds, respectively

    (Again, the two bit vectors representing the two sets are compared as though they were two large numbers in binary representation)

  • $set1->Copy($set2);

    copies set2 to set1

  • Hint: method names all in lower case indicate a boolean return value!

DESCRIPTION

This class lets you dynamically create sets of arbitrary intervals of integers and to perform all the basic operations for sets on them, like

-

adding or removing elements,

-

testing for the presence of a certain element,

-

computing the union, intersection, difference, symmetric difference or complement of sets,

-

copying sets,

-

testing two sets for equality or inclusion, and

-

computing the minimum, the maximum and the norm (number of elements) of a set.

Please refer to Set::IntegerFast(3) for a detailed description of each method!

Note that the method "Resize()" is not available in this class because extending an existing set at the lower end would require a very inefficient bitwise shift or copy of existing elements.

The method "Version()" is also unavailable in this module.

A method "DESTROY()" is not needed here since the destruction of objects which aren't used anymore is taken care of implicitly and automatically by Perl itself.

Note also that subclassing of this class is not impaired or disabled in any way (in contrast to the "Set::IntegerFast" class).

SEE ALSO

Set::IntegerFast(3), perl(1), perlsub(1), perlmod(1), perlref(1), perlobj(1), perlbot(1), perlxs(1), perlxstut(1), perlguts(1).

VERSION

This man page documents Set::IntegerRange version 1.0.

AUTHOR

Steffen Beyer <sb@sdm.de> (sd&m GmbH&Co.KG, Munich, Germany)

COPYRIGHT

Copyright (c) 1996 by Steffen Beyer. All rights reserved.

LICENSE AGREEMENT

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.