Calendar/Year.pm

filter: Statementstmt 80.9% 323 / 399 Branchbran 65.6% 109 / 166 Conditioncond 47.2% 51 / 108 MC/DCmcdc 22.9% 14 / 61 Subroutinesub 74.2% 26 / 35 Podpod 0.0% 0 / 21 totaltotal 66.2% 523 / 790 CC 127 SCAR 31.0
CC
127
Cov
72%
init
41.6
labels
40.7
tags
30.0
CRAP 22.3
« Calc/Object.pm ↑ Summary Calendar.pm »
1  
2 ###############################################################################
3 ## ##
4 ## Copyright (c) 2000 - 2015 by Steffen Beyer. ##
5 ## All rights reserved. ##
6 ## ##
7 ## This package is free software; you can redistribute it ##
8 ## and/or modify it under the same terms as Perl itself. ##
9 ## ##
10 ###############################################################################
11  
12 package Date::Calendar::Year;
13  
14 5 ▶BEGIN { eval { require bytes; }; }
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 5 require Exporter;
19  
20 5 @ISA = qw(Exporter);
21  
22 5 @EXPORT = qw();
23  
24 5 @EXPORT_OK = qw( check_year empty_period );
25  
26 5 %EXPORT_TAGS = (all => [@EXPORT_OK]);
27  
28 5 $VERSION = '6.4';
29  
30 5 ▶use Bit::Vector;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 5 ▶use Carp::Clan qw(^Date::);
Subroutine BEGIN: called CC=1 SCAR=0.0
32 5 ▶use Date::Calc::Object qw(:ALL);
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 sub check_year
35 609 ▶{
Subroutine check_year: called CC=3 SCAR=14.2
Pod undocumented
36 609 my($year) = shift_year(\@_);
37  
38 609 ▶ if (($year < 1583) || ($year > 2299))
Branch: 1 branch
BranchTrueFalseTotal
if ($year < 1583 or $year > 2299) 0 609 609
Condition33%1/3
$year < 1583 or $year > 2299
l!l&&r!l&&!r
00609
MC/DC0%0/2
$year < 1583 or $year > 2299
$year < 1583 $year > 2299
Truth table33%1/3
A or B
A= $year < 1583B= $year > 2299
ABresult
1X1
011
000
39 {
40 0 croak("given year ($year) out of range [1583..2299]");
41 }
42 }
43  
44 sub empty_period
45 0 ▶{
Subroutine empty_period: not called CC=2 SCAR=17.9
Pod undocumented
46 0 ▶ carp("dates interval is empty") if ($^W);
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
47 }
48  
49 sub _invalid_
50 0 ▶{
Subroutine _invalid_: not called CC=1 SCAR=6.9
51 0 my($item,$name) = @_;
52  
53 0 croak("date '$item' for day '$name' is invalid");
54 }
55  
56 sub _check_init_date_
57 21778 ▶{
Subroutine _check_init_date_: called CC=3 SCAR=13.1
58 21778 my($item,$name,$year,$yy,$mm,$dd) = @_;
59  
60 21778 ▶ &_invalid_($item,$name)
Branch: 1 branch
BranchTrueFalseTotal
unless $year == $yy and check_date($yy, $mm, $dd) 0 21778 21778
Condition33%1/3
$year == $yy and check_date($yy, $mm, $dd)
!ll&&!rl&&r
0021778
MC/DC0%0/2
$year == $yy and check_date($yy, $mm, $dd)
$year == $yy check_date($yy, $mm, $dd)
Truth table33%1/3
A and B
A= $year == $yyB= check_date($yy, $mm, $dd)
ABresult
0X0
100
111
61 unless (($year == $yy) && (check_date($yy,$mm,$dd)));
62 }
63  
64 sub _check_callback_date_
65 743 ▶{
Subroutine _check_callback_date_: called CC=3 SCAR=13.1
66 743 my($name,$year,$yy,$mm,$dd) = @_;
67  
68 743 ▶ croak("callback function for day '$name' returned invalid date")
Branch: 1 branch
BranchTrueFalseTotal
unless $year == $yy and check_date($yy, $mm, $dd) 0 743 743
Condition33%1/3
$year == $yy and check_date($yy, $mm, $dd)
!ll&&!rl&&r
00743
MC/DC0%0/2
$year == $yy and check_date($yy, $mm, $dd)
$year == $yy check_date($yy, $mm, $dd)
Truth table33%1/3
A and B
A= $year == $yyB= check_date($yy, $mm, $dd)
ABresult
0X0
100
111
69 unless (($year == $yy) && (check_date($yy,$mm,$dd)));
70 }
71  
72 sub _set_date_
73 23668 ▶{
Subroutine _set_date_: called CC=4 SCAR=13.9
74 23668 my($self,$name,$yy,$mm,$dd,$flag) = @_;
75 23668 my($type,$index);
76  
77 23668 $type = 0;
78 23668 ▶ $flag ||= '';
Condition100%2/2
$flag ||= ""
l!l
216192049
MC/DC100%1/1
$flag ||= ""
$flag
Truth table100%2/2
A
A= $flag
Aresult
11
00
79 23668 $index = $self->date2index($yy,$mm,$dd);
80 23668 ▶ if ($flag ne '#')
Branch: 1 branch
BranchTrueFalseTotal
if ($flag ne "#") 2077 21591 23668
81 {
82 2077 ▶ if ($flag eq ':') { ${$self}{'HALF'}->Bit_On( $index ); $type = 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($flag eq ':') { } 28 2049 2077
83 2049 else { ${$self}{'FULL'}->Bit_On( $index ); $type = 2; }
84 }
85 23668 $self->{'TAGS'}{$index}{$name} |= $type;
86 }
87  
88 sub _set_fixed_date_
89 20582 ▶{
Subroutine _set_fixed_date_: called CC=4 SCAR=14.0
90 20582 my($self) = shift;
91 20582 my($item) = shift;
92 20582 my($name) = shift;
93 20582 my($year) = shift;
94 20582 ▶ my($lang) = shift || 0;
Condition50%1/2
shift() || 0
l!l
205820
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
95  
96 20582 ▶ if ($_[1] =~ /^[a-zA-Z]+$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($_[1] =~ /^[a-zA-Z]+$/) 847 19735 20582
97 {
98 847 ▶ &_invalid_($item,$name) unless ($_[1] = Decode_Month($_[1]),$lang);
Branch: 1 branch
BranchTrueFalseTotal
unless $_[1] = Decode_Month($_[1]), $lang 0 847 847
99 }
100 20582 &_check_init_date_($item,$name,$year,@_);
101 20582 &_set_date_($self,$name,@_);
102 }
103  
104 sub date2index
105 23732 ▶{
Subroutine date2index: called CC=5 SCAR=18.2
Pod undocumented
106 23732 my($self) = shift;
107 23732 my($yy,$mm,$dd) = shift_date(\@_);
108 23732 my($year,$index);
109  
110 23732 $year = ${$self}{'YEAR'};
111 23732 ▶ if ($yy != $year)
Branch: 1 branch
BranchTrueFalseTotal
if ($yy != $year) 0 23732 23732
112 {
113 0 croak("given year ($yy) != object's year ($year)");
114 }
115 23732 ▶ if ((check_date($yy,$mm,$dd)) &&
Branch: 1 branch
BranchTrueFalseTotal
if (check_date($yy, $mm, $dd) and ($index = Date_to_Days($yy, $mm, $dd) - do { $self }->{'BASE'}) >= 0 and $index < do { $self }->{'DAYS'}) { } 23732 0 23732
Condition33%2/6
check_date($yy, $mm, $dd) and ($index = Date_to_Days($yy, $mm, $dd) - do { $self }->{"BASE"}) >= 0 and $index < do { $self }->{"DAYS"}
!ll&&!rl&&r
0023732
check_date($yy, $mm, $dd) and ($index = Date_to_Days($yy, $mm, $dd) - do { $self }->{"BASE"}) >= 0
!ll&&!rl&&r
0023732
MC/DC0%0/3
check_date($yy, $mm, $dd) and ($index = Date_to_Days($yy, $mm, $dd) - do { $self }->{"BASE"}) >= 0 and $index < do { $self }->{"DAYS"}
check_date($yy, $mm, $dd) ($index = Date_to_Days($yy, $mm, $dd) - do { $self }->{"BASE"}) >= 0 $index < do { $self }->{"DAYS"}
Truth table25%1/4
A and B and C
A= check_date($yy, $mm, $dd)B= ($index = Date_to_Days($yy, $mm, $dd) - do { $self }->{"BASE"}) >= 0C= $index < do { $self }->{"DAYS"}
ABCresult
0XX0
10X0
1100
1111
116 23732 (($index = (Date_to_Days($yy,$mm,$dd) - ${$self}{'BASE'})) >= 0) &&
117 23732 ($index < ${$self}{'DAYS'}))
118 {
119 23732 return $index;
120 }
121 0 else { croak("invalid date ($yy,$mm,$dd)"); }
122 }
123  
124 sub index2date
125 24 ▶{
Subroutine index2date: called CC=6 SCAR=20.4
Pod undocumented
126 24 my($self,$index) = @_;
127 24 my($year,$yy,$mm,$dd);
128  
129 24 $year = ${$self}{'YEAR'};
130 24 $yy = $year;
131 24 $mm = 1;
132 24 $dd = 1;
133 24 ▶ if (($index == 0) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($index == 0 or $index > 0 and $index < do { $self }->{'DAYS'} and () = Add_Delta_Days($year, 1, 1, $index) and $yy == $year) { } 24 0 24
Condition41%5/12
$index == 0 or $index > 0 and $index < do { $self }->{"DAYS"} and () = Add_Delta_Days($year, 1, 1, $index) and $yy == $year
l!l&&r!l&&!r
4200
$index > 0 and $index < do { $self }->{"DAYS"} and () = Add_Delta_Days($year, 1, 1, $index) and $yy == $year
!ll&&!rl&&r
0020
$index > 0 and $index < do { $self }->{"DAYS"} and () = Add_Delta_Days($year, 1, 1, $index)
!ll&&!rl&&r
0020
$index > 0 and $index < do { $self }->{"DAYS"}
!ll&&!rl&&r
0020
MC/DC0%0/5
$index == 0 or $index > 0 and $index < do { $self }->{"DAYS"} and () = Add_Delta_Days($year, 1, 1, $index) and $yy == $year
$index == 0 $index > 0 $index < do { $self }->{"DAYS"} () = Add_Delta_Days($year, 1, 1, $index) $yy == $year
Truth table33%2/6
A or B and C and D and E
A= $index == 0B= $index > 0C= $index < do { $self }->{"DAYS"}D= () = Add_Delta_Days($year, 1, 1, $index)E= $yy == $year
ABCDEresult
1XXXX1
011111
00XXX0
010XX0
0110X0
011100
134 (($index > 0) &&
135 20 ($index < ${$self}{'DAYS'}) &&
136 (($yy,$mm,$dd) = Add_Delta_Days($year,1,1, $index)) &&
137 ($yy == $year)))
138 {
139 24 return Date::Calc->new($yy,$mm,$dd);
140 }
141 0 else { croak("invalid index ($index)"); }
142 }
143  
144 sub new
145 191 ▶{
Subroutine new: called CC=4 SCAR=14.0
Pod undocumented
146 191 my($class) = shift;
147 191 my($year) = shift_year(\@_);
148 191 my($profile) = shift;
149 191 ▶ my($lang) = shift || 0;
Condition100%2/2
shift() || 0
l!l
8183
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
150 191 my($self);
151  
152 191 &check_year($year);
153 191 $self = { };
154 191 ▶ $class = ref($class) || $class || 'Date::Calendar::Year';
Condition40%2/5
ref $class || $class || 'Date::Calendar::Year'
l!l
1910
ref $class or $class
l!l&&r!l&&!r
01910
MC/DC0%0/2
ref $class || $class || 'Date::Calendar::Year'
ref $class $class
Truth table33%1/3
A or B
A= ref $classB= $class
ABresult
1X1
011
000
155 191 bless($self, $class);
156 191 $self->init($year,$profile,$lang,@_);
157 191 return $self;
158 }
159  
160 sub init
161 191 ▶{
Subroutine init: called CC=35 SCAR=37.3
Pod undocumented
162 191 my($self) = shift;
163 191 my($year) = shift_year(\@_);
164 191 my($profile) = shift;
165 191 ▶ my($lang) = shift || 0;
Condition100%2/2
shift() || 0
l!l
8183
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
166 191 my($days,$dow,$name,$item,$flag,$temp,$n);
167 191 my(@weekend,@easter,@date);
168  
169 191 ▶ if (@_ > 0) { @weekend = @_; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) { } 3 188 191
170 188 else { @weekend = (6,7); } # Mon=1 Tue=2 Wed=3 Thu=4 Fri=5 Sat=6 Sun=7
171 191 &check_year($year);
172 191 ▶ croak("given profile is not a HASH ref") unless (ref($profile) eq 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $profile eq "HASH" 0 191 191
173 191 $days = Days_in_Year($year,12);
174 191 ${$self}{'YEAR'} = $year;
175 191 ${$self}{'DAYS'} = $days;
176 191 ${$self}{'BASE'} = Date_to_Days($year,1,1);
177 191 ${$self}{'TAGS'} = { };
178 191 ${$self}{'HALF'} = Bit::Vector->new($days);
179 191 ${$self}{'FULL'} = Bit::Vector->new($days);
180 191 ${$self}{'WORK'} = Bit::Vector->new($days);
181 191 $dow = Day_of_Week($year,1,1); # Mon=1 Tue=2 Wed=3 Thu=4 Fri=5 Sat=6 Sun=7
182 191 foreach $item (@weekend)
183 {
184 386 ▶ $n = $item || 0;
Condition50%1/2
$item || 0
l!l
3860
MC/DC0%0/1
$item || 0
$item
Truth table50%1/2
A
A= $item
Aresult
11
00
185 386 ▶ if (($n >= 1) and ($n <= 7))
Branch: 1 branch
BranchTrueFalseTotal
if ($n >= 1 and $n <= 7) 386 0 386
Condition33%1/3
$n >= 1 and $n <= 7
!ll&&!rl&&r
00386
MC/DC0%0/2
$n >= 1 and $n <= 7
$n >= 1 $n <= 7
Truth table33%1/3
A and B
A= $n >= 1B= $n <= 7
ABresult
0X0
100
111
186 {
187 386 $n -= $dow;
188 386 ▶ while ($n < 0) { $n += 7; }
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) 8 386 394
189 386 ▶ while ($n < $days) { ${$self}{'FULL'}->Bit_On( $n ); $n += 7; }
Branch: 1 branch
BranchTrueFalseTotal
if ($n < $days) 20432 386 20818
190 }
191 }
192 191 @easter = Easter_Sunday($year);
193 191 ▶ $lang = Decode_Language($lang) unless ($lang =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $lang =~ /^\d+$/ 0 191 191
194 191 ▶ $lang = Language() unless (($lang >= 1) and ($lang <= Languages()));
Branch: 1 branch
BranchTrueFalseTotal
unless $lang >= 1 and $lang <= Languages() 183 8 191
Condition66%2/3
$lang >= 1 and $lang <= Languages()
!ll&&!rl&&r
18308
MC/DC50%1/2
$lang >= 1 and $lang <= Languages()
$lang >= 1 $lang <= Languages()
Truth table66%2/3
A and B
A= $lang >= 1B= $lang <= Languages()
ABresult
0X0
100
111
195 191 foreach $name (keys %{$profile})
196 {
197 23678 @date = ();
198 23678 $item = ${$profile}{$name};
199 23678 ▶ if (ref($item))
Branch: 5 branches
BranchTrueFalseTotal
if (ref $item) { } 753 22925 23678
elsif ($item =~ /^ ([#:]?) ([+-]\d+) $/x) { } 1196 21729 22925
elsif ($item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/x or $item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/x or $item =~ /^ ([#:]?) (\d+) - (\d+|[a-zA-Z]+) -? $/x) { } 19729 2000 21729
elsif ($item =~ m[^ ([#:]?) (\d+) / (\d+) $]x or $item =~ m[^ ([#:]?) ([a-zA-Z]+) /? (\d+) $]x) { } 853 1147 2000
elsif ($item =~ /^ ([#:]?) ([1-5]) ([a-zA-Z]+) (\d+) $/x or $item =~ m[^ ([#:]?) ([1-5]) / ([1-7]|[a-zA-Z]+) / (\d+|[a-zA-Z]+) $]x) { } 1147 0 1147
200 {
201 753 ▶ if (ref($item) eq 'CODE')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $item eq 'CODE') { } 753 0 753
202 {
203 753 ▶ if (@date = &$item($year,$name))
Branch: 1 branch
BranchTrueFalseTotal
if (@date = &$item($year, $name)) 743 10 753
204 {
205 743 &_check_callback_date_($name,$year,@date);
206 743 &_set_date_($self,$name,@date);
207 }
208 }
209 0 else { croak("value for day '$name' is not a CODE ref"); }
210 }
211 elsif ($item =~ /^ ([#:]?) ([+-]\d+) $/x)
212 {
213 1196 $flag = $1;
214 1196 $temp = $2;
215 1196 ▶ if ($temp == 0) { @date = @easter; }
Branch: 1 branch
BranchTrueFalseTotal
if ($temp == 0) { } 109 1087 1196
216 1087 else { @date = Add_Delta_Days(@easter, $temp); }
217 1196 &_check_init_date_($item,$name,$year,@date);
218 1196 &_set_date_($self,$name,@date,$flag);
219 }
220 ▶ elsif (($item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/x) ||
Condition83%5/6
$item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/x or $item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/x or $item =~ /^ ([#:]?) (\d+) - (\d+|[a-zA-Z]+) -? $/x
l!l&&r!l&&!r
1098186312000
$item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/x or $item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/x
l!l&&r!l&&!r
1098020631
MC/DC66%2/3
$item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/x or $item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/x or $item =~ /^ ([#:]?) (\d+) - (\d+|[a-zA-Z]+) -? $/x
$item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/x $item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/x $item =~ /^ ([#:]?) (\d+) - (\d+|[a-zA-Z]+) -? $/x
Truth table75%3/4
A or B or C
A= $item =~ /^ ([#:]?) (\d+) \. (\d+) \.? $/xB= $item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/xC= $item =~ /^ ([#:]?) (\d+) - (\d+|[a-zA-Z]+) -? $/x
ABCresult
1XX1
01X1
0011
0000
221 ($item =~ /^ ([#:]?) (\d+) \.? ([a-zA-Z]+) \.? $/x) ||
222 ($item =~ /^ ([#:]?) (\d+) - (\d+|[a-zA-Z]+) -? $/x))
223 {
224 19729 $flag = $1;
225 19729 @date = ($year,$3,$2);
226 19729 &_set_fixed_date_($self,$item,$name,$year,$lang,@date,$flag);
227 }
228 ▶ elsif (($item =~ /^ ([#:]?) (\d+) \/ (\d+) $/x) ||
Condition100%3/3
$item =~ m[^ ([#:]?) (\d+) / (\d+) $]x or $item =~ m[^ ([#:]?) ([a-zA-Z]+) /? (\d+) $]x
l!l&&r!l&&!r
68471147
MC/DC100%2/2
$item =~ m[^ ([#:]?) (\d+) / (\d+) $]x or $item =~ m[^ ([#:]?) ([a-zA-Z]+) /? (\d+) $]x
$item =~ m[^ ([#:]?) (\d+) / (\d+) $]x $item =~ m[^ ([#:]?) ([a-zA-Z]+) /? (\d+) $]x
Truth table100%3/3
A or B
A= $item =~ m[^ ([#:]?) (\d+) / (\d+) $]xB= $item =~ m[^ ([#:]?) ([a-zA-Z]+) /? (\d+) $]x
ABresult
1X1
011
000
229 ($item =~ /^ ([#:]?) ([a-zA-Z]+) \/? (\d+) $/x))
230 {
231 853 $flag = $1;
232 853 @date = ($year,$2,$3);
233 853 &_set_fixed_date_($self,$item,$name,$year,$lang,@date,$flag);
234 }
235 ▶ elsif (($item =~ /^ ([#:]?) ([1-5]) ([a-zA-Z]+) (\d+) $/x) ||
Condition33%1/3
$item =~ /^ ([#:]?) ([1-5]) ([a-zA-Z]+) (\d+) $/x or $item =~ m[^ ([#:]?) ([1-5]) / ([1-7]|[a-zA-Z]+) / (\d+|[a-zA-Z]+) $]x
l!l&&r!l&&!r
011470
MC/DC0%0/2
$item =~ /^ ([#:]?) ([1-5]) ([a-zA-Z]+) (\d+) $/x or $item =~ m[^ ([#:]?) ([1-5]) / ([1-7]|[a-zA-Z]+) / (\d+|[a-zA-Z]+) $]x
$item =~ /^ ([#:]?) ([1-5]) ([a-zA-Z]+) (\d+) $/x $item =~ m[^ ([#:]?) ([1-5]) / ([1-7]|[a-zA-Z]+) / (\d+|[a-zA-Z]+) $]x
Truth table33%1/3
A or B
A= $item =~ /^ ([#:]?) ([1-5]) ([a-zA-Z]+) (\d+) $/xB= $item =~ m[^ ([#:]?) ([1-5]) / ([1-7]|[a-zA-Z]+) / (\d+|[a-zA-Z]+) $]x
ABresult
1X1
011
000
236 ($item =~ /^ ([#:]?) ([1-5]) \/ ([1-7]|[a-zA-Z]+) \/ (\d+|[a-zA-Z]+) $/x))
237 {
238 1147 $flag = $1;
239 1147 $n = $2;
240 1147 $dow = $3;
241 1147 $temp = $4;
242 1147 ▶ if ($dow =~ /^[a-zA-Z]+$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($dow =~ /^[a-zA-Z]+$/) 1147 0 1147
243 {
244 1147 ▶ &_invalid_($item,$name) unless ($dow = Decode_Day_of_Week($dow,$lang));
Branch: 1 branch
BranchTrueFalseTotal
unless $dow = Decode_Day_of_Week($dow, $lang) 0 1147 1147
245 }
246 1147 ▶ if ($temp =~ /^[a-zA-Z]+$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($temp =~ /^[a-zA-Z]+$/) { } 1147 0 1147
247 {
248 1147 ▶ &_invalid_($item,$name) unless ($temp = Decode_Month($temp,$lang));
Branch: 1 branch
BranchTrueFalseTotal
unless $temp = Decode_Month($temp, $lang) 0 1147 1147
249 }
250 else
251 {
252 0 ▶ &_invalid_($item,$name) unless (($temp > 0) && ($temp < 13));
Branch: 1 branch
BranchTrueFalseTotal
unless $temp > 0 and $temp < 13 0 0 0
Condition0%0/3
$temp > 0 and $temp < 13
!ll&&!rl&&r
000
MC/DC0%0/2
$temp > 0 and $temp < 13
$temp > 0 $temp < 13
Truth table0%0/3
A and B
A= $temp > 0B= $temp < 13
ABresult
0X0
100
111
253 }
254 1147 ▶ unless (@date = Nth_Weekday_of_Month_Year($year,$temp,$dow,$n))
Branch: 1 branch
BranchTrueFalseTotal
unless (@date = Nth_Weekday_of_Month_Year($year, $temp, $dow, $n)) 69 1078 1147
255 {
256 69 ▶ if ($n == 5)
Branch: 1 branch
BranchTrueFalseTotal
if ($n == 5) { } 69 0 69
257 {
258 69 ▶ &_invalid_($item,$name)
Branch: 1 branch
BranchTrueFalseTotal
unless @date = Nth_Weekday_of_Month_Year($year, $temp, $dow, 4) 0 69 69
259 unless (@date = Nth_Weekday_of_Month_Year($year,$temp,$dow,4));
260 }
261 0 else { &_invalid_($item,$name); }
262 }
263 1147 &_set_date_($self,$name,@date,$flag);
264 }
265 else
266 {
267 0 croak("unrecognized date '$item' for day '$name'");
268 }
269 }
270 191 ${$self}{'HALF'}->AndNot( ${$self}{'HALF'}, ${$self}{'FULL'} );
271 }
272  
273 sub vec_full # full holidays
274 7 ▶{
Subroutine vec_full: called CC=1 SCAR=0.0
Pod undocumented
275 7 my($self) = @_;
276  
277 7 return ${$self}{'FULL'};
278 }
279  
280 sub vec_half # half holidays
281 1 ▶{
Subroutine vec_half: called CC=1 SCAR=0.0
Pod undocumented
282 1 my($self) = @_;
283  
284 1 return ${$self}{'HALF'};
285 }
286  
287 sub vec_work # work space
288 0 ▶{
Subroutine vec_work: not called CC=1 SCAR=6.9
Pod undocumented
289 0 my($self) = @_;
290  
291 0 return ${$self}{'WORK'};
292 }
293  
294 sub val_days
295 1 ▶{
Subroutine val_days: called CC=1 SCAR=0.0
Pod undocumented
296 1 my($self) = @_;
297  
298 1 return ${$self}{'DAYS'};
299 }
300  
301 sub val_base
302 0 ▶{
Subroutine val_base: not called CC=1 SCAR=6.9
Pod undocumented
303 0 my($self) = @_;
304  
305 0 return ${$self}{'BASE'};
306 }
307  
308 sub val_year
309 0 ▶{
Subroutine val_year: not called CC=1 SCAR=6.9
Pod undocumented
310 0 my($self) = @_;
311  
312 0 return ${$self}{'YEAR'};
313 }
314  
315 sub year # as a shortcut and to enable shift_year
316 173 ▶{
Subroutine year: called CC=1 SCAR=0.0
Pod undocumented
317 173 my($self) = @_;
318  
319 173 return ${$self}{'YEAR'};
320 }
321  
322 sub labels
323 10 ▶{
Subroutine labels: called CC=10 SCAR=37.1
Pod undocumented
324 10 my($self) = shift;
325 10 my(@date);
326 my($index);
327 10 my(%result);
328  
329 10 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 10 0 10
330 {
331 10 @date = shift_date(\@_);
332 10 $index = $self->date2index(@date);
333 10 ▶ if (defined $self->{'TAGS'}{$index})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'TAGS'}{$index}) { } 10 0 10
334 {
335 10 ▶ if (defined wantarray and wantarray)
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray and wantarray) { } 10 0 10
Condition33%1/3
defined wantarray and wantarray
!ll&&!rl&&r
0010
MC/DC0%0/2
defined wantarray and wantarray
defined wantarray wantarray
Truth table33%1/3
A and B
A= defined wantarrayB= wantarray
ABresult
0X0
100
111
336 {
337 return
338 (
339 Day_of_Week_to_Text(Day_of_Week(@date)),
340 10 keys(%{$self->{'TAGS'}{$index}})
341 );
342 }
343 else
344 {
345 0 return 1 + scalar( keys(%{$self->{'TAGS'}{$index}}) );
346 }
347 }
348 else
349 {
350 0 ▶ if (defined wantarray and wantarray)
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray and wantarray) { } 0 0 0
Condition0%0/3
defined wantarray and wantarray
!ll&&!rl&&r
000
MC/DC0%0/2
defined wantarray and wantarray
defined wantarray wantarray
Truth table0%0/3
A and B
A= defined wantarrayB= wantarray
ABresult
0X0
100
111
351 {
352 0 return( Day_of_Week_to_Text(Day_of_Week(@date)) );
353 }
354 else
355 {
356 0 return 1;
357 }
358 }
359 }
360 else
361 {
362 0 local($_);
363 0 %result = ();
364 0 foreach $index (keys %{$self->{'TAGS'}})
365 {
366 0 grep( $result{$_} = 0, keys(%{$self->{'TAGS'}{$index}}) );
367 }
368 0 ▶ if (defined wantarray and wantarray)
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray and wantarray) { } 0 0 0
Condition0%0/3
defined wantarray and wantarray
!ll&&!rl&&r
000
MC/DC0%0/2
defined wantarray and wantarray
defined wantarray wantarray
Truth table0%0/3
A and B
A= defined wantarrayB= wantarray
ABresult
0X0
100
111
369 {
370 0 return( keys %result );
371 }
372 else
373 {
374 0 return scalar( keys %result );
375 }
376 }
377 }
378  
379 sub search
380 5 ▶{
Subroutine search: called CC=4 SCAR=13.9
Pod undocumented
381 5 my($self,$pattern) = @_;
382 5 my($index,$label,$upper);
383 5 my(@result);
384  
385 5 local($_);
386 5 @result = ();
387 5 $pattern = ISO_UC($pattern);
388 5 foreach $index (keys %{$self->{'TAGS'}})
389 {
390 LABEL:
391 238 foreach $label (keys %{$self->{'TAGS'}{$index}})
392 {
393 248 $upper = ISO_UC($label);
394 248 ▶ if (index($upper,$pattern) >= $[)
Branch: 1 branch
BranchTrueFalseTotal
if (index($upper, $pattern) >= $[) 5 243 248
395 {
396 5 push( @result, $index );
397 5 last LABEL;
398 }
399 }
400 }
401 0 return( map( $self->index2date($_), sort {$a<=>$b} @result ) );
402 }
403  
404 sub tags
405 0 ▶{
Subroutine tags: not called CC=5 SCAR=34.0
Pod undocumented
406 0 my($self) = shift;
407 0 my(%result) = ();
408 0 my($index);
409 my(@date);
410  
411 0 ▶ if (@_ == 1 and not ref($_[0]))
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not ref $_[0]) { } 0 0 0
Condition0%0/3
@_ == 1 and not ref $_[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@_ == 1 and not ref $_[0]
@_ == 1 not ref $_[0]
Truth table0%0/3
A and not(B)
A= @_ == 1B= not ref $_[0]
ABresult
0X0
100
111
412 {
413 0 $index = shift;
414 }
415 else
416 {
417 0 @date = shift_date(\@_);
418 0 $index = $self->date2index(@date);
419 }
420 0 ▶ if (exists $self->{'TAGS'}{$index} and
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"TAGS"}{$index} and defined $self->{"TAGS"}{$index}) 0 0 0
Condition0%0/3
exists $self->{"TAGS"}{$index} and defined $self->{"TAGS"}{$index}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"TAGS"}{$index} and defined $self->{"TAGS"}{$index}
exists $self->{"TAGS"}{$index} defined $self->{"TAGS"}{$index}
Truth table0%0/3
A and B
A= exists $self->{"TAGS"}{$index}B= defined $self->{"TAGS"}{$index}
ABresult
0X0
100
111
421 defined $self->{'TAGS'}{$index})
422 {
423 0 %result = %{$self->{'TAGS'}{$index}};
424 }
425 0 return \%result;
426 }
427  
428 sub _interval_workdays_
429 41 ▶{
Subroutine _interval_workdays_: called CC=1 SCAR=0.0
430 41 my($self,$lower,$upper) = @_;
431 41 my($work,$full,$half,$days);
432  
433 41 $work = ${$self}{'WORK'};
434 41 $full = ${$self}{'FULL'};
435 41 $half = ${$self}{'HALF'};
436 41 $work->Empty();
437 41 $work->Interval_Fill($lower,$upper);
438 41 $work->AndNot($work,$full);
439 41 $days = $work->Norm();
440 41 $work->And($work,$half);
441 41 $days -= $work->Norm() * 0.5;
442 41 return $days;
443 }
444  
445 sub _delta_workdays_
446 20 ▶{
Subroutine _delta_workdays_: called CC=11 SCAR=30.1
447 20 my($self,$lower_index,$upper_index,$include_lower,$include_upper) = @_;
448 20 my($days);
449  
450 20 $days = ${$self}{'DAYS'};
451 20 ▶ if (($lower_index < 0) || ($lower_index >= $days))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower_index < 0 or $lower_index >= $days) 0 20 20
Condition33%1/3
$lower_index < 0 or $lower_index >= $days
l!l&&r!l&&!r
0020
MC/DC0%0/2
$lower_index < 0 or $lower_index >= $days
$lower_index < 0 $lower_index >= $days
Truth table33%1/3
A or B
A= $lower_index < 0B= $lower_index >= $days
ABresult
1X1
011
000
452 {
453 0 croak("invalid lower index ($lower_index)");
454 }
455 20 ▶ if (($upper_index < 0) || ($upper_index >= $days))
Branch: 1 branch
BranchTrueFalseTotal
if ($upper_index < 0 or $upper_index >= $days) 0 20 20
Condition33%1/3
$upper_index < 0 or $upper_index >= $days
l!l&&r!l&&!r
0020
MC/DC0%0/2
$upper_index < 0 or $upper_index >= $days
$upper_index < 0 $upper_index >= $days
Truth table33%1/3
A or B
A= $upper_index < 0B= $upper_index >= $days
ABresult
1X1
011
000
456 {
457 0 croak("invalid upper index ($upper_index)");
458 }
459 20 ▶ if ($lower_index > $upper_index)
Branch: 1 branch
BranchTrueFalseTotal
if ($lower_index > $upper_index) 0 20 20
460 {
461 0 croak("lower index ($lower_index) > upper index ($upper_index)");
462 }
463 20 ▶ $lower_index++ unless ($include_lower);
Branch: 1 branch
BranchTrueFalseTotal
unless $include_lower 4 16 20
464 20 ▶ $upper_index-- unless ($include_upper);
Branch: 1 branch
BranchTrueFalseTotal
unless $include_upper 6 14 20
465 20 ▶ if (($upper_index < 0) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($upper_index < 0 or $lower_index >= $days or $lower_index > $upper_index) 0 20 20
Condition33%2/6
$upper_index < 0 or $lower_index >= $days or $lower_index > $upper_index
l!l&&r!l&&!r
0020
$upper_index < 0 or $lower_index >= $days
l!l&&r!l&&!r
0020
MC/DC0%0/3
$upper_index < 0 or $lower_index >= $days or $lower_index > $upper_index
$upper_index < 0 $lower_index >= $days $lower_index > $upper_index
Truth table25%1/4
A or B or C
A= $upper_index < 0B= $lower_index >= $daysC= $lower_index > $upper_index
ABCresult
1XX1
01X1
0011
0000
466 ($lower_index >= $days) ||
467 ($lower_index > $upper_index))
468 {
469 0 &empty_period();
470 0 return 0;
471 }
472 20 return $self->_interval_workdays_($lower_index,$upper_index);
473 }
474  
475 sub delta_workdays
476 20 ▶{
Subroutine delta_workdays: called CC=2 SCAR=7.0
Pod undocumented
477 20 my($self) = shift;
478 20 my($yy1,$mm1,$dd1) = shift_date(\@_);
479 20 my($yy2,$mm2,$dd2) = shift_date(\@_);
480 20 my($including1,$including2) = (shift,shift);
481 20 my($index1,$index2);
482  
483 20 $index1 = $self->date2index($yy1,$mm1,$dd1);
484 20 $index2 = $self->date2index($yy2,$mm2,$dd2);
485 20 ▶ if ($index1 > $index2)
Branch: 1 branch
BranchTrueFalseTotal
if ($index1 > $index2) { } 0 20 20
486 {
487 0 return -$self->_delta_workdays_(
488 $index2,$index1,$including2,$including1);
489 }
490 else
491 {
492 20 return $self->_delta_workdays_(
493 $index1,$index2,$including1,$including2);
494 }
495 }
496  
497 sub _move_forward_
498 25 ▶{
Subroutine _move_forward_: called CC=25 SCAR=32.3
499 25 my($self,$index,$rest,$sign) = @_;
500 25 my($limit,$year,$full,$half,$loop,$min,$max);
501  
502 25 ▶ if ($sign == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($sign == 0) 0 25 25
503 {
504 0 return( $self->index2date($index), $rest, 0 );
505 }
506 25 $limit = ${$self}{'DAYS'} - 1;
507 25 $year = ${$self}{'YEAR'};
508 25 $full = ${$self}{'FULL'};
509 25 $half = ${$self}{'HALF'};
510 25 $loop = 1;
511 25 ▶ if ($sign > 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($sign > 0) { } 13 12 25
512 {
513 13 ▶ $rest = -$rest if ($rest < 0);
Branch: 1 branch
BranchTrueFalseTotal
if $rest < 0 0 13 13
514 13 ▶ while ($loop)
Branch: 1 branch
BranchTrueFalseTotal
if ($loop) 20 10 30
515 {
516 20 $loop = 0;
517 20 ▶ if ($full->bit_test($index) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($full->bit_test($index) and () = $full->Interval_Scan_inc($index) and $min == $index) 13 7 20
Condition66%4/6
$full->bit_test($index) and () = $full->Interval_Scan_inc($index) and $min == $index
!ll&&!rl&&r
7013
$full->bit_test($index) and () = $full->Interval_Scan_inc($index)
!ll&&!rl&&r
7013
MC/DC33%1/3
$full->bit_test($index) and () = $full->Interval_Scan_inc($index) and $min == $index
$full->bit_test($index) () = $full->Interval_Scan_inc($index) $min == $index
Truth table50%2/4
A and B and C
A= $full->bit_test($index)B= () = $full->Interval_Scan_inc($index)C= $min == $index
ABCresult
0XX0
10X0
1100
1111
518 (($min,$max) = $full->Interval_Scan_inc($index)) &&
519 ($min == $index))
520 {
521 13 ▶ if ($max >= $limit)
Branch: 1 branch
BranchTrueFalseTotal
if ($max >= $limit) { } 1 12 13
522 {
523 1 return( Date::Calc->new(++$year,1,1), $rest, +1 );
524 }
525 12 else { $index = $max + 1; }
526 }
527 19 ▶ if ($half->bit_test($index))
Branch: 2 branches
BranchTrueFalseTotal
if ($half->bit_test($index)) { } 8 11 19
elsif ($rest >= 1.0) { } 3 8 11
528 {
529 8 ▶ if ($rest >= 0.5) { $rest -= 0.5; $index++; $loop = 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($rest >= "0.5") 6 2 8
530 }
531 3 elsif ($rest >= 1.0) { $rest -= 1.0; $index++; $loop = 1; }
532 19 ▶ if ($loop && ($index > $limit))
Branch: 1 branch
BranchTrueFalseTotal
if ($loop and $index > $limit) 2 17 19
Condition100%3/3
$loop and $index > $limit
!ll&&!rl&&r
1072
MC/DC100%2/2
$loop and $index > $limit
$loop $index > $limit
Truth table100%3/3
A and B
A= $loopB= $index > $limit
ABresult
0X0
100
111
533 {
534 2 return( Date::Calc->new(++$year,1,1), $rest, +1 );
535 }
536 }
537 10 return( $self->index2date($index), $rest, 0 );
538 }
539 else # ($sign < 0)
540 {
541 12 ▶ $rest = -$rest if ($rest > 0);
Branch: 1 branch
BranchTrueFalseTotal
if $rest > 0 0 12 12
542 12 ▶ while ($loop)
Branch: 1 branch
BranchTrueFalseTotal
if ($loop) 24 9 33
543 {
544 24 $loop = 0;
545 24 ▶ if ($full->bit_test($index) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($full->bit_test($index) and () = $full->Interval_Scan_dec($index) and $max == $index) 12 12 24
Condition66%4/6
$full->bit_test($index) and () = $full->Interval_Scan_dec($index) and $max == $index
!ll&&!rl&&r
12012
$full->bit_test($index) and () = $full->Interval_Scan_dec($index)
!ll&&!rl&&r
12012
MC/DC33%1/3
$full->bit_test($index) and () = $full->Interval_Scan_dec($index) and $max == $index
$full->bit_test($index) () = $full->Interval_Scan_dec($index) $max == $index
Truth table50%2/4
A and B and C
A= $full->bit_test($index)B= () = $full->Interval_Scan_dec($index)C= $max == $index
ABCresult
0XX0
10X0
1100
1111
546 (($min,$max) = $full->Interval_Scan_dec($index)) &&
547 ($max == $index))
548 {
549 12 ▶ if ($min <= 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($min <= 0) { } 1 11 12
550 {
551 1 return( Date::Calc->new(--$year,12,31), $rest, -1 );
552 }
553 11 else { $index = $min - 1; }
554 }
555 23 ▶ if ($half->bit_test($index))
Branch: 2 branches
BranchTrueFalseTotal
if ($half->bit_test($index)) { } 8 15 23
elsif ($rest <= -1.0) { } 8 7 15
556 {
557 8 ▶ if ($rest <= -0.5) { $rest += 0.5; $index--; $loop = 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($rest <= "-0.5") 6 2 8
558 }
559 8 elsif ($rest <= -1.0) { $rest += 1.0; $index--; $loop = 1; }
560 23 ▶ if ($loop && ($index < 0))
Branch: 1 branch
BranchTrueFalseTotal
if ($loop and $index < 0) 2 21 23
Condition100%3/3
$loop and $index < 0
!ll&&!rl&&r
9122
MC/DC100%2/2
$loop and $index < 0
$loop $index < 0
Truth table100%3/3
A and B
A= $loopB= $index < 0
ABresult
0X0
100
111
561 {
562 2 return( Date::Calc->new(--$year,12,31), $rest, -1 );
563 }
564 }
565 9 return( $self->index2date($index), $rest, 0 );
566 }
567 }
568  
569 sub add_delta_workdays
570 14 ▶{
Subroutine add_delta_workdays: called CC=17 SCAR=33.9
Pod undocumented
571 14 my($self) = shift;
572 14 my($yy,$mm,$dd) = shift_date(\@_);
573 14 my($days) = shift;
574 14 my($sign) = shift;
575 14 my($index,$full,$half,$limit,$diff,$guess);
576  
577 14 $index = $self->date2index($yy,$mm,$dd); # check date
578 14 ▶ if ($sign == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($sign == 0) 0 14 14
579 {
580 0 return( Date::Calc->new($yy,$mm,$dd), $days, 0 );
581 }
582 14 ▶ $days = -$days if ($days < 0);
Branch: 1 branch
BranchTrueFalseTotal
if $days < 0 6 8 14
583 14 ▶ if ($days < 2) # other values possible for fine-tuning optimal speed
Branch: 1 branch
BranchTrueFalseTotal
if ($days < 2) 0 14 14
584 {
585 0 return( $self->_move_forward_($index,$days,$sign) );
586 }
587 # else sufficiently large distance
588 14 $full = ${$self}{'FULL'};
589 14 $half = ${$self}{'HALF'};
590 14 ▶ if ($sign > 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($sign > 0) { } 8 6 14
591 {
592 # First, check against whole rest of year:
593 8 $limit = ${$self}{'DAYS'} - 1;
594 8 $diff = $self->_interval_workdays_($index,$limit);
595 8 ▶ if ($days >= $diff)
Branch: 1 branch
BranchTrueFalseTotal
if ($days >= $diff) 4 4 8
596 {
597 4 $days -= $diff;
598 4 return( Date::Calc->new(++$yy,1,1), $days, +1 );
599 }
600 # else ($days < $diff)
601 # Now calculate proportional jump (approximatively):
602 4 $guess = $index + int($days * ($limit-$index+1) / $diff);
603 4 ▶ $guess = $limit if ($guess > $limit);
Branch: 1 branch
BranchTrueFalseTotal
if $guess > $limit 0 4 4
604 4 ▶ if ($index + 2 > $guess) # again, other values possible for fine-tuning
Branch: 1 branch
BranchTrueFalseTotal
if ($index + 2 > $guess) 0 4 4
605 {
606 0 return( $self->_move_forward_($index,$days,+1) );
607 }
608 # else sufficiently long jump
609 4 $diff = $self->_interval_workdays_($index,$guess-1);
610 4 ▶ while ($days < $diff) # reverse gear (jumped too far)
Branch: 1 branch
BranchTrueFalseTotal
if ($days < $diff) 0 4 4
611 {
612 0 $guess--;
613 0 ▶ unless ($full->bit_test($guess))
Branch: 1 branch
BranchTrueFalseTotal
unless ($full->bit_test($guess)) 0 0 0
614 {
615 0 ▶ if ($half->bit_test($guess)) { $diff -= 0.5; }
Branch: 1 branch
BranchTrueFalseTotal
if ($half->bit_test($guess)) { } 0 0 0
616 0 else { $diff -= 1.0; }
617 }
618 }
619 # Now move in original direction:
620 4 $days -= $diff;
621 4 return( $self->_move_forward_($guess,$days,+1) );
622 }
623 else # ($sign < 0)
624 {
625 # First, check against whole rest of year:
626 6 $limit = 0;
627 6 $diff = $self->_interval_workdays_($limit,$index);
628 6 ▶ if ($days >= $diff)
Branch: 1 branch
BranchTrueFalseTotal
if ($days >= $diff) 3 3 6
629 {
630 3 $days -= $diff;
631 3 return( Date::Calc->new(--$yy,12,31), -$days, -1 );
632 }
633 # else ($days < $diff)
634 # Now calculate proportional jump (approximatively):
635 3 $guess = $index - int($days * ($index+1) / $diff);
636 3 ▶ $guess = $limit if ($guess < $limit);
Branch: 1 branch
BranchTrueFalseTotal
if $guess < $limit 0 3 3
637 3 ▶ if ($guess > $index - 2) # again, other values possible for fine-tuning
Branch: 1 branch
BranchTrueFalseTotal
if ($guess > $index - 2) 0 3 3
638 {
639 0 return( $self->_move_forward_($index,-$days,-1) );
640 }
641 # else sufficiently long jump
642 3 $diff = $self->_interval_workdays_($guess+1,$index);
643 3 ▶ while ($days < $diff) # reverse gear (jumped too far)
Branch: 1 branch
BranchTrueFalseTotal
if ($days < $diff) 0 3 3
644 {
645 0 $guess++;
646 0 ▶ unless ($full->bit_test($guess))
Branch: 1 branch
BranchTrueFalseTotal
unless ($full->bit_test($guess)) 0 0 0
647 {
648 0 ▶ if ($half->bit_test($guess)) { $diff -= 0.5; }
Branch: 1 branch
BranchTrueFalseTotal
if ($half->bit_test($guess)) { } 0 0 0
649 0 else { $diff -= 1.0; }
650 }
651 }
652 # Now move in original direction:
653 3 $days -= $diff;
654 3 return( $self->_move_forward_($guess,-$days,-1) );
655 }
656 }
657  
658 sub is_full
659 0 ▶{
Subroutine is_full: not called CC=1 SCAR=6.9
Pod undocumented
660 0 my($self) = shift;
661 0 my(@date) = shift_date(\@_);
662  
663 0 return $self->vec_full->bit_test( $self->date2index(@date) );
664 }
665  
666 sub is_half
667 0 ▶{
Subroutine is_half: not called CC=1 SCAR=6.9
Pod undocumented
668 0 my($self) = shift;
669 0 my(@date) = shift_date(\@_);
670  
671 0 return $self->vec_half->bit_test( $self->date2index(@date) );
672 }
673  
674 sub is_work
675 0 ▶{
Subroutine is_work: not called CC=1 SCAR=6.9
Pod undocumented
676 0 my($self) = shift;
677 0 my(@date) = shift_date(\@_);
678  
679 0 return $self->vec_work->bit_test( $self->date2index(@date) );
680 }
681  
682 5 1;
683  
684 __END__
« Calc/Object.pm ↑ Summary Calendar.pm »