Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

set::infinite::arithmetic(3pm) [debian man page]

Set::Infinite::Arithmetic(3pm)				User Contributed Perl Documentation			    Set::Infinite::Arithmetic(3pm)

       NAME

       Set::Infinite::Arithmetic - Scalar operations used by quantize() and offset()

       AUTHOR

       Flavio Soibelmann Glock - fglock@pucrs.br

       %_MODE hash of subs

	   $a->offset ( value => [1,2], mode => 'offset', unit => 'days' );

	   $a->offset ( value => [1,2, -5,-4], mode => 'offset', unit => 'days' );

       note: if mode = circle, then "-5" counts from end (like a Perl negative array index).

	   $a->offset ( value => [1,2], mode => 'offset', unit => 'days', strict => $a );

       option 'strict' will return intersection($a,offset). Default: none.

       %subs_offset2($object, $offset1, $offset2)

	   &{ $subs_offset2{$unit} } ($object, $offset1, $offset2);

       A hash of functions that return:

	   ($object+$offset1, $object+$offset2)

       in $unit context.

       Returned $object+$offset1, $object+$offset2 may be scalars or objects.

       %Offset_to_value($object, $offset)

       %Init_quantizer($object)

	   $Offset_to_value{$unit} ($object, $offset);

	   $Init_quantizer{$unit} ($object);

       Maps an 'offset value' to a 'value'

       A hash of functions that return ( int($object) + $offset ) in $unit context.

       Init_quantizer subroutines must be called before using subs_offset1 functions.

       int(object)+offset is a scalar.

       Offset_to_value is optimized for calling it multiple times on the same object, with different offsets. That's why there is a separate
       initialization subroutine.

       $self->{offset} is created on initialization. It is an index used by the memoization cache.

perl v5.10.0							    2008-06-21					    Set::Infinite::Arithmetic(3pm)

Check Out this Related Man Page

Set::Infinite::_recurrence(3pm) 			User Contributed Perl Documentation			   Set::Infinite::_recurrence(3pm)

NAME
Set::Infinite::_recurrence - Extends Set::Infinite with recurrence functions SYNOPSIS
$recurrence = $base_set->_recurrence ( &next, &previous ); DESCRIPTION
This is an internal class used by the DateTime::Set module. The API is subject to change. It provides all functionality provided by Set::Infinite, plus the ability to define recurrences with arbitrary objects, such as dates. METHODS
o _recurrence ( &next, &previous ) Creates a recurrence set. The set is defined inside a 'base set'. $recurrence = $base_set->_recurrence ( &next, &previous ); The recurrence functions take one argument, and return the 'next' or the 'previous' occurence. Example: defines the set of all 'integer numbers': use strict; use Set::Infinite::_recurrence; use POSIX qw(floor); # define the recurrence span my $forever = Set::Infinite::_recurrence->new( Set::Infinite::_recurrence::NEG_INFINITY, Set::Infinite::_recurrence::INFINITY ); my $recurrence = $forever->_recurrence( sub { # next floor( $_[0] + 1 ) }, sub { # previous my $tmp = floor( $_[0] ); $tmp < $_[0] ? $tmp : $_[0] - 1 }, ); print "sample recurrence ", $recurrence->intersection( -5, 5 ), " "; # sample recurrence -5,-4,-3,-2,-1,0,1,2,3,4,5 { my $x = 234.567; print "next occurence after $x = ", $recurrence->{param}[0]->( $x ), " "; # 235 print "previous occurence before $x = ", $recurrence->{param}[2]->( $x ), " "; # 234 } { my $x = 234; print "next occurence after $x = ", $recurrence->{param}[0]->( $x ), " "; # 235 print "previous occurence before $x = ", $recurrence->{param}[2]->( $x ), " "; # 233 } o is_forever Returns true if the set is a single span, ranging from -Infinity to Infinity. o _is_recurrence Returns true if the set is an unbounded recurrence, ranging from -Infinity to Infinity. CONSTANTS
o INFINITY The "Infinity" value. o NEG_INFINITY The "-Infinity" value. SUPPORT
Support is offered through the "datetime@perl.org" mailing list. Please report bugs using rt.cpan.org AUTHOR
Flavio Soibelmann Glock <fglock@gmail.com> The recurrence generation algorithm is based on an idea from Dave Rolsky. COPYRIGHT
Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. This program is free software; you can distribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
Set::Infinite DateTime::Set For details on the Perl DateTime Suite project please see <http://datetime.perl.org>. perl v5.12.4 2011-08-22 Set::Infinite::_recurrence(3pm)
Man Page