zakuro 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -12
- data/doc/operation/csv/month.csv +202 -202
- data/doc/operation/operation.xlsx +0 -0
- data/doc/operation/transfer.rb +6 -2
- data/lib/zakuro/calculation/base/multi_gengou.rb +101 -0
- data/lib/zakuro/calculation/base/multi_gengou_roller.rb +218 -0
- data/lib/zakuro/calculation/base/year.rb +107 -0
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +471 -0
- data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +173 -0
- data/lib/zakuro/calculation/cycle/zodiac.rb +106 -0
- data/lib/zakuro/calculation/monthly/first_day.rb +45 -0
- data/lib/zakuro/calculation/monthly/initialized_month.rb +125 -0
- data/lib/zakuro/calculation/monthly/month.rb +187 -0
- data/lib/zakuro/calculation/monthly/month_label.rb +88 -0
- data/lib/zakuro/calculation/monthly/operated_month.rb +209 -0
- data/lib/zakuro/calculation/range/full_range.rb +210 -0
- data/lib/zakuro/calculation/range/operated_range.rb +144 -0
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +201 -0
- data/lib/zakuro/calculation/range/transfer/western_date_allocation.rb +82 -0
- data/lib/zakuro/calculation/range/transfer/year_boundary.rb +146 -0
- data/lib/zakuro/calculation/specifier/single_day.rb +109 -0
- data/lib/zakuro/calculation/summary/single.rb +129 -0
- data/lib/zakuro/condition.rb +16 -13
- data/lib/zakuro/era/japan/gengou/parser.rb +1 -3
- data/lib/zakuro/era/japan/gengou/type.rb +3 -3
- data/lib/zakuro/era/japan/gengou/validator.rb +15 -13
- data/lib/zakuro/merchant.rb +2 -2
- data/lib/zakuro/operation/month/parser.rb +132 -36
- data/lib/zakuro/operation/month/type.rb +11 -10
- data/lib/zakuro/operation/month/validator.rb +332 -28
- data/lib/zakuro/operation/operation.rb +21 -0
- data/lib/zakuro/operation/yaml/month.yaml +1 -1
- data/lib/zakuro/output/error.rb +7 -6
- data/lib/zakuro/output/logger.rb +50 -49
- data/lib/zakuro/output/response.rb +145 -144
- data/lib/zakuro/result/operation.rb +64 -36
- data/lib/zakuro/tools/stringifier.rb +2 -2
- data/lib/zakuro/tools/typeof.rb +2 -2
- data/lib/zakuro/version.rb +1 -1
- data/lib/zakuro/version/abstract_version.rb +1 -1
- data/lib/zakuro/version/context.rb +23 -0
- data/lib/zakuro/version/senmyou/const/number.rb +51 -0
- data/lib/zakuro/version/senmyou/const/remainder.rb +43 -0
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +61 -0
- data/lib/zakuro/version/senmyou/cycle/solar_term.rb +31 -0
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +166 -181
- data/lib/zakuro/version/senmyou/range/annual_range.rb +86 -159
- data/lib/zakuro/version/senmyou/senmyou.rb +10 -4
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +237 -0
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +45 -0
- data/lib/zakuro/version/senmyou/stella/lunar/location.rb +108 -0
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +89 -0
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +34 -0
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +62 -0
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +55 -0
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +93 -0
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +175 -0
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +103 -0
- data/lib/zakuro/version/senmyou/stella/solar/location.rb +164 -0
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +138 -0
- data/lib/zakuro/version/version_class_resolver.rb +62 -0
- data/lib/zakuro/version_factory.rb +2 -2
- metadata +38 -24
- data/lib/zakuro/cycle/abstract_remainder.rb +0 -456
- data/lib/zakuro/cycle/zodiac.rb +0 -103
- data/lib/zakuro/version/senmyou/base/era.rb +0 -83
- data/lib/zakuro/version/senmyou/base/multi_gengou.rb +0 -98
- data/lib/zakuro/version/senmyou/base/multi_gengou_roller.rb +0 -217
- data/lib/zakuro/version/senmyou/base/remainder.rb +0 -60
- data/lib/zakuro/version/senmyou/base/solar_term.rb +0 -76
- data/lib/zakuro/version/senmyou/base/year.rb +0 -104
- data/lib/zakuro/version/senmyou/monthly/first_day.rb +0 -44
- data/lib/zakuro/version/senmyou/monthly/initialized_month.rb +0 -48
- data/lib/zakuro/version/senmyou/monthly/month.rb +0 -181
- data/lib/zakuro/version/senmyou/monthly/month_label.rb +0 -87
- data/lib/zakuro/version/senmyou/monthly/operated_month.rb +0 -167
- data/lib/zakuro/version/senmyou/range/full_range.rb +0 -324
- data/lib/zakuro/version/senmyou/range/operated_range.rb +0 -105
- data/lib/zakuro/version/senmyou/range/operated_solar_terms.rb +0 -163
- data/lib/zakuro/version/senmyou/specifier/single_day_specifier.rb +0 -99
- data/lib/zakuro/version/senmyou/stella/lunar_orbit.rb +0 -332
- data/lib/zakuro/version/senmyou/stella/solar_average.rb +0 -214
- data/lib/zakuro/version/senmyou/stella/solar_orbit.rb +0 -394
- data/lib/zakuro/version/senmyou/stella/winter_solstice.rb +0 -106
- data/lib/zakuro/version/senmyou/summary/single.rb +0 -71
@@ -1,184 +1,111 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../output/logger'
|
4
|
-
require_relative '../
|
5
|
-
require_relative '../
|
6
|
-
require_relative '
|
4
|
+
require_relative '../cycle/remainder'
|
5
|
+
require_relative '../cycle/solar_term'
|
6
|
+
require_relative '../../../calculation/monthly/initialized_month'
|
7
7
|
require_relative '../monthly/lunar_phase'
|
8
|
-
require_relative '../stella/
|
9
|
-
require_relative '../stella/
|
10
|
-
require_relative '../stella/
|
8
|
+
require_relative '../stella/lunar/location'
|
9
|
+
require_relative '../stella/lunar/value'
|
10
|
+
require_relative '../stella/solar/average'
|
11
|
+
require_relative '../stella/solar/location'
|
12
|
+
require_relative '../stella/solar/value'
|
13
|
+
require_relative '../stella/origin/lunar_age'
|
14
|
+
require_relative '../stella/origin/average_november'
|
11
15
|
|
12
16
|
# :nodoc:
|
13
17
|
module Zakuro
|
14
18
|
# :nodoc:
|
15
19
|
module Senmyou
|
16
|
-
#
|
17
|
-
|
18
|
-
#
|
19
|
-
module AnnualRange
|
20
|
-
# @return [Logger] ロガー
|
21
|
-
LOGGER = Logger.new(location: 'annual_range')
|
22
|
-
|
23
|
-
# :reek:TooManyStatements { max_statements: 6 }
|
24
|
-
|
25
|
-
#
|
26
|
-
# 11月定朔(冬至が含まれる月の1日:補正済)を求める
|
27
|
-
#
|
28
|
-
# @param [Integer] western_year 西暦年
|
29
|
-
#
|
30
|
-
# @return [Remainder] 11月定朔
|
31
|
-
#
|
32
|
-
def self.calc_last_november_1st(western_year:)
|
33
|
-
# 天正閏余
|
34
|
-
winter_solstice_age = \
|
35
|
-
WinterSolstice.calc_moon_age(western_year: western_year)
|
36
|
-
# 11月経朔
|
37
|
-
november_1st = \
|
38
|
-
WinterSolstice.calc_averaged_last_november_1st(western_year: western_year)
|
39
|
-
# 11月定朔
|
40
|
-
|
41
|
-
# 補正
|
42
|
-
correction_value = correction_value_on_last_november_1st(
|
43
|
-
winter_solstice_age: winter_solstice_age,
|
44
|
-
western_year: western_year
|
45
|
-
)
|
46
|
-
|
47
|
-
result = november_1st.add(Remainder.new(day: 0, minute: correction_value,
|
48
|
-
second: 0))
|
49
|
-
# 進朔
|
50
|
-
result.up_on_new_moon!
|
51
|
-
result
|
52
|
-
end
|
53
|
-
|
54
|
-
# :reek:TooManyStatements { max_statements: 6 }
|
55
|
-
|
56
|
-
#
|
57
|
-
# 一覧取得する
|
20
|
+
# :nodoc:
|
21
|
+
module Range
|
58
22
|
#
|
59
|
-
#
|
60
|
-
# * 対象年(西暦)と計算年(元号x年)の紐付けは行わない
|
23
|
+
# AnnualRange 年間範囲
|
61
24
|
#
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
def self.collect_annual_range_after_last_november_1st(western_year:)
|
67
|
-
annual_range = initialized_annual_range(western_year: western_year)
|
68
|
-
|
69
|
-
apply_big_and_small_of_the_month(annual_range: annual_range)
|
25
|
+
module AnnualRange
|
26
|
+
# @return [Output::Logger] ロガー
|
27
|
+
LOGGER = Output::Logger.new(location: 'annual_range')
|
70
28
|
|
71
|
-
|
72
|
-
annual_range: annual_range)
|
29
|
+
# :reek:TooManyStatements { max_statements: 6 }
|
73
30
|
|
74
|
-
#
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
31
|
+
#
|
32
|
+
# 一覧取得する
|
33
|
+
#
|
34
|
+
# * 対象年に対して、前年11月-当年11月までを出力する
|
35
|
+
# * 対象年(西暦)と計算年(元号x年)の紐付けは行わない
|
36
|
+
#
|
37
|
+
# @param [Context] context 暦コンテキスト
|
38
|
+
# @param [Integer] western_year 西暦年
|
39
|
+
#
|
40
|
+
# @return [Array<Month>] 1年データ
|
41
|
+
#
|
42
|
+
def self.get(context:, western_year:)
|
43
|
+
annual_range = initialized_annual_range(context: context, western_year: western_year)
|
81
44
|
|
82
|
-
|
83
|
-
# 11月定朔の補正値を求める
|
84
|
-
#
|
85
|
-
# @param [Remainder] winter_solstice_age 天正閏余
|
86
|
-
# @param [Integer] western_year 西暦年
|
87
|
-
#
|
88
|
-
# @return [Integer] 補正値
|
89
|
-
#
|
90
|
-
def self.correction_value_on_last_november_1st(winter_solstice_age:, western_year:)
|
91
|
-
# 補正
|
92
|
-
solar_term = SolarTerm.new(
|
93
|
-
remainder: winter_solstice_age
|
94
|
-
)
|
95
|
-
solar_term = \
|
96
|
-
SolarOrbit.calc_solar_term_by_remainder(
|
97
|
-
solar_term: solar_term
|
98
|
-
)
|
45
|
+
apply_big_and_small_of_the_month(annual_range: annual_range)
|
99
46
|
|
100
|
-
|
101
|
-
|
102
|
-
)
|
47
|
+
solar_average = Solar::Average.new(western_year: western_year)
|
48
|
+
solar_average.set(annual_range: annual_range)
|
103
49
|
|
104
|
-
|
105
|
-
|
106
|
-
is_forward: is_forward)
|
107
|
-
end
|
108
|
-
private_class_method :correction_value_on_last_november_1st
|
50
|
+
# 月間隔を取得するためだけの末尾要素を削除
|
51
|
+
annual_range.pop
|
109
52
|
|
110
|
-
|
111
|
-
# 1年データを取得する
|
112
|
-
#
|
113
|
-
# @param [Integer] western_year 西暦年
|
114
|
-
#
|
115
|
-
# @return [Array<Month>] 1年データ
|
116
|
-
#
|
117
|
-
def self.initialized_annual_range(western_year:)
|
118
|
-
result = []
|
119
|
-
lunar_phase = LunarPhase.new(western_year: western_year)
|
120
|
-
|
121
|
-
is_last_year = true
|
122
|
-
|
123
|
-
monthes = [11, 12] + [*1..12]
|
124
|
-
|
125
|
-
monthes.each do |month|
|
126
|
-
LOGGER.debug('---', "month: #{month}", "is_last_year: #{is_last_year}")
|
127
|
-
|
128
|
-
adjusted = lunar_phase.next_month
|
129
|
-
|
130
|
-
result.push(
|
131
|
-
InitializedMonth.new(month_label: MonthLabel.new(number: month),
|
132
|
-
first_day: FirstDay.new(remainder: adjusted),
|
133
|
-
is_last_year: is_last_year, phase_index: 0)
|
134
|
-
)
|
135
|
-
is_last_year = false if month == 12
|
53
|
+
initialize_month_label(annual_range: annual_range)
|
136
54
|
end
|
137
|
-
result
|
138
|
-
end
|
139
|
-
private_class_method :initialized_annual_range
|
140
55
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
56
|
+
#
|
57
|
+
# 1年データを取得する
|
58
|
+
#
|
59
|
+
# @param [Context] context 暦コンテキスト
|
60
|
+
# @param [Integer] western_year 西暦年
|
61
|
+
#
|
62
|
+
# @return [Array<Month>] 1年データ
|
63
|
+
#
|
64
|
+
def self.initialized_annual_range(context:, western_year:)
|
65
|
+
result = []
|
66
|
+
lunar_phase = Monthly::LunarPhase.new(western_year: western_year)
|
67
|
+
|
68
|
+
# 14ヶ月分を生成する(閏年で最大13ヶ月 + 末月の大小/二十四節気を求めるために必要な月)
|
69
|
+
(0..13).each do |_index|
|
70
|
+
adjusted = lunar_phase.next_month
|
71
|
+
|
72
|
+
result.push(
|
73
|
+
Calculation::Monthly::InitializedMonth.new(
|
74
|
+
context: context,
|
75
|
+
month_label: Calculation::Monthly::MonthLabel.new,
|
76
|
+
first_day: Calculation::Monthly::FirstDay.new(remainder: adjusted),
|
77
|
+
phase_index: 0
|
78
|
+
)
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
result
|
153
83
|
end
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
# 閏の分だけ1ヶ月ずらす
|
178
|
-
month.back_to_last_month
|
84
|
+
private_class_method :initialized_annual_range
|
85
|
+
|
86
|
+
#
|
87
|
+
# 1年データの各月に月の大小を設定する
|
88
|
+
#
|
89
|
+
# @param [Array<Month>] annual_range 1年データ
|
90
|
+
#
|
91
|
+
def self.apply_big_and_small_of_the_month(annual_range:)
|
92
|
+
# NOTE: 最後の月は処理できない(=計算外の余分な月が最後に必要である)
|
93
|
+
annual_range.each_cons(2) do |(current_month, next_month)|
|
94
|
+
current_month.eval_many_days(next_month_day: next_month.remainder.day)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
private_class_method :apply_big_and_small_of_the_month
|
98
|
+
|
99
|
+
#
|
100
|
+
# 月表示情報を更新する
|
101
|
+
#
|
102
|
+
# @param [Array<Month>] annual_range 1年データ
|
103
|
+
#
|
104
|
+
def self.initialize_month_label(annual_range:)
|
105
|
+
annual_range.each(&:rename_month_label_by_solar_term)
|
179
106
|
end
|
107
|
+
private_class_method :initialize_month_label
|
180
108
|
end
|
181
|
-
private_class_method :adjust_leap_month
|
182
109
|
end
|
183
110
|
end
|
184
111
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'date'
|
4
|
-
require_relative '../abstract_version'
|
5
4
|
require_relative '../../era/western'
|
6
|
-
require_relative '
|
5
|
+
require_relative '../abstract_version'
|
6
|
+
require_relative '../context'
|
7
|
+
require_relative '../../calculation/summary/single'
|
7
8
|
|
8
9
|
# :nodoc:
|
9
10
|
module Zakuro
|
@@ -18,16 +19,21 @@ module Zakuro
|
|
18
19
|
# @return [True] リリースあり
|
19
20
|
RELEASE = true
|
20
21
|
|
22
|
+
# @return [String] 暦クラス名
|
23
|
+
VERSION_NAME = 'Senmyou'
|
24
|
+
|
21
25
|
#
|
22
26
|
# 西暦日から和暦日に変換する
|
23
27
|
#
|
24
28
|
# @param [Date] western_date 西暦日
|
25
29
|
#
|
26
|
-
# @return [Result::
|
30
|
+
# @return [Result::Single] 和暦日
|
27
31
|
#
|
28
32
|
def self.to_japan_date(western_date:)
|
29
33
|
date = Western::Calendar.create(date: western_date)
|
30
|
-
|
34
|
+
|
35
|
+
context = Context.new(version_name: VERSION_NAME)
|
36
|
+
Calculation::Summary::Single.get(context: context, date: date)
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../const/number'
|
4
|
+
|
5
|
+
# :nodoc:
|
6
|
+
module Zakuro
|
7
|
+
# :nodoc:
|
8
|
+
module Senmyou
|
9
|
+
# :nodoc:
|
10
|
+
module Lunar
|
11
|
+
#
|
12
|
+
# Adjustment 補正値情報
|
13
|
+
#
|
14
|
+
module Adjustment
|
15
|
+
# @return [Integer] 遠/近の地点での中間
|
16
|
+
HALF_DAYS = [7].freeze
|
17
|
+
|
18
|
+
#
|
19
|
+
# Row 行情報
|
20
|
+
#
|
21
|
+
class Row
|
22
|
+
# @return [True] 進(遠地点より数える)
|
23
|
+
# @return [False] 退(近地点より数える)
|
24
|
+
attr_reader :forward
|
25
|
+
# @return [Integer] 入暦(1-14)
|
26
|
+
attr_reader :day
|
27
|
+
# @return [Range] 小余範囲
|
28
|
+
attr_reader :range
|
29
|
+
# @return [Value] 補正値
|
30
|
+
attr_reader :value
|
31
|
+
|
32
|
+
#
|
33
|
+
# 初期化
|
34
|
+
#
|
35
|
+
# @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
|
36
|
+
# @param [Integer] day 入暦(1-14)
|
37
|
+
# @param [Range] range 小余範囲
|
38
|
+
# @param [Value] value 補正値
|
39
|
+
#
|
40
|
+
def initialize(forward:, day:, range:, value:)
|
41
|
+
@forward = forward
|
42
|
+
@day = day
|
43
|
+
@range = range
|
44
|
+
@value = value
|
45
|
+
end
|
46
|
+
|
47
|
+
# :reek:ControlParameter
|
48
|
+
|
49
|
+
#
|
50
|
+
# 一致するか
|
51
|
+
#
|
52
|
+
# @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
|
53
|
+
# @param [Integer] day 入暦(1-14)
|
54
|
+
# @param [Integer] minute 小余
|
55
|
+
#
|
56
|
+
# @return [True] 一致
|
57
|
+
# @return [False] 不一致
|
58
|
+
#
|
59
|
+
def match?(forward:, day:, minute:)
|
60
|
+
return false unless @forward == forward
|
61
|
+
|
62
|
+
return false unless @day == day
|
63
|
+
|
64
|
+
return false unless @range.include?(minute: minute)
|
65
|
+
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
# 分母を返す
|
71
|
+
#
|
72
|
+
# @return [Integer] 分母
|
73
|
+
#
|
74
|
+
def denominator
|
75
|
+
@range.denominator
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Range 小余範囲
|
81
|
+
#
|
82
|
+
class Range
|
83
|
+
# @return [Integer] 下限
|
84
|
+
MIN = 0
|
85
|
+
# @return [Integer] 上限
|
86
|
+
MAX = Const::Number::Cycle::DAY
|
87
|
+
# @return [Integer] 遠/近の地点での中間
|
88
|
+
HALF = 7465
|
89
|
+
# @return [Integer] 各地点の最後
|
90
|
+
LAST = 6529
|
91
|
+
|
92
|
+
# @return [Integer] 下限
|
93
|
+
attr_reader :min
|
94
|
+
# @return [Integer] 上限
|
95
|
+
attr_reader :max
|
96
|
+
|
97
|
+
#
|
98
|
+
# 初期化
|
99
|
+
#
|
100
|
+
# @param [Integer] min 下限
|
101
|
+
# @param [Integer] max 上限
|
102
|
+
#
|
103
|
+
def initialize(min: MIN, max: MAX)
|
104
|
+
@min = min
|
105
|
+
@max = max
|
106
|
+
end
|
107
|
+
|
108
|
+
#
|
109
|
+
# 含まれるか
|
110
|
+
#
|
111
|
+
# @param [Integer] minute 小余
|
112
|
+
#
|
113
|
+
# @return [True] 含まれる
|
114
|
+
# @return [False] 含まれない
|
115
|
+
#
|
116
|
+
def include?(minute:)
|
117
|
+
minute >= @min && minute <= @max
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# 分母を返す
|
122
|
+
#
|
123
|
+
# @return [Integer] 分母
|
124
|
+
#
|
125
|
+
def denominator
|
126
|
+
@max - @min
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
#
|
131
|
+
# Value 補正値
|
132
|
+
#
|
133
|
+
class Value
|
134
|
+
# @return [Integer] 損益率
|
135
|
+
attr_reader :per
|
136
|
+
# @return [Integer] 眺朒(ちょうじく)積
|
137
|
+
attr_reader :stack
|
138
|
+
|
139
|
+
#
|
140
|
+
# 初期化
|
141
|
+
#
|
142
|
+
# @param [Integer] per 損益率
|
143
|
+
# @param [Integer] stack 眺朒(ちょうじく)積
|
144
|
+
#
|
145
|
+
def initialize(per:, stack:)
|
146
|
+
@per = per
|
147
|
+
@stack = stack
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# 文字化
|
152
|
+
#
|
153
|
+
# @return [String] 文字
|
154
|
+
#
|
155
|
+
def to_s
|
156
|
+
"per:#{@per}, stack:#{@stack}"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# rubocop:disable Layout/LineLength
|
161
|
+
|
162
|
+
#
|
163
|
+
# @return [Array<Row>] 月の補正値情報
|
164
|
+
#
|
165
|
+
LIST = [
|
166
|
+
Row.new(forward: true, day: 1, range: Range.new, value: Value.new(per: +830, stack: 0)),
|
167
|
+
Row.new(forward: true, day: 2, range: Range.new, value: Value.new(per: +726, stack: +830)),
|
168
|
+
Row.new(forward: true, day: 3, range: Range.new, value: Value.new(per: +606, stack: +1556)),
|
169
|
+
Row.new(forward: true, day: 4, range: Range.new, value: Value.new(per: +471, stack: +2162)),
|
170
|
+
Row.new(forward: true, day: 5, range: Range.new, value: Value.new(per: +337, stack: +2633)),
|
171
|
+
Row.new(forward: true, day: 6, range: Range.new, value: Value.new(per: +202, stack: +2970)),
|
172
|
+
Row.new(forward: true, day: 7, range: Range.new(max: Range::HALF), value: Value.new(per: +53, stack: +3172)),
|
173
|
+
Row.new(forward: true, day: 7, range: Range.new(min: Range::HALF), value: Value.new(per: -7, stack: +3225)), # +3172 + 53(初益)
|
174
|
+
Row.new(forward: true, day: 8, range: Range.new, value: Value.new(per: -82, stack: +3218)),
|
175
|
+
Row.new(forward: true, day: 9, range: Range.new, value: Value.new(per: -224, stack: +3136)),
|
176
|
+
Row.new(forward: true, day: 10, range: Range.new, value: Value.new(per: -366, stack: +2912)),
|
177
|
+
Row.new(forward: true, day: 11, range: Range.new, value: Value.new(per: -509, stack: +2546)),
|
178
|
+
Row.new(forward: true, day: 12, range: Range.new, value: Value.new(per: -643, stack: +2037)),
|
179
|
+
Row.new(forward: true, day: 13, range: Range.new, value: Value.new(per: -748, stack: +1394)),
|
180
|
+
Row.new(forward: true, day: 14, range: Range.new(max: Range::LAST), value: Value.new(per: -646, stack: +646)), # 14日の小余は常に6529以下
|
181
|
+
Row.new(forward: false, day: 1, range: Range.new, value: Value.new(per: -830, stack: 0)),
|
182
|
+
Row.new(forward: false, day: 2, range: Range.new, value: Value.new(per: -726, stack: -830)),
|
183
|
+
Row.new(forward: false, day: 3, range: Range.new, value: Value.new(per: -598, stack: -1556)),
|
184
|
+
Row.new(forward: false, day: 4, range: Range.new, value: Value.new(per: -464, stack: -2154)),
|
185
|
+
Row.new(forward: false, day: 5, range: Range.new, value: Value.new(per: -329, stack: -2618)),
|
186
|
+
Row.new(forward: false, day: 6, range: Range.new, value: Value.new(per: -195, stack: -2947)),
|
187
|
+
Row.new(forward: false, day: 7, range: Range.new(max: Range::HALF), value: Value.new(per: -53, stack: -3142)),
|
188
|
+
Row.new(forward: false, day: 7, range: Range.new(min: Range::HALF), value: Value.new(per: +7, stack: -3195)), # -3142 - 53(初益)
|
189
|
+
Row.new(forward: false, day: 8, range: Range.new, value: Value.new(per: +82, stack: -3188)),
|
190
|
+
Row.new(forward: false, day: 9, range: Range.new, value: Value.new(per: +225, stack: -3106)),
|
191
|
+
Row.new(forward: false, day: 10, range: Range.new, value: Value.new(per: +366, stack: -2881)),
|
192
|
+
Row.new(forward: false, day: 11, range: Range.new, value: Value.new(per: +501, stack: -2515)),
|
193
|
+
Row.new(forward: false, day: 12, range: Range.new, value: Value.new(per: +628, stack: -2014)),
|
194
|
+
Row.new(forward: false, day: 13, range: Range.new, value: Value.new(per: +740, stack: -1386)),
|
195
|
+
Row.new(forward: false, day: 14, range: Range.new(max: Range::LAST), value: Value.new(per: +646, stack: -646)) # 14日の小余は常に6529以下
|
196
|
+
].freeze
|
197
|
+
# rubocop:enable Layout/LineLength
|
198
|
+
|
199
|
+
#
|
200
|
+
# 月軌道の補正に必要な基本値を引き当てる
|
201
|
+
#
|
202
|
+
# @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
|
203
|
+
# @param [Integer] day 大余
|
204
|
+
# @param [Integer] minute 小余
|
205
|
+
#
|
206
|
+
# @return [Row] 補正値
|
207
|
+
#
|
208
|
+
def self.specify(forward:, day:, minute:)
|
209
|
+
LIST.each do |row|
|
210
|
+
# NOTE: 範囲が重複している場合、最初に引き当てたほうを優先する
|
211
|
+
return row if row.match?(forward: forward, day: day, minute: minute)
|
212
|
+
end
|
213
|
+
|
214
|
+
raise ArgumentError.new, "invalid parameter: #{forward}/#{day}/#{minute}"
|
215
|
+
end
|
216
|
+
|
217
|
+
# :reek:ControlParameter
|
218
|
+
|
219
|
+
#
|
220
|
+
# 小余の下げ幅を求める
|
221
|
+
#
|
222
|
+
# @param [Integer] day 大余
|
223
|
+
# @param [Integer] minute 小余
|
224
|
+
#
|
225
|
+
# @return [Integer] 小余の下げ幅
|
226
|
+
#
|
227
|
+
def self.minus_minute(day:, minute:)
|
228
|
+
return minute unless HALF_DAYS.include?(day)
|
229
|
+
|
230
|
+
return minute unless minute > Range::HALF
|
231
|
+
|
232
|
+
minute - Range::HALF
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|