zakuro 0.9.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/README.md +41 -8
- data/VERSION +1 -1
- data/doc/gengou.md +1 -1
- data/doc/operation/csv/month.csv +5 -5
- data/doc/operation/operation.xlsx +0 -0
- data/images/logo-text.png +0 -0
- data/lib/zakuro/calculation/base/gengou.rb +2 -4
- data/lib/zakuro/calculation/base/year.rb +1 -1
- data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +2 -2
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +1 -1
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +4 -4
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +3 -3
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +1 -1
- data/lib/zakuro/calculation/era/version/internal/crawler.rb +3 -3
- data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +1 -1
- data/lib/zakuro/calculation/monthly/internal/date_comparer.rb +78 -0
- data/lib/zakuro/calculation/monthly/{meta → internal/meta}/all_solar_term.rb +1 -1
- data/lib/zakuro/calculation/monthly/{meta → internal/meta}/meta_collector.rb +2 -2
- data/lib/zakuro/calculation/monthly/{first_day.rb → internal/part/first_day.rb} +2 -2
- data/lib/zakuro/calculation/monthly/{meta.rb → internal/part/meta.rb} +1 -1
- data/lib/zakuro/calculation/monthly/internal/solar_term_selector.rb +203 -0
- data/lib/zakuro/calculation/monthly/month.rb +30 -125
- data/lib/zakuro/calculation/monthly/operated_month.rb +5 -2
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +0 -2
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +24 -10
- data/lib/zakuro/calculation/stella/solar/abstract_average.rb +3 -3
- data/lib/zakuro/calculation/summary/internal/option/dropped_date.rb +102 -0
- data/lib/zakuro/calculation/summary/internal/option/vanished_date.rb +111 -0
- data/lib/zakuro/calculation/summary/internal/option.rb +4 -137
- data/lib/zakuro/calculation/summary/japan/range.rb +4 -5
- data/lib/zakuro/calculation/summary/western/single.rb +0 -2
- data/lib/zakuro/context/version_class_resolver.rb +5 -5
- data/lib/zakuro/era/japan/calendar.rb +4 -4
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +2 -2
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +2 -2
- data/lib/zakuro/era/japan/gengou/alignment.rb +5 -3
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +17 -16
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +3 -394
- data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +2 -2
- data/lib/zakuro/era/japan/gengou.rb +3 -3
- data/lib/zakuro/era/japan/type/base/both/date.rb +51 -0
- data/lib/zakuro/era/japan/type/base/both/year.rb +53 -0
- data/lib/zakuro/era/japan/type/base/gengou.rb +177 -0
- data/lib/zakuro/era/japan/type/base/gengou_set.rb +78 -0
- data/lib/zakuro/era/japan/type/base/switch_date.rb +74 -0
- data/lib/zakuro/era/japan/type/base/version_range.rb +189 -0
- data/lib/zakuro/era/japan/type/validation/both/date.rb +99 -0
- data/lib/zakuro/era/japan/type/validation/both/year.rb +75 -0
- data/lib/zakuro/era/japan/type/validation/gengou.rb +93 -0
- data/lib/zakuro/era/japan/type/validation/gengou_set.rb +133 -0
- data/lib/zakuro/era/japan/type/validation/switch_date.rb +73 -0
- data/lib/zakuro/era/japan/type/validation/version_range.rb +109 -0
- data/lib/zakuro/era/japan/type/validation/version_root.rb +102 -0
- data/lib/zakuro/era/japan/version/resource/parser.rb +266 -0
- data/lib/zakuro/era/japan/version/resource/validator.rb +37 -0
- data/lib/zakuro/era/japan/version/resource/yaml/version.yaml +80 -0
- data/lib/zakuro/era/japan/version/resource.rb +22 -0
- data/lib/zakuro/era/japan/version.rb +4 -115
- data/lib/zakuro/era/western/calendar.rb +2 -2
- data/lib/zakuro/exception/zakuro_error.rb +1 -1
- data/lib/zakuro/merchant.rb +5 -5
- data/lib/zakuro/operation/month/parser.rb +2 -2
- data/lib/zakuro/operation/yaml/month.yaml +5 -5
- data/lib/zakuro/output/logger.rb +4 -4
- data/lib/zakuro/parameter/catalog/basis_date.rb +55 -0
- data/lib/zakuro/parameter/catalog/column.rb +57 -0
- data/lib/zakuro/parameter/catalog/option.rb +60 -0
- data/lib/zakuro/parameter/catalog/range.rb +81 -0
- data/lib/zakuro/parameter/condition.rb +108 -0
- data/lib/zakuro/result/core.rb +2 -2
- data/lib/zakuro/{tools → tool}/remainder_comparer.rb +2 -4
- data/lib/zakuro/{tools → tool}/stringifier.rb +3 -3
- data/lib/zakuro/{tools → tool}/typeconv.rb +2 -2
- data/lib/zakuro/{tools → tool}/typeof.rb +2 -2
- data/lib/zakuro/version/daien/const/number.rb +42 -39
- data/lib/zakuro/version/daien/const/remainder.rb +38 -35
- data/lib/zakuro/version/daien/cycle/remainder.rb +77 -74
- data/lib/zakuro/version/daien/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/daien/daien.rb +8 -5
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +67 -64
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +15 -12
- data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +15 -12
- data/lib/zakuro/version/daien/range/annual_range.rb +27 -24
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +209 -206
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +32 -29
- data/lib/zakuro/version/daien/stella/lunar/location.rb +53 -50
- data/lib/zakuro/version/daien/stella/lunar/value.rb +65 -62
- data/lib/zakuro/version/daien/stella/origin/average_november.rb +23 -20
- data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +42 -39
- data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +44 -41
- data/lib/zakuro/version/daien/stella/solar/adjustment.rb +74 -71
- data/lib/zakuro/version/daien/stella/solar/average.rb +68 -65
- data/lib/zakuro/version/daien/stella/solar/interval.rb +95 -92
- data/lib/zakuro/version/daien/stella/solar/location.rb +41 -38
- data/lib/zakuro/version/daien/stella/solar/value.rb +21 -18
- data/lib/zakuro/version/genka/const/number.rb +31 -28
- data/lib/zakuro/version/genka/const/remainder.rb +20 -17
- data/lib/zakuro/version/genka/cycle/remainder.rb +72 -69
- data/lib/zakuro/version/genka/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/genka/genka.rb +8 -5
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +82 -79
- data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +13 -10
- data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +13 -10
- data/lib/zakuro/version/genka/range/annual_range.rb +57 -54
- data/lib/zakuro/version/genka/stella/origin/first_term.rb +44 -41
- data/lib/zakuro/version/genka/stella/origin/january.rb +38 -35
- data/lib/zakuro/version/genka/stella/solar/average.rb +24 -21
- data/lib/zakuro/version/gihou/const/number.rb +40 -37
- data/lib/zakuro/version/gihou/const/remainder.rb +32 -29
- data/lib/zakuro/version/gihou/cycle/remainder.rb +38 -35
- data/lib/zakuro/version/gihou/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/gihou/gihou.rb +8 -5
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +68 -65
- data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +13 -10
- data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +13 -10
- data/lib/zakuro/version/gihou/range/annual_range.rb +27 -24
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +212 -209
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +32 -29
- data/lib/zakuro/version/gihou/stella/lunar/location.rb +53 -50
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +65 -62
- data/lib/zakuro/version/gihou/stella/origin/average_november.rb +23 -20
- data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +42 -39
- data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +44 -41
- data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +74 -71
- data/lib/zakuro/version/gihou/stella/solar/average.rb +67 -64
- data/lib/zakuro/version/gihou/stella/solar/interval.rb +95 -92
- data/lib/zakuro/version/gihou/stella/solar/location.rb +41 -38
- data/lib/zakuro/version/gihou/stella/solar/value.rb +21 -18
- data/lib/zakuro/version/gregorio/gregorio.rb +8 -5
- data/lib/zakuro/version/houryaku/houryaku.rb +8 -5
- data/lib/zakuro/version/joukyou/joukyou.rb +8 -5
- data/lib/zakuro/version/kansei/kansei.rb +8 -5
- data/lib/zakuro/version/senmyou/const/number.rb +40 -37
- data/lib/zakuro/version/senmyou/const/remainder.rb +35 -32
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +74 -71
- data/lib/zakuro/version/senmyou/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +69 -66
- data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +15 -12
- data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +15 -12
- data/lib/zakuro/version/senmyou/range/annual_range.rb +27 -24
- data/lib/zakuro/version/senmyou/senmyou.rb +8 -5
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +206 -203
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +32 -29
- data/lib/zakuro/version/senmyou/stella/lunar/location.rb +60 -57
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +66 -63
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +23 -20
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +42 -39
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +44 -41
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +74 -71
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +67 -64
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +93 -90
- data/lib/zakuro/version/senmyou/stella/solar/location.rb +41 -38
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +23 -20
- data/lib/zakuro/version/tenpou/tenpou.rb +8 -5
- metadata +44 -20
- data/lib/zakuro/condition.rb +0 -306
- data/lib/zakuro/era/japan/gengou/resource/type.rb +0 -356
- data/lib/zakuro/tools/gengou_range_comparer.rb +0 -82
- /data/lib/zakuro/calculation/monthly/{operated_solar_term.rb → internal/operated_solar_term.rb} +0 -0
- /data/lib/zakuro/calculation/monthly/{const.rb → internal/part/const.rb} +0 -0
- /data/lib/zakuro/calculation/monthly/{month_label.rb → internal/part/month_label.rb} +0 -0
@@ -7,88 +7,91 @@ require_relative '../const/number'
|
|
7
7
|
# :nodoc:
|
8
8
|
module Zakuro
|
9
9
|
# :nodoc:
|
10
|
-
module
|
10
|
+
module Version
|
11
11
|
# :nodoc:
|
12
|
-
module
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
module Genka
|
13
|
+
# :nodoc:
|
14
|
+
module Cycle
|
15
|
+
#
|
16
|
+
# Remainder 時刻情報(大余小余)
|
17
|
+
#
|
18
|
+
class Remainder < Calculation::Cycle::AbstractRemainder
|
19
|
+
#
|
20
|
+
# @note 『歴代天文律暦等志彙編 六』中華書房 p.1727
|
21
|
+
# 「推弦望法..加朔大餘七,小餘二百八十七,小分三,小分満四從小餘」
|
22
|
+
#
|
23
|
+
# @return [Integer] 分(1分=4秒)
|
24
|
+
MINUTE = 4
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
#
|
27
|
+
# 初期化
|
28
|
+
#
|
29
|
+
# @param [Integer] day 大余("日"に相当)
|
30
|
+
# @param [Integer] minute 小余("分"に相当)
|
31
|
+
# @param [Integer] second 秒
|
32
|
+
# @param [Integer] total 繰り上げなしの小余
|
33
|
+
#
|
34
|
+
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
35
|
+
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
36
|
+
day: day, minute: minute, second: second, total: total)
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
#
|
40
|
+
# 特定の文字フォーマットにして出力する
|
41
|
+
#
|
42
|
+
# @return [String] フォーマットした結果
|
43
|
+
#
|
44
|
+
def format(form: '%.4f', digit: 4)
|
45
|
+
return '' if invalid?
|
44
46
|
|
45
|
-
|
47
|
+
decimal = day + minute / base_day.to_f
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
# NOTE: 親クラスを迂回する
|
50
|
+
Kernel.instance_method(:format).bind(self).call(form, decimal.round(digit))
|
51
|
+
end
|
49
52
|
end
|
50
|
-
end
|
51
53
|
|
52
|
-
#
|
53
|
-
# TermRemainder 時刻情報(大余小余)
|
54
|
-
#
|
55
|
-
class TermRemainder < Calculation::Cycle::AbstractRemainder
|
56
54
|
#
|
57
|
-
#
|
58
|
-
# 「氣法,二十四」
|
55
|
+
# TermRemainder 時刻情報(大余小余)
|
59
56
|
#
|
60
|
-
|
61
|
-
|
57
|
+
class TermRemainder < Calculation::Cycle::AbstractRemainder
|
58
|
+
#
|
59
|
+
# @note 『歴代天文律暦等志彙編 六』中華書房 p.1726
|
60
|
+
# 「氣法,二十四」
|
61
|
+
#
|
62
|
+
# @return [Integer] 分(1分=24秒)
|
63
|
+
MINUTE = 24
|
62
64
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
65
|
+
#
|
66
|
+
# 初期化
|
67
|
+
#
|
68
|
+
# @param [Integer] day 大余("日"に相当)
|
69
|
+
# @param [Integer] minute 小余("分"に相当)
|
70
|
+
# @param [Integer] second 秒
|
71
|
+
# @param [Integer] total 繰り上げなしの小余
|
72
|
+
#
|
73
|
+
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
74
|
+
super(base_day: Const::Number::Cycle::TERM_DAY, base_minute: MINUTE,
|
75
|
+
day: day, minute: minute, second: second, total: total)
|
76
|
+
end
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
#
|
79
|
+
# 特定の文字フォーマットにして出力する
|
80
|
+
#
|
81
|
+
# @return [String] フォーマットした結果
|
82
|
+
#
|
83
|
+
def format(form: '%.4f', digit: 4)
|
84
|
+
return '' if invalid?
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
decimal = day + minute / base_day.to_f
|
87
|
+
# NOTE: roundなしで format を使用した場合は、四捨五入が正しく実行されないことが判明した
|
88
|
+
# 具体的には、468年の中気は '55.7813' だが '55.7812' になる
|
89
|
+
# これは '55.7812500' を4桁にした際に、境界値の少数点以下5桁目の '5' が切り捨てを受けたためである
|
90
|
+
# format による四捨五入は避け、roundによる四捨五入を採用する
|
89
91
|
|
90
|
-
|
91
|
-
|
92
|
+
# NOTE: 親クラスを迂回する
|
93
|
+
Kernel.instance_method(:format).bind(self).call(form, decimal.round(digit))
|
94
|
+
end
|
92
95
|
end
|
93
96
|
end
|
94
97
|
end
|
@@ -9,24 +9,27 @@ require_relative './remainder'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Version
|
13
13
|
# :nodoc:
|
14
|
-
module
|
15
|
-
#
|
16
|
-
|
17
|
-
#
|
18
|
-
class SolarTerm < Calculation::Cycle::AbstractSolarTerm
|
19
|
-
# @return [Remainder] 気策(24分の1年)
|
20
|
-
SOLAR_TERM_AVERAGE = Const::Remainder::SOLAR_TERM_AVERAGE
|
21
|
-
|
22
|
-
#
|
23
|
-
# 初期化
|
14
|
+
module Genka
|
15
|
+
# :nodoc:
|
16
|
+
module Cycle
|
24
17
|
#
|
25
|
-
#
|
26
|
-
# @param [Remainder] remainder 時刻情報(大余小余)
|
18
|
+
# SolarTerm 二十四節気
|
27
19
|
#
|
28
|
-
|
29
|
-
|
20
|
+
class SolarTerm < Calculation::Cycle::AbstractSolarTerm
|
21
|
+
# @return [Remainder] 気策(24分の1年)
|
22
|
+
SOLAR_TERM_AVERAGE = Const::Remainder::SOLAR_TERM_AVERAGE
|
23
|
+
|
24
|
+
#
|
25
|
+
# 初期化
|
26
|
+
#
|
27
|
+
# @param [Integer] index 連番
|
28
|
+
# @param [Remainder] remainder 時刻情報(大余小余)
|
29
|
+
#
|
30
|
+
def initialize(index: -1, remainder: TermRemainder.new)
|
31
|
+
super(index: index, remainder: remainder, average: SOLAR_TERM_AVERAGE)
|
32
|
+
end
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../../../calculation/monthly/const'
|
3
|
+
require_relative '../../../calculation/monthly/internal/part/const'
|
4
4
|
|
5
5
|
require_relative '../const/remainder'
|
6
6
|
|
@@ -13,94 +13,97 @@ require_relative '../stella/origin/january'
|
|
13
13
|
# :nodoc:
|
14
14
|
module Zakuro
|
15
15
|
# :nodoc:
|
16
|
-
module
|
16
|
+
module Version
|
17
17
|
# :nodoc:
|
18
|
-
module
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
# 次の弦に進める
|
49
|
-
#
|
50
|
-
# @return [Remainder] 経朔
|
51
|
-
#
|
52
|
-
def next_phase
|
53
|
-
adjusted = remainder.clone
|
18
|
+
module Genka
|
19
|
+
# :nodoc:
|
20
|
+
module Monthly
|
21
|
+
#
|
22
|
+
# LunarPhase 月の位相
|
23
|
+
#
|
24
|
+
class LunarPhase
|
25
|
+
# @return [Cycle::Remainder] 弦
|
26
|
+
QUARTER = Const::Remainder::QUARTER
|
27
|
+
|
28
|
+
# @return [Array<String>] 月内の弦
|
29
|
+
PHASE_INDEXES = Calculation::Monthly::Const::PHASE_INDEXES
|
30
|
+
|
31
|
+
# @return [Integer] 弦の位置
|
32
|
+
attr_reader :index
|
33
|
+
# @return [Cycle::AbstractRemainder] 経
|
34
|
+
attr_reader :remainder
|
35
|
+
|
36
|
+
#
|
37
|
+
# 初期化
|
38
|
+
#
|
39
|
+
# @param [Cycle::Remainder] remainder 正月経朔
|
40
|
+
#
|
41
|
+
def initialize(remainder:)
|
42
|
+
# 経
|
43
|
+
@remainder = remainder
|
44
|
+
|
45
|
+
# 弦の位置
|
46
|
+
@index = 0
|
47
|
+
end
|
54
48
|
|
55
|
-
|
49
|
+
#
|
50
|
+
# 次の弦に進める
|
51
|
+
#
|
52
|
+
# @return [Remainder] 経朔
|
53
|
+
#
|
54
|
+
def next_phase
|
55
|
+
adjusted = remainder.clone
|
56
56
|
|
57
|
-
|
58
|
-
end
|
57
|
+
add_quarter_moon_size
|
59
58
|
|
60
|
-
|
61
|
-
# 次の月に進める
|
62
|
-
# @note 進めた後の月の経朔ではなく、当月のものを返却する
|
63
|
-
#
|
64
|
-
# @return [Remainder] 当月初の経朔
|
65
|
-
#
|
66
|
-
def next_month
|
67
|
-
result = nil
|
68
|
-
PHASE_INDEXES.each_with_index do |_phase, index|
|
69
|
-
adjust = next_phase
|
70
|
-
result = adjust if index.zero?
|
59
|
+
adjusted
|
71
60
|
end
|
72
61
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
62
|
+
#
|
63
|
+
# 次の月に進める
|
64
|
+
# @note 進めた後の月の経朔ではなく、当月のものを返却する
|
65
|
+
#
|
66
|
+
# @return [Remainder] 当月初の経朔
|
67
|
+
#
|
68
|
+
def next_month
|
69
|
+
result = nil
|
70
|
+
PHASE_INDEXES.each_with_index do |_phase, index|
|
71
|
+
adjust = next_phase
|
72
|
+
result = adjust if index.zero?
|
73
|
+
end
|
74
|
+
|
75
|
+
result
|
76
|
+
end
|
86
77
|
|
87
|
-
|
78
|
+
#
|
79
|
+
# 経朔を返す
|
80
|
+
#
|
81
|
+
# 元嘉暦には経朔しかないが他の暦と揃える
|
82
|
+
#
|
83
|
+
# @return [Remainder] 経朔
|
84
|
+
#
|
85
|
+
def average_remainder
|
86
|
+
@remainder
|
87
|
+
end
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
89
|
+
private
|
90
|
+
|
91
|
+
#
|
92
|
+
# 次の弦に進める
|
93
|
+
#
|
94
|
+
# @return [Integer] 弦
|
95
|
+
#
|
96
|
+
def next_index
|
97
|
+
@index += 1
|
98
|
+
@index = 0 if index >= PHASE_INDEXES.size
|
99
|
+
@index
|
100
|
+
end
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
+
def add_quarter_moon_size
|
103
|
+
remainder.add!(QUARTER)
|
102
104
|
|
103
|
-
|
105
|
+
next_index
|
106
|
+
end
|
104
107
|
end
|
105
108
|
end
|
106
109
|
end
|
@@ -9,20 +9,23 @@ require_relative '../../cycle/remainder'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Version
|
13
13
|
# :nodoc:
|
14
|
-
module
|
14
|
+
module Genka
|
15
15
|
# :nodoc:
|
16
|
-
module
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
16
|
+
module Option
|
17
|
+
# :nodoc:
|
18
|
+
module DroppedDate
|
21
19
|
#
|
22
|
-
#
|
20
|
+
# Parameter 引数
|
23
21
|
#
|
24
|
-
|
25
|
-
|
22
|
+
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
23
|
+
#
|
24
|
+
# 初期化
|
25
|
+
#
|
26
|
+
def initialize
|
27
|
+
super(valid: false)
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -9,20 +9,23 @@ require_relative '../../cycle/remainder'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Version
|
13
13
|
# :nodoc:
|
14
|
-
module
|
14
|
+
module Genka
|
15
15
|
# :nodoc:
|
16
|
-
module
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
16
|
+
module Option
|
17
|
+
# :nodoc:
|
18
|
+
module VanishedDate
|
21
19
|
#
|
22
|
-
#
|
20
|
+
# Parameter 引数
|
23
21
|
#
|
24
|
-
|
25
|
-
|
22
|
+
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
23
|
+
#
|
24
|
+
# 初期化
|
25
|
+
#
|
26
|
+
def initialize
|
27
|
+
super(valid: false)
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -8,71 +8,74 @@ require_relative '../stella/solar/average'
|
|
8
8
|
# :nodoc:
|
9
9
|
module Zakuro
|
10
10
|
# :nodoc:
|
11
|
-
module
|
11
|
+
module Version
|
12
12
|
# :nodoc:
|
13
|
-
module
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
|
13
|
+
module Genka
|
14
|
+
# :nodoc:
|
15
|
+
module Range
|
16
|
+
#
|
17
|
+
# AnnualRange 年間範囲
|
18
|
+
#
|
19
|
+
module AnnualRange
|
20
|
+
# @return [Output::Logger] ロガー
|
21
|
+
LOGGER = Output::Logger.new(location: 'annual_range')
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
23
|
+
class << self
|
24
|
+
#
|
25
|
+
# 一覧取得する
|
26
|
+
#
|
27
|
+
# * 対象年に対して、当年1月-翌年1月までを出力する
|
28
|
+
# * 対象年(西暦)と計算年(元号x年)の紐付けは行わない
|
29
|
+
#
|
30
|
+
# @param [Context::Context] context 暦コンテキスト
|
31
|
+
# @param [Integer] western_year 西暦年
|
32
|
+
#
|
33
|
+
# @return [Array<Month>] 1年データ
|
34
|
+
#
|
35
|
+
def get(context:, western_year:)
|
36
|
+
# 正月中気
|
37
|
+
solar_term = Cycle::SolarTerm.new(
|
38
|
+
index: 4, remainder: Origin::FirstTerm.get(western_year: western_year)
|
39
|
+
)
|
40
|
+
# 正月に立春が含まれる可能性があるので、立春まで戻しておく
|
41
|
+
solar_term.prev_term!
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
+
# 経
|
44
|
+
remainder = Origin::January.get(western_year: western_year)
|
43
45
|
|
44
|
-
|
46
|
+
lunar_phase = Monthly::LunarPhase.new(remainder: remainder)
|
45
47
|
|
46
|
-
|
48
|
+
solar_average = Solar::Average.new(solar_term: solar_term)
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
annual_range = Calculation::Range::MedievalAnnualRange.get(
|
51
|
+
context: context, lunar_phase: lunar_phase, solar_average: solar_average
|
52
|
+
)
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
+
pop_months_on_next_year(annual_range: annual_range)
|
55
|
+
end
|
54
56
|
|
55
|
-
|
57
|
+
private
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
#
|
60
|
+
# 来年の月を除去する
|
61
|
+
#
|
62
|
+
# @param [Array<Month>] annual_range 1年データ
|
63
|
+
#
|
64
|
+
# @return [Array<Month>] 1年データ
|
65
|
+
#
|
66
|
+
def pop_months_on_next_year(annual_range:)
|
67
|
+
result = []
|
68
|
+
number = 0
|
69
|
+
annual_range.each do |month|
|
70
|
+
# 来年
|
71
|
+
break if number > month.month_label.number
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
number = month.month_label.number
|
74
|
+
result.push(month)
|
75
|
+
end
|
74
76
|
|
75
|
-
|
77
|
+
result
|
78
|
+
end
|
76
79
|
end
|
77
80
|
end
|
78
81
|
end
|