

new_lr Set::Window $left, $right 
Creates and returns a new Set::Window object.
$left and $right specify the first and last integers in the window.
If $right is less than $left, returns the empty window. 
new_ll Set::Window $left, $length 
Creates and returns a new Set::Window object.
$left is the first integer in the interval,
and $length is the number of integers in the interval
If $length is less than one, returns the empty window. 
empty Set::Window  Creates and returns an empty Set::Window object. 
$window>left Returns the first integer in the window, or undef if $window is empty. $window>right Returns the last integer in the window, or undef if $window is empty. $window>size Returns the number of integers in the window. The identity $window>size == $window>right  $window>left + 1 holds for all nonempty windows.
$window>bounds Returns a list of the first and last integers in $window, or undef if $window is empty. In scalar context, returns an array reference. $window>elements Returns a list of the integers in $window, in order. In scalar context, returns an array reference.
empty $window Returns true iff $window is empty. equal $window1 $window2 Returns true iff $window1 and $window2 are the same. All empty windows are equal.
equivalent $window1 $window2 Returns true iff $window1 and $window2 are the same size.
These 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.
copy $window Creates and returns a (deep) copy of $window. offset $window $offset Makes a copy of $window, and then shifts it by $offset. Positive values of $offset move the window to the right; negative values move it to the left. Returns the new window. If offset is called on the empty window, it returns the empty window.
inset $window $inset Makes a copy of $window, and then shrinks it by $inset at each end. If $inset is negative, the window expands. Returns the new window. If inset is called on the empty window, it returns the empty window.
cover $window @windows Creates and returns the smallest window that covers (i.e. contains) $window and all the @windows. intersect $window @windows Creates and returns the largest window that is contained by $window and all the @windows. This may be the empty window.
$window>series($length) Returns a list of all the windows of $length that are contained in $window, ordered from left to right. In scalar context, returns an array reference. If $length is greater than $window>length, the list will be empty. If $length is less than 1, returns undef.
None.
Belive it or not, I actually needed this structure in a program. Maybe someone else will need it, too.
Set::Window objects are designed to be lightweight. If you need more functionality, consider using Set::IntSpan.
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>elementsreturns an empty list, because the empty window has no elements, while
Set::Windows>empty>boundsreturns undef, because the empty window has no first or last element.
perl(1), Set::IntSpan
Steven McDougall, swmcd@world.std.com
Copyright 1996200 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.
perl v5.20.3  WINDOW (3)  20160317 
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.