line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::Coord::ECI::Mixin; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
418
|
use 5.006002; |
|
16
|
|
|
|
|
60
|
|
4
|
|
|
|
|
|
|
|
5
|
16
|
|
|
16
|
|
104
|
use strict; |
|
16
|
|
|
|
|
31
|
|
|
16
|
|
|
|
|
355
|
|
6
|
16
|
|
|
16
|
|
77
|
use warnings; |
|
16
|
|
|
|
|
34
|
|
|
16
|
|
|
|
|
478
|
|
7
|
|
|
|
|
|
|
|
8
|
16
|
|
|
16
|
|
87
|
use Carp; |
|
16
|
|
|
|
|
50
|
|
|
16
|
|
|
|
|
1054
|
|
9
|
|
|
|
|
|
|
|
10
|
16
|
|
|
|
|
1643
|
use Astro::Coord::ECI::Utils qw{ __default_station |
11
|
|
|
|
|
|
|
ARRAY_REF PIOVER2 SECSPERDAY |
12
|
|
|
|
|
|
|
@CARP_NOT |
13
|
16
|
|
|
16
|
|
111
|
}; |
|
16
|
|
|
|
|
33
|
|
14
|
16
|
|
|
16
|
|
122
|
use Exporter (); |
|
16
|
|
|
|
|
81
|
|
|
16
|
|
|
|
|
414
|
|
15
|
16
|
|
|
16
|
|
87
|
use POSIX qw{ floor }; |
|
16
|
|
|
|
|
54
|
|
|
16
|
|
|
|
|
105
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.130'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @EXPORT_OK = qw{ |
20
|
|
|
|
|
|
|
almanac almanac_hash |
21
|
|
|
|
|
|
|
next_quarter next_quarter_hash |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
25
|
|
|
|
|
|
|
almanac => [ qw{ almanac almanac_hash } ], |
26
|
|
|
|
|
|
|
quarter => [ qw{ next_quarter next_quarter_hash } ], |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
BEGIN { |
30
|
|
|
|
|
|
|
# Because 5.6.2's Exporter does not export 'import()'. |
31
|
16
|
|
|
16
|
|
12471
|
*import = \&Exporter::import; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub almanac { |
35
|
5
|
|
|
5
|
1
|
36
|
my ( $self, $station, $start, $end ) = __default_station( @_ ); |
36
|
5
|
50
|
|
|
|
29
|
defined $start |
37
|
|
|
|
|
|
|
or $start = $self->universal(); |
38
|
5
|
50
|
|
|
|
35
|
defined $end |
39
|
|
|
|
|
|
|
or $end = $start + SECSPERDAY; |
40
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
11
|
my @almanac; |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
46
|
my $iterator = $self->__almanac_event_type_iterator( $station ); |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
15
|
while ( my ( $obj, $method, $args, $event, $descr ) = $iterator->() ) { |
46
|
|
|
|
|
|
|
|
47
|
17
|
|
|
|
|
76
|
$obj->universal( $start ); |
48
|
17
|
|
|
|
|
54
|
while ( 1 ) { |
49
|
41
|
|
|
|
|
200
|
my ( $time, $which ) = $obj->$method ( @$args ); |
50
|
41
|
100
|
|
|
|
247
|
$time >= $end |
51
|
|
|
|
|
|
|
and last; |
52
|
24
|
50
|
|
|
|
225
|
defined ( my $text = ARRAY_REF eq ref $descr ? |
|
|
100
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$descr->[ $which ] : $self->$descr( $which ) ) |
54
|
|
|
|
|
|
|
or next; |
55
|
21
|
|
|
|
|
88
|
push @almanac, [ $time, $event, $which, $text ]; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
5
|
|
|
|
|
85
|
return (sort {$a->[0] <=> $b->[0]} @almanac); |
|
31
|
|
|
|
|
209
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub almanac_hash { |
63
|
3
|
|
|
3
|
1
|
19
|
my ( $self, $station, $start, $end ) = __default_station( @_ ); |
64
|
3
|
|
|
|
|
20
|
return map { |
65
|
|
|
|
|
|
|
body => $self, |
66
|
|
|
|
|
|
|
station => $station, |
67
|
|
|
|
|
|
|
time => $_->[0], |
68
|
|
|
|
|
|
|
almanac => { |
69
|
|
|
|
|
|
|
event => $_->[1], |
70
|
|
|
|
|
|
|
detail => $_->[2], |
71
|
|
|
|
|
|
|
description => $_->[3], |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
}, $self->almanac( $station, $start, $end ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub next_quarter { |
77
|
5
|
|
|
5
|
1
|
20
|
my ( $self, $quarter ) = @_; |
78
|
5
|
|
|
|
|
20
|
my $next_quarter_inc = $self->NEXT_QUARTER_INCREMENT(); |
79
|
|
|
|
|
|
|
|
80
|
5
|
100
|
|
|
|
27
|
$quarter = ( defined $quarter ? $quarter : |
81
|
|
|
|
|
|
|
floor( $self->__next_quarter_coordinate() / PIOVER2 ) + 1 ) % 4; |
82
|
5
|
|
|
|
|
7
|
my $begin; |
83
|
5
|
|
|
|
|
17
|
while ( floor( $self->__next_quarter_coordinate() / PIOVER2 ) == $quarter ) { |
84
|
0
|
|
|
|
|
0
|
$begin = $self->dynamical(); |
85
|
0
|
|
|
|
|
0
|
$self->dynamical( $begin + $next_quarter_inc ); |
86
|
|
|
|
|
|
|
} |
87
|
5
|
|
|
|
|
34
|
while ( floor( $self->__next_quarter_coordinate() / PIOVER2 ) != $quarter ) { |
88
|
12
|
|
|
|
|
31
|
$begin = $self->dynamical(); |
89
|
12
|
|
|
|
|
41
|
$self->dynamical($begin + $next_quarter_inc); |
90
|
|
|
|
|
|
|
} |
91
|
5
|
|
|
|
|
29
|
my $end = $self->dynamical(); |
92
|
|
|
|
|
|
|
|
93
|
5
|
|
|
|
|
44
|
while ( $end - $begin > 1 ) { |
94
|
95
|
|
|
|
|
206
|
my $mid = floor( ( $begin + $end ) / 2 ); |
95
|
95
|
|
|
|
|
230
|
my $qq = floor( $self->dynamical($mid )->__next_quarter_coordinate() / |
96
|
|
|
|
|
|
|
PIOVER2 ); |
97
|
95
|
100
|
|
|
|
380
|
( $begin, $end ) = $qq == $quarter ? |
98
|
|
|
|
|
|
|
( $begin, $mid ) : ( $mid, $end ); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
5
|
|
|
|
|
37
|
$self->dynamical( $end ); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
return wantarray ? ( |
104
|
5
|
100
|
|
|
|
59
|
$self->universal, $quarter, $self->__quarter_name( $quarter ), |
105
|
|
|
|
|
|
|
) : $self->universal(); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub next_quarter_hash { |
109
|
1
|
|
|
1
|
1
|
5
|
my ( $self, @args ) = @_; |
110
|
1
|
|
|
|
|
4
|
my ( $time, $quarter, $desc ) = $self->next_quarter( @args ); |
111
|
1
|
|
|
|
|
9
|
my %hash = ( |
112
|
|
|
|
|
|
|
body => $self, |
113
|
|
|
|
|
|
|
almanac => { |
114
|
|
|
|
|
|
|
event => 'quarter', |
115
|
|
|
|
|
|
|
detail => $quarter, |
116
|
|
|
|
|
|
|
description => $desc, |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
time => $time, |
119
|
|
|
|
|
|
|
); |
120
|
1
|
50
|
|
|
|
7
|
return wantarray ? %hash : \%hash; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
__END__ |