| 1 | # Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package Set::Infinite::_recurrence; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 23 | ▶ | use constant INFINITY => 100 ** 100 ** 100 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 23 | ▶ | use constant NEG_INFINITY => -1 * (100 ** 100 ** 100); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 23 | ▶ | use vars qw( @ISA $PRETTY_PRINT $max_iterate ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 23 | @ISA = qw( Set::Infinite ); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 23 | ▶ | use Set::Infinite 0.5502; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 23 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 23 | $PRETTY_PRINT = 1; # enable Set::Infinite debug | |||||||||||||||||||||||||||||||||||||||||
| 19 | 23 | $max_iterate = 20; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # TODO: inherit %Set::Infinite::_first / _last | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # in a more "object oriented" way | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | $Set::Infinite::_first{_recurrence} = | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 1395 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1395 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 1395 | my ($callback_next, $callback_previous) = @{ $self->{param} }; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 1395 | my ($min, $min_open) = $self->{parent}->min_a; | |||||||||||||||||||||||||||||||||||||||||
| 29 | # my ($max, $max_open) = $self->{parent}->max_a; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1395 | my ( $min1, $min2 ); | |||||||||||||||||||||||||||||||||||||||||
| 32 | 1395 | $min1 = $callback_next->( $min ); | |||||||||||||||||||||||||||||||||||||||||
| 33 | 1395 | ▶ | if ( ! $min_open ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 1392 | $min2 = $callback_previous->( $min1 ); | |||||||||||||||||||||||||||||||||||||||||
| 36 | 1392 | ▶ | $min1 = $min2 if defined $min2 && $min == $min2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $min2 and $min == $min2
MC/DC50%1/2
defined $min2 and $min == $min2
defined $min2
$min == $min2
Truth table66%2/3
A and B
A= defined $min2B= $min == $min2
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 1395 | my $start = $callback_next->( $min1 ); | |||||||||||||||||||||||||||||||||||||||||
| 40 | 1395 | my $end = $self->{parent}->max; | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | #print STDERR "set "; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | #print STDERR $start->datetime | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # unless $start == INFINITY; | ||||||||||||||||||||||||||||||||||||||||||
| 45 | #print STDERR " - " ; | ||||||||||||||||||||||||||||||||||||||||||
| 46 | #print STDERR $end->datetime | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # unless $end == INFINITY; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | #print STDERR "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1395 | ▶ | return ( $self->new( $min1 ), undef ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | if $start > $end; | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | return ( $self->new( $min1 ), | ||||||||||||||||||||||||||||||||||||||||||
| 54 | $self->new( $start, $end )-> | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # $self->new( {a => $start, b => $end, open_end => $max_open} )-> | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 1393 | _function( '_recurrence', @{ $self->{param} } ) ); | |||||||||||||||||||||||||||||||||||||||||
| 57 | 23 | }; | |||||||||||||||||||||||||||||||||||||||||
| 58 | $Set::Infinite::_last{_recurrence} = | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 70 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 70 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 70 | my ($callback_next, $callback_previous) = @{ $self->{param} }; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 70 | my ($max, $max_open) = $self->{parent}->max_a; | |||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 70 | my ( $max1, $max2 ); | |||||||||||||||||||||||||||||||||||||||||
| 65 | 70 | $max1 = $callback_previous->( $max ); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 70 | ▶ | if ( ! $max_open ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 70 | $max2 = $callback_next->( $max1 ); | |||||||||||||||||||||||||||||||||||||||||
| 69 | 70 | ▶ | $max1 = $max2 if $max == $max2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | return ( $self->new( $max1 ), | ||||||||||||||||||||||||||||||||||||||||||
| 73 | $self->new( $self->{parent}->min, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | $callback_previous->( $max1 ) )-> | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 70 | _function( '_recurrence', @{ $self->{param} } ) ); | |||||||||||||||||||||||||||||||||||||||||
| 76 | 23 | }; | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # $si->_recurrence( | ||||||||||||||||||||||||||||||||||||||||||
| 80 | # \&callback_next, \&callback_previous ) | ||||||||||||||||||||||||||||||||||||||||||
| 81 | # | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # Generates "recurrences" from a callback. | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # These recurrences are simple lists of dates. | ||||||||||||||||||||||||||||||||||||||||||
| 84 | # | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # The recurrence generation is based on an idea from Dave Rolsky. | ||||||||||||||||||||||||||||||||||||||||||
| 86 | # | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | # use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # use Carp qw(cluck); | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 1608 | ▶ | sub _recurrence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_recurrence: called CC=20 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 1608 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 1608 | my ( $callback_next, $callback_previous, $delta ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 1608 | ▶ | $delta->{count} = 0 unless defined $delta->{delta}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | # warn "reusing delta: ". $delta->{count} if defined $delta->{delta}; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # warn Dumper( $delta ); | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1608 | ▶ | if ( $#{ $set->{list} } != 0 || $set->is_too_complex ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$#{$$set{"list"};} != 0 or $set->is_too_complex
MC/DC50%1/2
$#{$$set{"list"};} != 0 or $set->is_too_complex
$#{$$set{"list"};} != 0
$set->is_too_complex
Truth table66%2/3
A or B
A= $#{$$set{"list"};} != 0B= $set->is_too_complex
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | return $set->iterate( | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 10 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 10 | $_[0]->_recurrence( | |||||||||||||||||||||||||||||||||||||||||
| 105 | $callback_next, $callback_previous, $delta ) | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 1276 | } ); | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | # $set is a span | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 332 | my $result; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 332 | ▶ | if ($set->min != NEG_INFINITY && $set->max != INFINITY) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set->min != "-Inf" and $set->max != "Inf"
MC/DC100%2/2
$set->min != "-Inf" and $set->max != "Inf"
$set->min != "-Inf"
$set->max != "Inf"
Truth table100%3/3
A and B
A= $set->min != "-Inf"B= $set->max != "Inf"
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||||||||||||||||
| 112 | # print STDERR " finite set\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 77 | my ($min, $min_open) = $set->min_a; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 77 | my ($max, $max_open) = $set->max_a; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 77 | my ( $min1, $min2 ); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 77 | $min1 = $callback_next->( $min ); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 77 | ▶ | if ( ! $min_open ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 75 | $min2 = $callback_previous->( $min1 ); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 75 | ▶ | $min1 = $min2 if defined $min2 && $min == $min2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $min2 and $min == $min2
MC/DC50%1/2
defined $min2 and $min == $min2
defined $min2
$min == $min2
Truth table66%2/3
A and B
A= defined $min2B= $min == $min2
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 77 | $result = $set->new(); | |||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | # get "delta" - abort if this will take too much time. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 77 | ▶ | unless ( defined $delta->{max_delta} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | { | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 73 | for ( $delta->{count} .. 10 ) | |||||||||||||||||||||||||||||||||||||||||
| 131 | { | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 178 | ▶ | if ( $max_open ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 17 | ▶ | return $result if $min1 >= $max; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | else | ||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 161 | ▶ | return $result if $min1 > $max; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 109 | push @{ $result->{list} }, | |||||||||||||||||||||||||||||||||||||||||
| 141 | { a => $min1, b => $min1, open_begin => 0, open_end => 0 }; | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 109 | $min2 = $callback_next->( $min1 ); | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 109 | ▶ | if ( $delta->{delta} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | { | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 89 | $delta->{delta} += $min2 - $min1; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | else | ||||||||||||||||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 20 | $delta->{delta} = $min2 - $min1; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 109 | $delta->{count}++; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 109 | $min1 = $min2; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | $delta->{max_delta} = $delta->{delta} * 40; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 8 | ▶ | if ( $max < $min + $delta->{max_delta} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | { | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 6 | for ( 1 .. 200 ) | |||||||||||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 28 | ▶ | if ( $max_open ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | return $result if $min1 >= $max; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | else | ||||||||||||||||||||||||||||||||||||||||||
| 168 | { | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 28 | ▶ | return $result if $min1 > $max; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 22 | push @{ $result->{list} }, | |||||||||||||||||||||||||||||||||||||||||
| 172 | { a => $min1, b => $min1, open_begin => 0, open_end => 0 }; | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 22 | $min1 = $callback_next->( $min1 ); | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | # cluck "give up"; | ||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | # return a "_function", such that we can backtrack later. | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 257 | my $func = $set->_function( '_recurrence', $callback_next, $callback_previous, $delta ); | |||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | # removed - returning $result doesn't help on speed | ||||||||||||||||||||||||||||||||||||||||||
| 184 | ## return $func->_function2( 'union', $result ) if $result; | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 257 | return $func; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | sub is_forever | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 677 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_forever: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 677 | ▶ | $#{ $_[0]->{list} } == 0 && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$#{$_[0]{"list"};} == 0 and $_[0]->max == "Inf"
MC/DC50%1/2
$#{$_[0]{"list"};} == 0 and $_[0]->max == "Inf"
$#{$_[0]{"list"};} == 0
$_[0]->max == "Inf"
Truth table66%2/3
A and B
A= $#{$_[0]{"list"};} == 0B= $_[0]->max == "Inf"
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | $_[0]->max == INFINITY && | ||||||||||||||||||||||||||||||||||||||||||
| 193 | $_[0]->min == NEG_INFINITY | ||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | sub _is_recurrence | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 1808 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_recurrence: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | exists $_[0]->{method} && | ||||||||||||||||||||||||||||||||||||||||||
| 199 | $_[0]->{method} eq '_recurrence' && | ||||||||||||||||||||||||||||||||||||||||||
| 200 | $_[0]->{parent}->is_forever | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 1808 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $_[0]{"method"} and $_[0]{"method"} eq "_recurrence"
MC/DC100%2/2
exists $_[0]{"method"} and $_[0]{"method"} eq "_recurrence"
exists $_[0]{"method"}
$_[0]{"method"} eq "_recurrence"
Truth table100%3/3
A and B
A= exists $_[0]{"method"}B= $_[0]{"method"} eq "_recurrence"
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | sub intersects | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 629 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
intersects: called CC=20 SCAR=45.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 629 | my ($s1, $s2) = (shift,shift); | |||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 629 | ▶ | if ( exists $s1->{method} && $s1->{method} eq '_recurrence' ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $s1->{"method"} and $s1->{"method"} eq "_recurrence"
MC/DC50%1/2
exists $s1->{"method"} and $s1->{"method"} eq "_recurrence"
exists $s1->{"method"}
$s1->{"method"} eq "_recurrence"
Truth table66%2/3
A and B
A= exists $s1->{"method"}B= $s1->{"method"} eq "_recurrence"
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | { | ||||||||||||||||||||||||||||||||||||||||||
| 209 | # recurrence && span | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 6 | ▶ | unless ( ref($s2) && exists $s2->{method} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $s2 and exists $s2->{"method"}
MC/DC0%0/2
ref $s2 and exists $s2->{"method"}
ref $s2
exists $s2->{"method"}
Truth table33%1/3
A and B
A= ref $s2B= exists $s2->{"method"}
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 6 | my $intersection = $s1->intersection($s2, @_); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 6 | my $min = $intersection->min; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 6 | ▶ | return 1 if defined $min && $min != NEG_INFINITY && $min != INFINITY; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $min and $min != "-Inf" and $min != "Inf"
defined $min and $min != "-Inf"
MC/DC33%1/3
defined $min and $min != "-Inf" and $min != "Inf"
defined $min
$min != "-Inf"
$min != "Inf"
Truth table50%2/4
A and B and C
A= defined $minB= $min != "-Inf"C= $min != "Inf"
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | my $max = $intersection->max; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | ▶ | return 1 if defined $max && $max != NEG_INFINITY && $max != INFINITY; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $max and $max != "-Inf" and $max != "Inf"
defined $max and $max != "-Inf"
MC/DC0%0/3
defined $max and $max != "-Inf" and $max != "Inf"
defined $max
$max != "-Inf"
$max != "Inf"
Truth table25%1/4
A and B and C
A= defined $maxB= $max != "-Inf"C= $max != "Inf"
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | # recurrence && recurrence | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | ▶ | if ( $s1->{parent}->is_forever && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$s1->{"parent"}->is_forever and ref $s2 and _is_recurrence($s2)
$s1->{"parent"}->is_forever and ref $s2
MC/DC0%0/3
$s1->{"parent"}->is_forever and ref $s2 and _is_recurrence($s2)
$s1->{"parent"}->is_forever
ref $s2
_is_recurrence($s2)
Truth table25%1/4
A and B and C
A= $s1->{"parent"}->is_foreverB= ref $s2C= _is_recurrence($s2)
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | ref($s2) && _is_recurrence( $s2 ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 221 | { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $intersection = $s1->intersection($s2, @_); | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $min = $intersection->min; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | return 1 if defined $min && $min != NEG_INFINITY && $min != INFINITY; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $min and $min != "-Inf" and $min != "Inf"
defined $min and $min != "-Inf"
MC/DC0%0/3
defined $min and $min != "-Inf" and $min != "Inf"
defined $min
$min != "-Inf"
$min != "Inf"
Truth table0%0/4
A and B and C
A= defined $minB= $min != "-Inf"C= $min != "Inf"
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $max = $intersection->max; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | return 1 if defined $max && $max != NEG_INFINITY && $max != INFINITY; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $max and $max != "-Inf" and $max != "Inf"
defined $max and $max != "-Inf"
MC/DC0%0/3
defined $max and $max != "-Inf" and $max != "Inf"
defined $max
$max != "-Inf"
$max != "Inf"
Truth table0%0/4
A and B and C
A= defined $maxB= $max != "-Inf"C= $max != "Inf"
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 625 | return $s1->SUPER::intersects( $s2, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | sub intersection | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 2058 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
intersection: called CC=8 SCAR=27.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 2058 | my ($s1, $s2) = (shift,shift); | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 2058 | ▶ | if ( exists $s1->{method} && $s1->{method} eq '_recurrence' ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $s1->{"method"} and $s1->{"method"} eq "_recurrence"
MC/DC100%2/2
exists $s1->{"method"} and $s1->{"method"} eq "_recurrence"
exists $s1->{"method"}
$s1->{"method"} eq "_recurrence"
Truth table100%3/3
A and B
A= exists $s1->{"method"}B= $s1->{"method"} eq "_recurrence"
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | { | ||||||||||||||||||||||||||||||||||||||||||
| 238 | # optimize: recurrence && span | ||||||||||||||||||||||||||||||||||||||||||
| 239 | return $s1->{parent}-> | ||||||||||||||||||||||||||||||||||||||||||
| 240 | intersection( $s2, @_ )-> | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 207 | _recurrence( @{ $s1->{param} } ) | |||||||||||||||||||||||||||||||||||||||||
| 242 | 212 | ▶ | unless ref($s2) && exists $s2->{method}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $s2 and exists $s2->{"method"}
MC/DC100%2/2
ref $s2 and exists $s2->{"method"}
ref $s2
exists $s2->{"method"}
Truth table100%3/3
A and B
A= ref $s2B= exists $s2->{"method"}
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | # optimize: recurrence && recurrence | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 5 | ▶ | if ( $s1->{parent}->is_forever && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$s1->{"parent"}->is_forever and ref $s2 and _is_recurrence($s2)
$s1->{"parent"}->is_forever and ref $s2
MC/DC33%1/3
$s1->{"parent"}->is_forever and ref $s2 and _is_recurrence($s2)
$s1->{"parent"}->is_forever
ref $s2
_is_recurrence($s2)
Truth table50%2/4
A and B and C
A= $s1->{"parent"}->is_foreverB= ref $s2C= _is_recurrence($s2)
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | ref($s2) && _is_recurrence( $s2 ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 247 | { | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | my ( $next1, $previous1 ) = @{ $s1->{param} }; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 1 | my ( $next2, $previous2 ) = @{ $s2->{param} }; | |||||||||||||||||||||||||||||||||||||||||
| 250 | return $s1->{parent}->_function( '_recurrence', | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | # intersection of parent 'next' callbacks | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my ($n1, $n2); | |||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $iterate = 0; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $n2 = $next2->( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | while(1) { | |||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $n1 = $next1->( $previous1->( $n2 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | return $n1 if $n1 == $n2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $n2 = $next2->( $previous2->( $n1 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | return if $iterate++ == $max_iterate; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | # intersection of parent 'previous' callbacks | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my ($p1, $p2); | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $iterate = 0; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $p2 = $previous2->( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | while(1) { | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $p1 = $previous1->( $next1->( $p2 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | return $p1 if $p1 == $p2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $p2 = $previous2->( $next2->( $p1 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | return if $iterate++ == $max_iterate; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 1850 | return $s1->SUPER::intersection( $s2, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | sub union | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 1666 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
union: called CC=4 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 1666 | my ($s1, $s2) = (shift,shift); | |||||||||||||||||||||||||||||||||||||||||
| 284 | 1666 | ▶ | if ( $s1->_is_recurrence && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$s1->_is_recurrence and ref $s2 and _is_recurrence($s2)
$s1->_is_recurrence and ref $s2
MC/DC0%0/3
$s1->_is_recurrence and ref $s2 and _is_recurrence($s2)
$s1->_is_recurrence
ref $s2
_is_recurrence($s2)
Truth table25%1/4
A and B and C
A= $s1->_is_recurrenceB= ref $s2C= _is_recurrence($s2)
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | ref($s2) && _is_recurrence( $s2 ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 286 | { | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # optimize: recurrence || recurrence | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my ( $next1, $previous1 ) = @{ $s1->{param} }; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my ( $next2, $previous2 ) = @{ $s2->{param} }; | |||||||||||||||||||||||||||||||||||||||||
| 290 | return $s1->{parent}->_function( '_recurrence', | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub { # next | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $n1 = $next1->( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $n2 = $next2->( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | return $n1 < $n2 ? $n1 : $n2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | sub { # previous | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $p1 = $previous1->( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $p2 = $previous2->( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | return $p1 > $p2 ? $p1 : $p2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 1666 | return $s1->SUPER::union( $s2, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | Set::Infinite::_recurrence - Extends Set::Infinite with recurrence functions | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | $recurrence = $base_set->_recurrence ( \&next, \&previous ); | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | This is an internal class used by the DateTime::Set module. | ||||||||||||||||||||||||||||||||||||||||||
| 317 | The API is subject to change. | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | It provides all functionality provided by Set::Infinite, plus the ability | ||||||||||||||||||||||||||||||||||||||||||
| 320 | to define recurrences with arbitrary objects, such as dates. | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | =item * _recurrence ( \&next, \&previous ) | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | Creates a recurrence set. The set is defined inside a 'base set'. | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | $recurrence = $base_set->_recurrence ( \&next, \&previous ); | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | The recurrence functions take one argument, and return the 'next' or | ||||||||||||||||||||||||||||||||||||||||||
| 333 | the 'previous' occurrence. | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | Example: defines the set of all 'integer numbers': | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | use strict; | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | use Set::Infinite::_recurrence; | ||||||||||||||||||||||||||||||||||||||||||
| 340 | use POSIX qw(floor); | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | # define the recurrence span | ||||||||||||||||||||||||||||||||||||||||||
| 343 | my $forever = Set::Infinite::_recurrence->new( | ||||||||||||||||||||||||||||||||||||||||||
| 344 | Set::Infinite::_recurrence::NEG_INFINITY, | ||||||||||||||||||||||||||||||||||||||||||
| 345 | Set::Infinite::_recurrence::INFINITY | ||||||||||||||||||||||||||||||||||||||||||
| 346 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | my $recurrence = $forever->_recurrence( | ||||||||||||||||||||||||||||||||||||||||||
| 349 | sub { # next | ||||||||||||||||||||||||||||||||||||||||||
| 350 | floor( $_[0] + 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 351 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 352 | sub { # previous | ||||||||||||||||||||||||||||||||||||||||||
| 353 | my $tmp = floor( $_[0] ); | ||||||||||||||||||||||||||||||||||||||||||
| 354 | $tmp < $_[0] ? $tmp : $_[0] - 1 | ||||||||||||||||||||||||||||||||||||||||||
| 355 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 356 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | print "sample recurrence ", | ||||||||||||||||||||||||||||||||||||||||||
| 359 | $recurrence->intersection( -5, 5 ), "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 360 | # sample recurrence -5,-4,-3,-2,-1,0,1,2,3,4,5 | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | { | ||||||||||||||||||||||||||||||||||||||||||
| 363 | my $x = 234.567; | ||||||||||||||||||||||||||||||||||||||||||
| 364 | print "next occurrence after $x = ", | ||||||||||||||||||||||||||||||||||||||||||
| 365 | $recurrence->{param}[0]->( $x ), "\n"; # 235 | ||||||||||||||||||||||||||||||||||||||||||
| 366 | print "previous occurrence before $x = ", | ||||||||||||||||||||||||||||||||||||||||||
| 367 | $recurrence->{param}[2]->( $x ), "\n"; # 234 | ||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||||||||||||||||
| 371 | my $x = 234; | ||||||||||||||||||||||||||||||||||||||||||
| 372 | print "next occurrence after $x = ", | ||||||||||||||||||||||||||||||||||||||||||
| 373 | $recurrence->{param}[0]->( $x ), "\n"; # 235 | ||||||||||||||||||||||||||||||||||||||||||
| 374 | print "previous occurrence before $x = ", | ||||||||||||||||||||||||||||||||||||||||||
| 375 | $recurrence->{param}[2]->( $x ), "\n"; # 233 | ||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | =item * is_forever | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | Returns true if the set is a single span, | ||||||||||||||||||||||||||||||||||||||||||
| 381 | ranging from -Infinity to Infinity. | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | =item * _is_recurrence | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | Returns true if the set is an unbounded recurrence, | ||||||||||||||||||||||||||||||||||||||||||
| 386 | ranging from -Infinity to Infinity. | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | =head1 CONSTANTS | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =item * INFINITY | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | The C<Infinity> value. | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | =item * NEG_INFINITY | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | The C<-Infinity> value. | ||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | Support is offered through the C<datetime@perl.org> mailing list. | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | Please report bugs using rt.cpan.org | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | Flavio Soibelmann Glock <fglock@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | The recurrence generation algorithm is based on an idea from Dave Rolsky. | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 419 | This program is free software; you can distribute it and/or | ||||||||||||||||||||||||||||||||||||||||||
| 420 | modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | The full text of the license can be found in the LICENSE file | ||||||||||||||||||||||||||||||||||||||||||
| 423 | included with this module. | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | Set::Infinite | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | DateTime::Set | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | For details on the Perl DateTime Suite project please see | ||||||||||||||||||||||||||||||||||||||||||
| 432 | L<http://datetime.perl.org>. | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||