zakuro 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/VERSION +1 -1
- data/lib/zakuro/calculation/base/gengou.rb +5 -5
- data/lib/zakuro/calculation/base/linear_gengou.rb +5 -5
- data/lib/zakuro/calculation/base/operated_year.rb +23 -21
- data/lib/zakuro/calculation/base/year.rb +3 -3
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +50 -44
- data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +28 -24
- data/lib/zakuro/calculation/cycle/zodiac.rb +22 -20
- data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +38 -29
- data/lib/zakuro/calculation/era/gengou/internal/connector.rb +4 -4
- data/lib/zakuro/calculation/era/gengou/internal/counter.rb +16 -16
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +74 -72
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +16 -16
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +58 -35
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +3 -3
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +111 -113
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +6 -6
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +7 -9
- data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +22 -20
- data/lib/zakuro/calculation/era/version/internal/crawler.rb +39 -22
- data/lib/zakuro/calculation/era/version/version.rb +12 -10
- data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +13 -9
- data/lib/zakuro/calculation/monthly/const.rb +18 -0
- data/lib/zakuro/calculation/monthly/initialized_month.rb +39 -37
- data/lib/zakuro/calculation/monthly/month.rb +15 -15
- data/lib/zakuro/calculation/monthly/month_label.rb +4 -4
- data/lib/zakuro/calculation/monthly/operated_month.rb +36 -85
- data/lib/zakuro/calculation/monthly/operated_solar_term.rb +80 -0
- data/lib/zakuro/calculation/range/abstract_full_range.rb +34 -21
- data/lib/zakuro/calculation/range/abstract_operation_range.rb +109 -107
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +64 -63
- data/lib/zakuro/calculation/range/operated_solar_term.rb +220 -0
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +32 -29
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +115 -117
- data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +1 -1
- data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +48 -46
- data/lib/zakuro/calculation/stella/solar/abstract_average.rb +31 -26
- data/lib/zakuro/calculation/stella/solar/abstract_location.rb +5 -5
- data/lib/zakuro/calculation/stella/solar/choukei_value.rb +114 -114
- data/lib/zakuro/calculation/summary/internal/day.rb +21 -19
- data/lib/zakuro/calculation/summary/internal/month.rb +25 -12
- data/lib/zakuro/calculation/summary/internal/operation.rb +68 -67
- data/lib/zakuro/calculation/summary/internal/option.rb +66 -50
- data/lib/zakuro/calculation/summary/japan/range.rb +145 -124
- data/lib/zakuro/calculation/summary/japan/single.rb +87 -87
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +54 -52
- data/lib/zakuro/calculation/summary/japan/specifier/specified_range.rb +34 -0
- data/lib/zakuro/calculation/summary/western/range.rb +95 -92
- data/lib/zakuro/calculation/summary/western/single.rb +78 -76
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +123 -124
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +60 -58
- data/lib/zakuro/calculation/type/old_float.rb +2 -2
- data/lib/zakuro/condition.rb +121 -111
- data/lib/zakuro/context/context.rb +1 -1
- data/lib/zakuro/context/option.rb +31 -29
- data/lib/zakuro/context/version_class_resolver.rb +26 -24
- data/lib/zakuro/era/japan/calendar.rb +35 -33
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +4 -4
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +117 -118
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +7 -5
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +20 -14
- data/lib/zakuro/era/japan/gengou/alignment.rb +27 -25
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +51 -36
- data/lib/zakuro/era/japan/gengou/resource/type.rb +39 -37
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +34 -32
- data/lib/zakuro/era/japan/gengou.rb +28 -26
- data/lib/zakuro/era/japan/version.rb +18 -16
- data/lib/zakuro/era/western/calendar.rb +102 -90
- data/lib/zakuro/exception/case/preset.rb +2 -2
- data/lib/zakuro/exception/exception.rb +15 -13
- data/lib/zakuro/exception/zakuro_error.rb +1 -1
- data/lib/zakuro/gateway/locale/date.rb +2 -2
- data/lib/zakuro/gateway/locale/range.rb +3 -3
- data/lib/zakuro/gateway/range.rb +1 -1
- data/lib/zakuro/gateway/single.rb +13 -2
- data/lib/zakuro/merchant.rb +1 -1
- data/lib/zakuro/operation/month/parser.rb +252 -251
- data/lib/zakuro/operation/month/type.rb +17 -8
- data/lib/zakuro/operation/month/validator.rb +148 -144
- data/lib/zakuro/operation/operation.rb +38 -36
- data/lib/zakuro/output/response.rb +112 -113
- data/lib/zakuro/result/operation/month/annotation.rb +2 -2
- data/lib/zakuro/result/operation/month/history.rb +2 -2
- data/lib/zakuro/result/operation/month.rb +31 -0
- data/lib/zakuro/result/operation.rb +39 -0
- data/lib/zakuro/result/result.rb +3 -3
- data/lib/zakuro/tools/stringifier.rb +66 -64
- data/lib/zakuro/tools/typeconv.rb +17 -15
- data/lib/zakuro/tools/typeof.rb +15 -13
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +10 -12
- data/lib/zakuro/version/daien/range/annual_range.rb +19 -17
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +42 -39
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/daien/stella/lunar/value.rb +52 -49
- data/lib/zakuro/version/daien/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +22 -20
- data/lib/zakuro/version/daien/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/daien/stella/solar/average.rb +53 -51
- data/lib/zakuro/version/daien/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/daien/stella/solar/value.rb +13 -11
- data/lib/zakuro/version/genka/cycle/remainder.rb +2 -2
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +7 -5
- data/lib/zakuro/version/genka/range/annual_range.rb +48 -44
- data/lib/zakuro/version/genka/stella/origin/first_term.rb +30 -28
- data/lib/zakuro/version/genka/stella/origin/january.rb +22 -20
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +9 -9
- data/lib/zakuro/version/gihou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +42 -39
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +52 -49
- data/lib/zakuro/version/gihou/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +24 -22
- data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/gihou/stella/solar/average.rb +52 -50
- data/lib/zakuro/version/gihou/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/gihou/stella/solar/value.rb +13 -11
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +10 -10
- data/lib/zakuro/version/senmyou/range/annual_range.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +42 -38
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +16 -14
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +39 -36
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +15 -13
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +23 -21
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +22 -20
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +12 -10
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +52 -50
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +19 -17
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +13 -11
- metadata +12 -9
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -218
- data/lib/zakuro/result/operation/bundle.rb +0 -44
- data/lib/zakuro/result/operation/month/bundle.rb +0 -36
@@ -57,11 +57,13 @@ module Zakuro
|
|
57
57
|
# @return [False] 不一致
|
58
58
|
#
|
59
59
|
def match?(forward:, day:, minute:)
|
60
|
-
|
60
|
+
inner_forward = @forward
|
61
|
+
return false unless inner_forward == forward
|
61
62
|
|
62
|
-
|
63
|
+
inner_day = @day
|
64
|
+
return false unless inner_day == day
|
63
65
|
|
64
|
-
return false unless
|
66
|
+
return false unless range.include?(minute: minute)
|
65
67
|
|
66
68
|
true
|
67
69
|
end
|
@@ -72,7 +74,7 @@ module Zakuro
|
|
72
74
|
# @return [Integer] 分母
|
73
75
|
#
|
74
76
|
def denominator
|
75
|
-
|
77
|
+
range.denominator
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
@@ -114,7 +116,7 @@ module Zakuro
|
|
114
116
|
# @return [False] 含まれない
|
115
117
|
#
|
116
118
|
def include?(minute:)
|
117
|
-
minute >=
|
119
|
+
minute >= min && minute <= max
|
118
120
|
end
|
119
121
|
|
120
122
|
#
|
@@ -123,7 +125,7 @@ module Zakuro
|
|
123
125
|
# @return [Integer] 分母
|
124
126
|
#
|
125
127
|
def denominator
|
126
|
-
|
128
|
+
max - min
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
@@ -153,7 +155,7 @@ module Zakuro
|
|
153
155
|
# @return [String] 文字
|
154
156
|
#
|
155
157
|
def to_s
|
156
|
-
"per:#{
|
158
|
+
"per:#{per}, stack:#{stack}"
|
157
159
|
end
|
158
160
|
end
|
159
161
|
|
@@ -196,42 +198,44 @@ module Zakuro
|
|
196
198
|
].freeze
|
197
199
|
# rubocop:enable Layout/LineLength
|
198
200
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
201
|
+
class << self
|
202
|
+
#
|
203
|
+
# 月軌道の補正に必要な基本値を引き当てる
|
204
|
+
#
|
205
|
+
# @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
|
206
|
+
# @param [Integer] day 大余
|
207
|
+
# @param [Integer] minute 小余
|
208
|
+
#
|
209
|
+
# @return [Row] 補正値
|
210
|
+
#
|
211
|
+
# @raise [ArgumentError] 引数エラー
|
212
|
+
#
|
213
|
+
def specify(forward:, day:, minute:)
|
214
|
+
LIST.each do |row|
|
215
|
+
# NOTE: 範囲が重複している場合、最初に引き当てたほうを優先する
|
216
|
+
return row if row.match?(forward: forward, day: day, minute: minute)
|
217
|
+
end
|
215
218
|
|
216
|
-
|
217
|
-
|
219
|
+
raise ArgumentError.new, "invalid parameter: #{forward}/#{day}/#{minute}"
|
220
|
+
end
|
218
221
|
|
219
|
-
|
222
|
+
# :reek:ControlParameter
|
220
223
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
224
|
+
#
|
225
|
+
# 小余の下げ幅を求める
|
226
|
+
#
|
227
|
+
# @param [Integer] day 大余
|
228
|
+
# @param [Integer] minute 小余
|
229
|
+
#
|
230
|
+
# @return [Integer] 小余の下げ幅
|
231
|
+
#
|
232
|
+
def minus_minute(day:, minute:)
|
233
|
+
return minute unless HALF_DAYS.include?(day)
|
231
234
|
|
232
|
-
|
235
|
+
return minute unless minute > Range::HALF
|
233
236
|
|
234
|
-
|
237
|
+
minute - Range::HALF
|
238
|
+
end
|
235
239
|
end
|
236
240
|
end
|
237
241
|
end
|
@@ -21,22 +21,24 @@ module Zakuro
|
|
21
21
|
# @return [Integer] 年
|
22
22
|
YEAR = Const::Number::Cycle::YEAR
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
24
|
+
class << self
|
25
|
+
#
|
26
|
+
# 対象年の最初の入暦を求める
|
27
|
+
#
|
28
|
+
# @param [Remainder] lunar_age 天正閏余
|
29
|
+
# @param [Integer] western_year 西暦年
|
30
|
+
#
|
31
|
+
# @return [Cycle::LunarRemainder] 入暦
|
32
|
+
#
|
33
|
+
def first_remainder(lunar_age:, western_year:)
|
34
|
+
# 積年の開始から対象年までの年数
|
35
|
+
total_year = TOTAL_YEAR + western_year - BEGIN_YEAR
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
# 通積分 - 天正閏余
|
38
|
+
total_day = total_year * YEAR - lunar_age.to_minute
|
38
39
|
|
39
|
-
|
40
|
+
Cycle::LunarRemainder.new(total: (total_day % ANOMALISTIC_MONTH))
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -18,51 +18,54 @@ module Zakuro
|
|
18
18
|
module Value
|
19
19
|
# :reek:TooManyStatements { max_statements: 9 }
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
class << self
|
22
|
+
#
|
23
|
+
# 月の運行による補正値を算出する
|
24
|
+
#
|
25
|
+
# @param [Cycle::LunarRemainder] remainder 月の大余小余
|
26
|
+
# @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
|
27
|
+
#
|
28
|
+
# @return [Integer] 補正値
|
29
|
+
#
|
30
|
+
def get(remainder:, forward:)
|
31
|
+
valid?(remainder: remainder)
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
day, minute = Calculation::Lunar::ChoukeiValue.remainder_without_second(
|
34
|
+
remainder: remainder
|
35
|
+
)
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
# 引き当て
|
38
|
+
row = Adjustment.specify(forward: forward, day: day, minute: minute)
|
38
39
|
|
39
|
-
|
40
|
+
value = row.value
|
40
41
|
|
41
|
-
|
42
|
+
minus_minute = Adjustment.minus_minute(day: day, minute: minute)
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
day = Calculation::Lunar::ChoukeiValue.rounded_day(
|
45
|
+
per: value.per, denominator: row.denominator, minute: minus_minute
|
46
|
+
)
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
value.stack + day
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
53
|
+
#
|
54
|
+
# 大余小余を検証する
|
55
|
+
#
|
56
|
+
# @param [Cycle::LunarRemainder] remainder 大余小余
|
57
|
+
#
|
58
|
+
# @return [True] 正しい(月の位相計算に使う大余小余)
|
59
|
+
# @return [True] 正しくない
|
60
|
+
#
|
61
|
+
# @raise [ArgumentError] 引数エラー
|
62
|
+
#
|
63
|
+
def valid?(remainder:)
|
64
|
+
return if remainder.is_a?(Cycle::LunarRemainder)
|
62
65
|
|
63
|
-
|
66
|
+
raise ArgumentError, "unmatch parameter type: #{remainder.class}"
|
67
|
+
end
|
64
68
|
end
|
65
|
-
private_class_method :valid?
|
66
69
|
end
|
67
70
|
end
|
68
71
|
end
|
@@ -13,20 +13,22 @@ module Zakuro
|
|
13
13
|
# AverageNovember 11月経
|
14
14
|
#
|
15
15
|
module AverageNovember
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
class << self
|
17
|
+
#
|
18
|
+
# 11月経朔(冬至が含まれる月の1日)を求める
|
19
|
+
#
|
20
|
+
# @param [Integer] western_year 西暦年
|
21
|
+
#
|
22
|
+
# @return [Remainder] 11月経朔
|
23
|
+
#
|
24
|
+
def get(western_year:)
|
25
|
+
# 冬至
|
26
|
+
winter_solstice = WinterSolstice.get(western_year: western_year)
|
27
|
+
# 天正閏余
|
28
|
+
lunar_age = LunarAge.get(western_year: western_year)
|
28
29
|
|
29
|
-
|
30
|
+
winter_solstice.sub(lunar_age)
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -28,33 +28,35 @@ module Zakuro
|
|
28
28
|
|
29
29
|
# :reek:TooManyStatements { max_statements: 7 }
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
31
|
+
class << self
|
32
|
+
#
|
33
|
+
# 対象年の天正閏余(冬至より前にある11月経朔との差 = 月齢)を算出する
|
34
|
+
# 太陽と月の運動による補正値を算出し、その補正結果を返す
|
35
|
+
#
|
36
|
+
# @param [Integer] western_year 西暦年
|
37
|
+
#
|
38
|
+
# @return [Remainder] 天正閏余
|
39
|
+
#
|
40
|
+
def get(western_year:)
|
41
|
+
# 積年の開始から対象年までの年数
|
42
|
+
total = TOTAL_YEAR + western_year - BEGIN_YEAR
|
42
43
|
|
43
|
-
|
44
|
-
|
44
|
+
# 12朔望月に対する1年の余り(単位:分)
|
45
|
+
remainder_minute = YEAR - (SYNODIC_MONTH * 12)
|
45
46
|
|
46
|
-
|
47
|
-
|
47
|
+
# 朔望月に含まれなかった余り(単位:年)
|
48
|
+
remainder_year = total % SYNODIC_MONTH
|
48
49
|
|
49
|
-
|
50
|
+
LOGGER.debug("[01]: #{remainder_year}")
|
50
51
|
|
51
|
-
|
52
|
-
|
52
|
+
# 天正閏余
|
53
|
+
lunar_age = remainder_minute * remainder_year % SYNODIC_MONTH
|
53
54
|
|
54
|
-
|
55
|
+
LOGGER.debug("[02]: #{lunar_age}")
|
55
56
|
|
56
|
-
|
57
|
-
|
57
|
+
# 大余・小余に変換する
|
58
|
+
Cycle::Remainder.new(total: lunar_age)
|
59
|
+
end
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
@@ -28,26 +28,28 @@ module Zakuro
|
|
28
28
|
|
29
29
|
# :reek:TooManyStatements { max_statements: 6 }
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
31
|
+
class << self
|
32
|
+
#
|
33
|
+
# 対象年の前年の冬至を求める
|
34
|
+
#
|
35
|
+
# @param [Integer] western_year 西暦年
|
36
|
+
#
|
37
|
+
# @return [Remainder] 前年の冬至
|
38
|
+
#
|
39
|
+
def get(western_year:)
|
40
|
+
# 積年の開始から対象年までの年数
|
41
|
+
total = TOTAL_YEAR + western_year - BEGIN_YEAR
|
42
|
+
remainder_year = total % SIXTY_DAYS
|
43
|
+
|
44
|
+
LOGGER.debug("[01]:#{remainder_year}")
|
45
|
+
|
46
|
+
# 通余を使う
|
47
|
+
winter_solstice_minute = (remainder_year * REMAINDER_ALL_YEAR) % SIXTY_DAYS
|
48
|
+
|
49
|
+
LOGGER.debug("[02]:#{winter_solstice_minute}")
|
50
|
+
|
51
|
+
Cycle::Remainder.new(total: winter_solstice_minute)
|
52
|
+
end
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
@@ -76,16 +76,18 @@ module Zakuro
|
|
76
76
|
taisetsu: Row.new(stack: -449.0, per_term: +28.4618, per_day: +0.3695) # 大雪(たいせつ)
|
77
77
|
}.freeze
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
class << self
|
80
|
+
#
|
81
|
+
# 24気損益眺朒(ちょうじく)数の行データを特定する
|
82
|
+
#
|
83
|
+
# @param [Integer] index 連番(二十四節気)
|
84
|
+
#
|
85
|
+
# @return [Row] 行データ
|
86
|
+
#
|
87
|
+
def specify(index:)
|
88
|
+
key = Cycle::SolarTerm::ORDER[index]
|
89
|
+
Adjustment::MAP[key].clone
|
90
|
+
end
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
@@ -26,7 +26,7 @@ module Zakuro
|
|
26
26
|
# @param [Integer] western_year 西暦年
|
27
27
|
#
|
28
28
|
def initialize(western_year:)
|
29
|
-
solar_term =
|
29
|
+
solar_term = self.class.first_solar_term(western_year: western_year)
|
30
30
|
super(solar_term: solar_term)
|
31
31
|
end
|
32
32
|
|
@@ -41,55 +41,57 @@ module Zakuro
|
|
41
41
|
super(annual_range: annual_range)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
44
|
+
class << self
|
45
|
+
#
|
46
|
+
# 計算開始する二十四節気を求める
|
47
|
+
#
|
48
|
+
# @param [Integer] western_year 西暦年
|
49
|
+
#
|
50
|
+
# @return [SolarTerm] 二十四節気
|
51
|
+
#
|
52
|
+
def first_solar_term(western_year:)
|
53
|
+
# 天正冬至
|
54
|
+
winter_solstice = Origin::WinterSolstice.get(western_year: western_year)
|
55
|
+
|
56
|
+
# 二十四節気(冬至)
|
57
|
+
solar_term = Cycle::SolarTerm.new(index: 0, remainder: winter_solstice)
|
58
|
+
|
59
|
+
first_solar_term_index = calc_first_solar_term_index(western_year: western_year)
|
60
|
+
|
61
|
+
# 対象の二十四節気まで戻す
|
62
|
+
solar_term.prev_by_index(first_solar_term_index)
|
63
|
+
|
64
|
+
solar_term
|
65
|
+
end
|
66
|
+
|
67
|
+
# :reek:TooManyStatements { max_statements: 6 }
|
68
|
+
|
69
|
+
#
|
70
|
+
# 計算開始する二十四節気番号を求める
|
71
|
+
#
|
72
|
+
# * 前提として入定気は冬至の手前にある
|
73
|
+
# * 例えば、定気が大雪であれば入定気は大雪の範囲内にある
|
74
|
+
# * 入定気は、定気の開始位置に重複しない限り、常に定気より後にある
|
75
|
+
# * 基本的に定気の一つ前から起算すれば、当時から求めた11月(閏10/閏11月)に二十四節気を割り当てられる
|
76
|
+
#
|
77
|
+
# @param [Integer] western_year 西暦年
|
78
|
+
#
|
79
|
+
# @return [Integer] 二十四節気番号
|
80
|
+
#
|
81
|
+
def calc_first_solar_term_index(western_year:)
|
82
|
+
# 天正閏余
|
83
|
+
lunar_age = Origin::LunarAge.get(western_year: western_year)
|
84
|
+
|
85
|
+
solar_location = Solar::Location.new(lunar_age: lunar_age)
|
86
|
+
solar_location.run
|
87
|
+
|
88
|
+
solar_term_index = solar_location.index
|
89
|
+
|
90
|
+
# 入定気の一つ後の二十四節気まで戻す(ただし11月経朔が二十四節気上にある場合は戻さない)
|
91
|
+
solar_term_index += 1 unless solar_location.remainder.day.zero?
|
92
|
+
|
93
|
+
solar_term_index
|
94
|
+
end
|
93
95
|
end
|
94
96
|
end
|
95
97
|
end
|
@@ -78,24 +78,26 @@ module Zakuro
|
|
78
78
|
MAP[:taisetsu] # 23
|
79
79
|
].freeze
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
81
|
+
class << self
|
82
|
+
#
|
83
|
+
# 入気定日加減数を引き当てる
|
84
|
+
#
|
85
|
+
# @param [Integer] index 二十四節気番号
|
86
|
+
#
|
87
|
+
# @return [Cycle::Remainder] 入気定日加減数
|
88
|
+
#
|
89
|
+
def index_of(index)
|
90
|
+
LIST[index]
|
91
|
+
end
|
91
92
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
#
|
94
|
+
# 入気定日加減数の総数を返す
|
95
|
+
#
|
96
|
+
# @return [Integer] 入気定日加減数の総数
|
97
|
+
#
|
98
|
+
def size
|
99
|
+
LIST.size
|
100
|
+
end
|
99
101
|
end
|
100
102
|
end
|
101
103
|
end
|
@@ -19,19 +19,21 @@ module Zakuro
|
|
19
19
|
# @return [Integer] 1日
|
20
20
|
DAY = Const::Number::Cycle::DAY
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
class << self
|
23
|
+
#
|
24
|
+
# 太陽の運行による補正値を算出する
|
25
|
+
#
|
26
|
+
# @param [SolarTerm] solar_location 入定気
|
27
|
+
#
|
28
|
+
# @return [Integer] 補正値
|
29
|
+
#
|
30
|
+
def get(solar_location:)
|
31
|
+
remainder = solar_location.remainder
|
31
32
|
|
32
|
-
|
33
|
+
row = Adjustment.specify(index: solar_location.index)
|
33
34
|
|
34
|
-
|
35
|
+
Calculation::Solar::ChoukeiValue.get(remainder: remainder, row: row)
|
36
|
+
end
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|