| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CXC::Number::Grid::Range; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Helper class to track Ranges |
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
288024
|
use v5.28; |
|
|
3
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
621
|
use Moo; |
|
|
3
|
|
|
|
|
10609
|
|
|
|
3
|
|
|
|
|
23
|
|
|
8
|
3
|
|
|
3
|
|
3210
|
use experimental 'signatures'; |
|
|
3
|
|
|
|
|
1876
|
|
|
|
3
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
1101
|
use namespace::clean; |
|
|
3
|
|
|
|
|
20243
|
|
|
|
3
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload |
|
15
|
|
|
|
|
|
|
fallback => 0, |
|
16
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
|
17
|
3
|
|
|
|
|
35
|
'""' => \&to_string, |
|
18
|
3
|
|
|
3
|
|
1129
|
'.' => \&concatenate; |
|
|
3
|
|
|
|
|
7
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has layer => ( is => 'ro' ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has include => ( is => 'ro' ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has lb => ( is => 'ro' ); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has ub => ( is => 'ro' ); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
around BUILDARGS => sub ( $orig, $class, @args ) { |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my %args = ref $args[0] ? $args[0]->%* : @args; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
@args{ 'layer', 'include' } = delete( $args{value} )->@* |
|
62
|
|
|
|
|
|
|
if defined $args{value}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return $class->$orig( \%args ); |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
0
|
sub to_string ( $self, $ =, $ = ) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
82
|
0
|
|
0
|
|
|
0
|
my $ub = $self->ub // 'undef'; |
|
83
|
0
|
|
0
|
|
|
0
|
my $lb = $self->lb // 'undef'; |
|
84
|
0
|
|
0
|
|
|
0
|
my $layer = $self->layer // 'undef'; |
|
85
|
0
|
|
0
|
|
|
0
|
my $include = $self->include // 'undef'; |
|
86
|
0
|
|
|
|
|
0
|
"( $lb, $ub ) => { layer => $layer, include => $include }"; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
0
|
1
|
0
|
sub concatenate ( $self, $other, $swap = 0 ) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
104
|
0
|
|
|
|
|
0
|
my $str = $self->to_string; |
|
105
|
0
|
0
|
|
|
|
0
|
return $swap ? $other . $str : $str . $other; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
2
|
|
|
2
|
1
|
6
|
sub value ( $self ) { |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
4
|
|
|
118
|
2
|
|
|
|
|
17
|
return [ $self->layer, $self->include ]; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# |
|
124
|
|
|
|
|
|
|
# This file is part of CXC-Number |
|
125
|
|
|
|
|
|
|
# |
|
126
|
|
|
|
|
|
|
# This software is Copyright (c) 2019 by Smithsonian Astrophysical Observatory. |
|
127
|
|
|
|
|
|
|
# |
|
128
|
|
|
|
|
|
|
# This is free software, licensed under: |
|
129
|
|
|
|
|
|
|
# |
|
130
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
|
131
|
|
|
|
|
|
|
# |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
__END__ |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=pod |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=for :stopwords Diab Jerius Smithsonian Astrophysical Observatory ub |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 NAME |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
CXC::Number::Grid::Range - Helper class to track Ranges |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 VERSION |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
version 0.13 |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
A utility class to manage Ranges when doing bin manipulations with trees. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 OBJECT ATTRIBUTES |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 layer |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The grid layer id |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 include |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Whether this range is included or excluded. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 lb |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The inclusive range lower bound |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 ub |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
The exclusive range upper bound |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 METHODS |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 to_string |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
$string = $self->to_string |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Return a string representation of the range. |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 concatenate |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
$string = $range->concatenate( $thing, $swap=false ) |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Concatenate the stringified version of $range with $thing. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Set C<$swap> to true if the order should be reversed. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 value |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
[ $layer, $include ] = $range->value; |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Return an arrayref containing the layer id and the include value for |
|
190
|
|
|
|
|
|
|
the range. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 OVERLOAD |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 "" |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Stringification is overloaded via the L</to_string> method. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 . |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Concatenation is overloaded via the L</concatenate> method. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 INTERNALS |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=for Pod::Coverage BUILDARGS |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 SUPPORT |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 Bugs |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Please report any bugs or feature requests to bug-cxc-number@rt.cpan.org or through the web interface at: L<https://rt.cpan.org/Public/Dist/Display.html?Name=CXC-Number> |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 Source |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Source is available at |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
https://gitlab.com/djerius/cxc-number |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
and may be cloned from |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
https://gitlab.com/djerius/cxc-number.git |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=over 4 |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
L<CXC::Number|CXC::Number> |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=back |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 AUTHOR |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Diab Jerius <djerius@cpan.org> |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Smithsonian Astrophysical Observatory. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This is free software, licensed under: |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=cut |