|
NAMESet::Window - Manages an interval on the integer lineSYNOPSISuse Set::Window; $window = new_lr Set::Window $left, $right; $window = new_ll Set::Window $left, $length; $window = empty Set::Window; $left = $window->left; $right = $window->right; $size = $window->size; @bounds = $window->bounds; @elements = $window->elements; empty $window; eqivalent $window1 $window2; equal $window1 $window2; $window = copy $window $window = offset $window $offset $window = inset $window $inset $window = cover $window @windows $window = intersect $window @windows @windows = $window->series($length); REQUIRESPerl 5.6.0, ExporterEXPORTSNothingDESCRIPTIONA "Set::Window" object represents a window on the integer line; that is, a finite set of consecutive integers.Methods are provided for creating and modifying windows, for obtaining information about windows, and for performing some simple set operations on windows. The empty windowThe empty window represents the empty set. Like the empty set, the empty window is unique.METHODSCreation
Access
Predicates
ModificationThese methods implement copy semantics: modifications are made to a copy of the original window. The original window is unaltered, and the new window is returned.
Utility
DIAGNOSTICSNone.NOTESWhy?Belive it or not, I actually needed this structure in a program. Maybe someone else will need it, too.Weight"Set::Window" objects are designed to be lightweight. If you need more functionality, consider using "Set::IntSpan".Error handling"Set::Window" does not issue any diganostics; in particular, none of the methods can "die".Calling "elements" on a large window can lead to an "out of memory!" message, which cannot be trapped (as of perl 5.003). Applications that must retain control can protect calls to "elements" with an "intersect" $limit = new_lr Set::Window -1_000_000, 1_000_000; @elements = $window->intersect($limit)->elements; or check the size of $window first: length $window < 2_000_000 and @elements = elements $window; Operations involving the empty window are handled consistently. They return valid results if they make sense, and undef otherwise. Thus: Set::Window->empty->elements returns an empty list, because the empty window has no elements, while Set::Windows->empty->bounds returns undef, because the empty window has no first or last element. SEE ALSOperl(1), "Set::IntSpan"AUTHORSteven McDougall, swmcd@world.std.comCOPYRIGHTCopyright 1996-200 by Steven McDougall. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |