NAME

Set::IntRange - Sets of Integers

PURPOSE

Easy manipulation of sets of integers (arbitrary intervals)

SYNOPSIS

METHODS

  Version
      $version = $Set::IntRange::VERSION;

  new
      $set = Set::IntRange->new($lower,$upper);
      $set = $any_set->new($lower,$upper);

  Resize
      $set->Resize($lower,$upper);

  Size
      ($lower,$upper) = $set->Size();

  Empty
      $set->Empty();

  Fill
      $set->Fill();

  Flip
      $set->Flip();

  Interval_Empty
      $set->Interval_Empty($lower,$upper);
      $set->Empty_Interval($lower,$upper); # (deprecated)

  Interval_Fill
      $set->Interval_Fill($lower,$upper);
      $set->Fill_Interval($lower,$upper);  # (deprecated)

  Interval_Flip
      $set->Interval_Flip($lower,$upper);
      $set->Flip_Interval($lower,$upper);  # (deprecated)

  Interval_Scan_inc
      while (($min,$max) = $set->Interval_Scan_inc($start))

  Interval_Scan_dec
      while (($min,$max) = $set->Interval_Scan_dec($start))

  Bit_Off
      $set->Bit_Off($index);
      $set->Delete($index);                # (deprecated)

  Bit_On
      $set->Bit_On($index);
      $set->Insert($index);                # (deprecated)

  bit_flip
      $bit = $set->bit_flip($index);
      if ($set->bit_flip($index))
      $bit = $set->flip($index);           # (deprecated)
      if ($set->flip($index))              # (deprecated)

  bit_test
      $bit = $set->bit_test($index);
      if ($set->bit_test($index))
      $bit = $set->contains($index);
      if ($set->contains($index))
      $bit = $set->in($index);             # (deprecated)
      if ($set->in($index))                # (deprecated)

  Norm
      $norm = $set->Norm();

  Min
      $min = $set->Min();

  Max
      $max = $set->Max();

  Union
      $set1->Union($set2,$set3);           # in-place is possible!

  Intersection
      $set1->Intersection($set2,$set3);    # in-place is possible!

  Difference
      $set1->Difference($set2,$set3);      # in-place is possible!

  ExclusiveOr
      $set1->ExclusiveOr($set2,$set3);     # in-place is possible!

  Complement
      $set1->Complement($set2);            # in-place is possible!

  is_empty
      if ($set->is_empty())

  is_full
      if ($set->is_full())

  equal
      if ($set1->equal($set2))

  subset
      if ($set1->subset($set2))
      if ($set1->inclusion($set2))         # (deprecated)

  Lexicompare
      $cmp = $set1->Lexicompare($set2);    # unsigned

  Compare
      $cmp = $set1->Compare($set2);        # signed

  Copy
      $set1->Copy($set2);

  Shadow
      $other_set = $some_set->Shadow();

  Clone
      $twin_set = $some_set->Clone();

  to_Enum
      $string = $set->to_Enum();           # e.g., "-8..-5,-1..2,4,6..9"

  from_Enum
      eval { $set->from_Enum($string); };

  to_Hex
      $string = $set->to_Hex();            # e.g., "0007AF1E"

  from_Hex
      eval { $set->from_Hex($string); };

  BitVector
      $set->BitVector->any_Bit_Vector_method();

OVERLOADED OPERATORS

      # "$index" is a number or a Perl scalar variable containing a
      # number which represents the set containing only that element:

  Emptyness
      if ($set) # if not empty
      if (! $set) # if empty
      unless ($set) # if empty

  Equality
      if ($set1 == $set2)
      if ($set1 != $set2)
      if ($set == $index)
      if ($set != $index)

  Lexical Comparison
      $cmp = $set1 cmp $set2;
      if ($set1 lt $set2)
      if ($set1 le $set2)
      if ($set1 gt $set2)
      if ($set1 ge $set2)
      if ($set1 eq $set2)
      if ($set1 ne $set2)
      $cmp = $set cmp $index;
      if ($set lt $index)
      if ($set le $index)
      if ($set gt $index)
      if ($set ge $index)
      if ($set eq $index)
      if ($set ne $index)

  String Conversion
      $string = "$set";
      print "\$set = '$set'\n";

  Union
      $set1 = $set2 + $set3;
      $set1 += $set2;
      $set1 = $set2 | $set3;
      $set1 |= $set2;
      $set1 = $set2 + $index;
      $set += $index;
      $set1 = $set2 | $index;
      $set |= $index;

  Intersection
      $set1 = $set2 * $set3;
      $set1 *= $set2;
      $set1 = $set2 & $set3;
      $set1 &= $set2;
      $set1 = $set2 * $index;
      $set *= $index;
      $set1 = $set2 & $index;
      $set &= $index;

  Difference
      $set1 = $set2 - $set3;
      $set1 -= $set2;
      $set1 = $set2 - $set1;
      $set1 = $set2 - $index;
      $set1 = $index - $set2;
      $set -= $index;

  ExclusiveOr
      $set1 = $set2 ^ $set3;
      $set1 ^= $set2;
      $set1 = $set2 ^ $index;
      $set ^= $index;

  Complement
      $set1 = -$set2;
      $set1 = ~$set2;
      $set = -$set;
      $set = ~$set;

  Subset Relationship
      if ($set1 <= $set2)

  True Subset Relationship
      if ($set1 < $set2)

  Superset Relationship
      if ($set1 >= $set2)

  True Superset Relationship
      if ($set1 > $set2)

  Norm
      $norm = abs($set);

DESCRIPTION

This class lets you dynamically create sets of arbitrary intervals of integers and perform all the basic operations for sets on them (for a list of available methods and operators, see above).

See Bit::Vector(3) for more details!

SEE ALSO

Bit::Vector(3), Math::MatrixBool(3), Math::MatrixReal(3), DFA::Kleene(3), Math::Kleene(3), Graph::Kruskal(3).

VERSION

This man page documents "Set::IntRange" version 5.2.

AUTHOR

Steffen Beyer <STBEY@cpan.org>.

COPYRIGHT

Copyright (c) 1995 - 2009 by Steffen Beyer. All rights reserved.

LICENSE

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

DISCLAIMER

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.