zakuro 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +41 -8
  4. data/VERSION +1 -1
  5. data/doc/gengou.md +1 -1
  6. data/doc/operation/csv/month.csv +8 -9
  7. data/doc/operation/operation.xlsx +0 -0
  8. data/images/logo-text.png +0 -0
  9. data/lib/zakuro/calculation/base/gengou.rb +2 -4
  10. data/lib/zakuro/calculation/base/year.rb +1 -1
  11. data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +6 -0
  12. data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +2 -2
  13. data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +4 -2
  14. data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +1 -1
  15. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +13 -7
  16. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +18 -9
  17. data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +6 -2
  18. data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_range.rb +5 -2
  19. data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +3 -3
  20. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +12 -4
  21. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +10 -4
  22. data/lib/zakuro/calculation/era/gengou/named_scroll.rb +5 -2
  23. data/lib/zakuro/calculation/era/version/internal/crawler.rb +3 -3
  24. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +1 -1
  25. data/lib/zakuro/calculation/monthly/internal/date_comparer.rb +78 -0
  26. data/lib/zakuro/calculation/monthly/{meta → internal/meta}/all_solar_term.rb +1 -1
  27. data/lib/zakuro/calculation/monthly/{meta → internal/meta}/meta_collector.rb +2 -2
  28. data/lib/zakuro/calculation/monthly/{first_day.rb → internal/part/first_day.rb} +2 -2
  29. data/lib/zakuro/calculation/monthly/{meta.rb → internal/part/meta.rb} +1 -1
  30. data/lib/zakuro/calculation/monthly/internal/solar_term_selector.rb +203 -0
  31. data/lib/zakuro/calculation/monthly/month.rb +38 -74
  32. data/lib/zakuro/calculation/monthly/operated_month.rb +7 -2
  33. data/lib/zakuro/calculation/option/dropped_date/location.rb +8 -1
  34. data/lib/zakuro/calculation/range/dated_full_range.rb +6 -3
  35. data/lib/zakuro/calculation/range/dated_operation_range.rb +2 -1
  36. data/lib/zakuro/calculation/range/medieval_annual_range.rb +0 -2
  37. data/lib/zakuro/calculation/range/named_full_range.rb +1 -1
  38. data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +24 -10
  39. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +3 -3
  40. data/lib/zakuro/calculation/summary/internal/option/dropped_date.rb +102 -0
  41. data/lib/zakuro/calculation/summary/internal/option/vanished_date.rb +111 -0
  42. data/lib/zakuro/calculation/summary/internal/option.rb +4 -137
  43. data/lib/zakuro/calculation/summary/japan/range.rb +4 -5
  44. data/lib/zakuro/calculation/summary/western/range.rb +8 -1
  45. data/lib/zakuro/calculation/summary/western/single.rb +10 -5
  46. data/lib/zakuro/context/version_class_resolver.rb +5 -5
  47. data/lib/zakuro/era/japan/calendar.rb +4 -4
  48. data/lib/zakuro/era/japan/gengou/alignment/division.rb +2 -2
  49. data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +2 -2
  50. data/lib/zakuro/era/japan/gengou/alignment.rb +35 -6
  51. data/lib/zakuro/era/japan/gengou/resource/parser.rb +17 -16
  52. data/lib/zakuro/era/japan/gengou/resource/validator.rb +3 -394
  53. data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +2 -2
  54. data/lib/zakuro/era/japan/gengou.rb +8 -6
  55. data/lib/zakuro/era/japan/type/base/both/date.rb +51 -0
  56. data/lib/zakuro/era/japan/type/base/both/year.rb +53 -0
  57. data/lib/zakuro/era/japan/type/base/gengou.rb +177 -0
  58. data/lib/zakuro/era/japan/type/base/gengou_set.rb +78 -0
  59. data/lib/zakuro/era/japan/type/base/switch_date.rb +74 -0
  60. data/lib/zakuro/era/japan/type/base/version_range.rb +189 -0
  61. data/lib/zakuro/era/japan/type/validation/both/date.rb +99 -0
  62. data/lib/zakuro/era/japan/type/validation/both/year.rb +75 -0
  63. data/lib/zakuro/era/japan/type/validation/gengou.rb +93 -0
  64. data/lib/zakuro/era/japan/type/validation/gengou_set.rb +133 -0
  65. data/lib/zakuro/era/japan/type/validation/switch_date.rb +73 -0
  66. data/lib/zakuro/era/japan/type/validation/version_range.rb +109 -0
  67. data/lib/zakuro/era/japan/type/validation/version_root.rb +102 -0
  68. data/lib/zakuro/era/japan/version/resource/parser.rb +266 -0
  69. data/lib/zakuro/era/japan/version/resource/validator.rb +37 -0
  70. data/lib/zakuro/era/japan/version/resource/yaml/version.yaml +80 -0
  71. data/lib/zakuro/era/japan/version/resource.rb +22 -0
  72. data/lib/zakuro/era/japan/version.rb +4 -115
  73. data/lib/zakuro/era/western/calendar.rb +2 -2
  74. data/lib/zakuro/exception/zakuro_error.rb +1 -1
  75. data/lib/zakuro/merchant.rb +5 -5
  76. data/lib/zakuro/operation/month/parser.rb +2 -2
  77. data/lib/zakuro/operation/yaml/month.yaml +8 -40
  78. data/lib/zakuro/output/logger.rb +4 -4
  79. data/lib/zakuro/parameter/catalog/basis_date.rb +55 -0
  80. data/lib/zakuro/parameter/catalog/column.rb +57 -0
  81. data/lib/zakuro/parameter/catalog/option.rb +60 -0
  82. data/lib/zakuro/parameter/catalog/range.rb +81 -0
  83. data/lib/zakuro/parameter/condition.rb +108 -0
  84. data/lib/zakuro/result/core.rb +2 -2
  85. data/lib/zakuro/{tools → tool}/remainder_comparer.rb +3 -2
  86. data/lib/zakuro/{tools → tool}/stringifier.rb +3 -3
  87. data/lib/zakuro/{tools → tool}/typeconv.rb +2 -2
  88. data/lib/zakuro/{tools → tool}/typeof.rb +2 -2
  89. data/lib/zakuro/version/daien/const/number.rb +42 -39
  90. data/lib/zakuro/version/daien/const/remainder.rb +38 -35
  91. data/lib/zakuro/version/daien/cycle/remainder.rb +77 -74
  92. data/lib/zakuro/version/daien/cycle/solar_term.rb +18 -15
  93. data/lib/zakuro/version/daien/daien.rb +8 -5
  94. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +67 -64
  95. data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +15 -12
  96. data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +15 -12
  97. data/lib/zakuro/version/daien/range/annual_range.rb +27 -24
  98. data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +209 -206
  99. data/lib/zakuro/version/daien/stella/lunar/localization.rb +32 -29
  100. data/lib/zakuro/version/daien/stella/lunar/location.rb +53 -50
  101. data/lib/zakuro/version/daien/stella/lunar/value.rb +65 -62
  102. data/lib/zakuro/version/daien/stella/origin/average_november.rb +23 -20
  103. data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +42 -39
  104. data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +44 -41
  105. data/lib/zakuro/version/daien/stella/solar/adjustment.rb +74 -71
  106. data/lib/zakuro/version/daien/stella/solar/average.rb +68 -65
  107. data/lib/zakuro/version/daien/stella/solar/interval.rb +95 -92
  108. data/lib/zakuro/version/daien/stella/solar/location.rb +41 -38
  109. data/lib/zakuro/version/daien/stella/solar/value.rb +21 -18
  110. data/lib/zakuro/version/genka/const/number.rb +31 -28
  111. data/lib/zakuro/version/genka/const/remainder.rb +20 -17
  112. data/lib/zakuro/version/genka/cycle/remainder.rb +72 -69
  113. data/lib/zakuro/version/genka/cycle/solar_term.rb +18 -15
  114. data/lib/zakuro/version/genka/genka.rb +8 -5
  115. data/lib/zakuro/version/genka/monthly/lunar_phase.rb +82 -79
  116. data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +13 -10
  117. data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +13 -10
  118. data/lib/zakuro/version/genka/range/annual_range.rb +57 -54
  119. data/lib/zakuro/version/genka/stella/origin/first_term.rb +44 -41
  120. data/lib/zakuro/version/genka/stella/origin/january.rb +38 -35
  121. data/lib/zakuro/version/genka/stella/solar/average.rb +24 -21
  122. data/lib/zakuro/version/gihou/const/number.rb +40 -37
  123. data/lib/zakuro/version/gihou/const/remainder.rb +32 -29
  124. data/lib/zakuro/version/gihou/cycle/remainder.rb +38 -35
  125. data/lib/zakuro/version/gihou/cycle/solar_term.rb +18 -15
  126. data/lib/zakuro/version/gihou/gihou.rb +8 -5
  127. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +68 -65
  128. data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +13 -10
  129. data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +13 -10
  130. data/lib/zakuro/version/gihou/range/annual_range.rb +27 -24
  131. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +212 -209
  132. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +32 -29
  133. data/lib/zakuro/version/gihou/stella/lunar/location.rb +53 -50
  134. data/lib/zakuro/version/gihou/stella/lunar/value.rb +65 -62
  135. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +23 -20
  136. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +42 -39
  137. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +44 -41
  138. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +74 -71
  139. data/lib/zakuro/version/gihou/stella/solar/average.rb +67 -64
  140. data/lib/zakuro/version/gihou/stella/solar/interval.rb +95 -92
  141. data/lib/zakuro/version/gihou/stella/solar/location.rb +41 -38
  142. data/lib/zakuro/version/gihou/stella/solar/value.rb +21 -18
  143. data/lib/zakuro/version/gregorio/gregorio.rb +8 -5
  144. data/lib/zakuro/version/houryaku/houryaku.rb +8 -5
  145. data/lib/zakuro/version/joukyou/joukyou.rb +8 -5
  146. data/lib/zakuro/version/kansei/kansei.rb +8 -5
  147. data/lib/zakuro/version/senmyou/const/number.rb +40 -37
  148. data/lib/zakuro/version/senmyou/const/remainder.rb +35 -32
  149. data/lib/zakuro/version/senmyou/cycle/remainder.rb +74 -71
  150. data/lib/zakuro/version/senmyou/cycle/solar_term.rb +18 -15
  151. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +69 -66
  152. data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +15 -12
  153. data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +15 -12
  154. data/lib/zakuro/version/senmyou/range/annual_range.rb +27 -24
  155. data/lib/zakuro/version/senmyou/senmyou.rb +8 -5
  156. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +206 -203
  157. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +32 -29
  158. data/lib/zakuro/version/senmyou/stella/lunar/location.rb +60 -57
  159. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +66 -63
  160. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +23 -20
  161. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +42 -39
  162. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +44 -41
  163. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +74 -71
  164. data/lib/zakuro/version/senmyou/stella/solar/average.rb +67 -64
  165. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +93 -90
  166. data/lib/zakuro/version/senmyou/stella/solar/location.rb +41 -38
  167. data/lib/zakuro/version/senmyou/stella/solar/value.rb +23 -20
  168. data/lib/zakuro/version/tenpou/tenpou.rb +8 -5
  169. metadata +40 -15
  170. data/lib/zakuro/condition.rb +0 -306
  171. data/lib/zakuro/era/japan/gengou/resource/type.rb +0 -356
  172. /data/lib/zakuro/calculation/monthly/{operated_solar_term.rb → internal/operated_solar_term.rb} +0 -0
  173. /data/lib/zakuro/calculation/monthly/{const.rb → internal/part/const.rb} +0 -0
  174. /data/lib/zakuro/calculation/monthly/{month_label.rb → internal/part/month_label.rb} +0 -0
@@ -13,85 +13,88 @@ require_relative './location'
13
13
  # :nodoc:
14
14
  module Zakuro
15
15
  # :nodoc:
16
- module Daien
16
+ module Version
17
17
  # :nodoc:
18
- module Solar
19
- #
20
- # Average 平気(太陽軌道平均)
21
- #
22
- class Average < Calculation::Solar::AbstractAverage
18
+ module Daien
19
+ # :nodoc:
20
+ module Solar
23
21
  #
24
- # 初期化
22
+ # Average 平気(太陽軌道平均)
25
23
  #
26
- # @param [Integer] western_year 西暦年
27
- #
28
- def initialize(western_year:)
29
- solar_term = self.class.first_solar_term(western_year: western_year)
30
- super(solar_term: solar_term)
31
- end
32
-
33
- #
34
- # 冬至から数えた1年データの月ごとに二十四節気を割り当てる
35
- #
36
- # @param [Array<Month>] annual_range 1年データ
37
- #
38
- # @return [Array<Month>] 1年データ
39
- #
40
- def set(annual_range:)
41
- super(annual_range: annual_range)
42
- end
43
-
44
- class << self
24
+ class Average < Calculation::Solar::AbstractAverage
45
25
  #
46
- # 計算開始する二十四節気を求める
26
+ # 初期化
47
27
  #
48
28
  # @param [Integer] western_year 西暦年
49
29
  #
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
30
+ def initialize(western_year:)
31
+ solar_term = self.class.first_solar_term(western_year: western_year)
32
+ super(solar_term: solar_term)
65
33
  end
66
34
 
67
- # :reek:TooManyStatements { max_statements: 6 }
68
-
69
- #
70
- # 計算開始する二十四節気番号を求める
71
35
  #
72
- # * 前提として入定気は冬至の手前にある
73
- # * 例えば、定気が大雪であれば入定気は大雪の範囲内にある
74
- # * 入定気は、定気の開始位置に重複しない限り、常に定気より後にある
75
- # * 基本的に定気の一つ前から起算すれば、当時から求めた11月(閏10/閏11月)に二十四節気を割り当てられる
36
+ # 冬至から数えた1年データの月ごとに二十四節気を割り当てる
76
37
  #
77
- # @param [Integer] western_year 西暦年
38
+ # @param [Array<Month>] annual_range 1年データ
78
39
  #
79
- # @return [Integer] 二十四節気番号
40
+ # @return [Array<Month>] 1年データ
80
41
  #
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
- # NOTE: 789年で大余0のパターンあり
92
- solar_term_index += 1 unless solar_location.remainder.day.zero?
42
+ def set(annual_range:)
43
+ super(annual_range: annual_range)
44
+ end
93
45
 
94
- solar_term_index
46
+ class << self
47
+ #
48
+ # 計算開始する二十四節気を求める
49
+ #
50
+ # @param [Integer] western_year 西暦年
51
+ #
52
+ # @return [SolarTerm] 二十四節気
53
+ #
54
+ def first_solar_term(western_year:)
55
+ # 天正冬至
56
+ winter_solstice = Origin::WinterSolstice.get(western_year: western_year)
57
+
58
+ # 二十四節気(冬至)
59
+ solar_term = Cycle::SolarTerm.new(index: 0, remainder: winter_solstice)
60
+
61
+ first_solar_term_index = calc_first_solar_term_index(western_year: western_year)
62
+
63
+ # 対象の二十四節気まで戻す
64
+ solar_term.prev_by_index(first_solar_term_index)
65
+
66
+ solar_term
67
+ end
68
+
69
+ # :reek:TooManyStatements { max_statements: 6 }
70
+
71
+ #
72
+ # 計算開始する二十四節気番号を求める
73
+ #
74
+ # * 前提として入定気は冬至の手前にある
75
+ # * 例えば、定気が大雪であれば入定気は大雪の範囲内にある
76
+ # * 入定気は、定気の開始位置に重複しない限り、常に定気より後にある
77
+ # * 基本的に定気の一つ前から起算すれば、当時から求めた11月(閏10/閏11月)に二十四節気を割り当てられる
78
+ #
79
+ # @param [Integer] western_year 西暦年
80
+ #
81
+ # @return [Integer] 二十四節気番号
82
+ #
83
+ def calc_first_solar_term_index(western_year:)
84
+ # 天正閏余
85
+ lunar_age = Origin::LunarAge.get(western_year: western_year)
86
+
87
+ solar_location = Solar::Location.new(lunar_age: lunar_age)
88
+ solar_location.run
89
+
90
+ solar_term_index = solar_location.index
91
+
92
+ # 入定気の一つ後の二十四節気まで戻す(ただし11月経朔が二十四節気上にある場合は戻さない)
93
+ # NOTE: 789年で大余0のパターンあり
94
+ solar_term_index += 1 unless solar_location.remainder.day.zero?
95
+
96
+ solar_term_index
97
+ end
95
98
  end
96
99
  end
97
100
  end
@@ -3,105 +3,108 @@
3
3
  # :nodoc:
4
4
  module Zakuro
5
5
  # :nodoc:
6
- module Daien
6
+ module Version
7
7
  # :nodoc:
8
- module Solar
9
- #
10
- # Interval 入気定日加減数(二十四節気の間隔)
11
- #
12
- module Interval
8
+ module Daien
9
+ # :nodoc:
10
+ module Solar
13
11
  #
14
- # 気策の 15-664.7 を加減する
12
+ # Interval 入気定日加減数(二十四節気の間隔)
15
13
  #
16
- # @note 『歴代天文律暦等志彙編 七』中華書房 p.2224 盈縮分の行で加減した
17
- #
18
- # @return [Hash<Symbol, Cycle::Remainder>] 一覧
19
- MAP = {
20
- # 冬至(とうじ)・大雪(たいせつ)
21
- touji: Cycle::Remainder.new(day: 14, minute: 1351, second: 7), # -2353
22
- taisetsu: Cycle::Remainder.new(day: 14, minute: 1351, second: 7),
23
- # 小寒(しょうかん)・小雪(しょうせつ)
24
- shoukan: Cycle::Remainder.new(day: 14, minute: 1859, second: 7), # -1845
25
- shousetsu: Cycle::Remainder.new(day: 14, minute: 1859, second: 7),
26
- # 大寒(だいかん)・立冬(りっとう)
27
- daikan: Cycle::Remainder.new(day: 14, minute: 2314, second: 7), # -1390
28
- rittou: Cycle::Remainder.new(day: 14, minute: 2314, second: 7),
29
- # 立春(りっしゅん)・霜降(そうこう)
30
- risshun: Cycle::Remainder.new(day: 14, minute: 2728, second: 7), # -976
31
- soukou: Cycle::Remainder.new(day: 14, minute: 2728, second: 7),
32
- # 雨水(うすい)・寒露(かんろ)
33
- usui: Cycle::Remainder.new(day: 15, minute: 76, second: 7), # -588
34
- kanro: Cycle::Remainder.new(day: 15, minute: 76, second: 7),
35
- # 啓蟄(けいちつ)・秋分(しゅうぶん)
36
- keichitsu: Cycle::Remainder.new(day: 15, minute: 450, second: 7), # -214
37
- shuubun: Cycle::Remainder.new(day: 15, minute: 450, second: 7),
38
- # 春分(しゅんぶん)・白露(はくろ)
39
- shunbun: Cycle::Remainder.new(day: 15, minute: 878, second: 7), # +214
40
- hakuro: Cycle::Remainder.new(day: 15, minute: 878, second: 7),
41
- # 清明(せいめい)・処暑(しょしょ)
42
- seimei: Cycle::Remainder.new(day: 15, minute: 1252, second: 7), # +588
43
- shosho: Cycle::Remainder.new(day: 15, minute: 1252, second: 7),
44
- # 穀雨(こくう)・立秋(りっしゅう)
45
- kokuu: Cycle::Remainder.new(day: 15, minute: 1640, second: 7), # +976
46
- risshuu: Cycle::Remainder.new(day: 15, minute: 1640, second: 7),
47
- # 立夏(りっか)・大暑(たいしょ)
48
- rikka: Cycle::Remainder.new(day: 15, minute: 2054, second: 7), # +1390
49
- taisho: Cycle::Remainder.new(day: 15, minute: 2054, second: 7),
50
- # 小満(しょうまん)・小暑(しょうしょ)
51
- shouman: Cycle::Remainder.new(day: 15, minute: 2509, second: 7), # +1845
52
- shousho: Cycle::Remainder.new(day: 15, minute: 2509, second: 7),
53
- # 芒種(ぼうしゅ)・夏至(げし)
54
- boushu: Cycle::Remainder.new(day: 15, minute: 3017, second: 7), # +2353
55
- geshi: Cycle::Remainder.new(day: 15, minute: 3017, second: 7)
56
- }.freeze
57
-
58
- # @return [Array<Remainder>] 索引
59
- LIST = [
60
- MAP[:touji], # 0
61
- MAP[:shoukan], # 1
62
- MAP[:daikan], # 2
63
- MAP[:risshun], # 3
64
- MAP[:usui], # 4
65
- MAP[:keichitsu], # 5
66
- MAP[:shunbun], # 6
67
- MAP[:seimei], # 7
68
- MAP[:kokuu], # 8
69
- MAP[:rikka], # 9
70
- MAP[:shouman], # 10
71
- MAP[:boushu], # 11
72
- MAP[:geshi], # 12
73
- MAP[:shousho], # 13
74
- MAP[:taisho], # 14
75
- MAP[:risshuu], # 15
76
- MAP[:shosho], # 16
77
- MAP[:hakuro], # 17
78
- MAP[:shuubun], # 18
79
- MAP[:kanro], # 19
80
- MAP[:soukou], # 20
81
- MAP[:rittou], # 21
82
- MAP[:shousetsu], # 22
83
- MAP[:taisetsu] # 23
84
- ].freeze
85
-
86
- class << self
14
+ module Interval
87
15
  #
88
- # 入気定日加減数を引き当てる
16
+ # 気策の 15-664.7 を加減する
89
17
  #
90
- # @param [Integer] index 二十四節気番号
18
+ # @note 『歴代天文律暦等志彙編 七』中華書房 p.2224 盈縮分の行で加減した
91
19
  #
92
- # @return [Cycle::Remainder] 入気定日加減数
93
- #
94
- def index_of(index)
95
- LIST[index]
96
- end
20
+ # @return [Hash<Symbol, Cycle::Remainder>] 一覧
21
+ MAP = {
22
+ # 冬至(とうじ)・大雪(たいせつ)
23
+ touji: Cycle::Remainder.new(day: 14, minute: 1351, second: 7), # -2353
24
+ taisetsu: Cycle::Remainder.new(day: 14, minute: 1351, second: 7),
25
+ # 小寒(しょうかん)・小雪(しょうせつ)
26
+ shoukan: Cycle::Remainder.new(day: 14, minute: 1859, second: 7), # -1845
27
+ shousetsu: Cycle::Remainder.new(day: 14, minute: 1859, second: 7),
28
+ # 大寒(だいかん)・立冬(りっとう)
29
+ daikan: Cycle::Remainder.new(day: 14, minute: 2314, second: 7), # -1390
30
+ rittou: Cycle::Remainder.new(day: 14, minute: 2314, second: 7),
31
+ # 立春(りっしゅん)・霜降(そうこう)
32
+ risshun: Cycle::Remainder.new(day: 14, minute: 2728, second: 7), # -976
33
+ soukou: Cycle::Remainder.new(day: 14, minute: 2728, second: 7),
34
+ # 雨水(うすい)・寒露(かんろ)
35
+ usui: Cycle::Remainder.new(day: 15, minute: 76, second: 7), # -588
36
+ kanro: Cycle::Remainder.new(day: 15, minute: 76, second: 7),
37
+ # 啓蟄(けいちつ)・秋分(しゅうぶん)
38
+ keichitsu: Cycle::Remainder.new(day: 15, minute: 450, second: 7), # -214
39
+ shuubun: Cycle::Remainder.new(day: 15, minute: 450, second: 7),
40
+ # 春分(しゅんぶん)・白露(はくろ)
41
+ shunbun: Cycle::Remainder.new(day: 15, minute: 878, second: 7), # +214
42
+ hakuro: Cycle::Remainder.new(day: 15, minute: 878, second: 7),
43
+ # 清明(せいめい)・処暑(しょしょ)
44
+ seimei: Cycle::Remainder.new(day: 15, minute: 1252, second: 7), # +588
45
+ shosho: Cycle::Remainder.new(day: 15, minute: 1252, second: 7),
46
+ # 穀雨(こくう)・立秋(りっしゅう)
47
+ kokuu: Cycle::Remainder.new(day: 15, minute: 1640, second: 7), # +976
48
+ risshuu: Cycle::Remainder.new(day: 15, minute: 1640, second: 7),
49
+ # 立夏(りっか)・大暑(たいしょ)
50
+ rikka: Cycle::Remainder.new(day: 15, minute: 2054, second: 7), # +1390
51
+ taisho: Cycle::Remainder.new(day: 15, minute: 2054, second: 7),
52
+ # 小満(しょうまん)・小暑(しょうしょ)
53
+ shouman: Cycle::Remainder.new(day: 15, minute: 2509, second: 7), # +1845
54
+ shousho: Cycle::Remainder.new(day: 15, minute: 2509, second: 7),
55
+ # 芒種(ぼうしゅ)・夏至(げし)
56
+ boushu: Cycle::Remainder.new(day: 15, minute: 3017, second: 7), # +2353
57
+ geshi: Cycle::Remainder.new(day: 15, minute: 3017, second: 7)
58
+ }.freeze
97
59
 
98
- #
99
- # 入気定日加減数の総数を返す
100
- #
101
- # @return [Integer] 入気定日加減数の総数
102
- #
103
- def size
104
- LIST.size
60
+ # @return [Array<Remainder>] 索引
61
+ LIST = [
62
+ MAP[:touji], # 0
63
+ MAP[:shoukan], # 1
64
+ MAP[:daikan], # 2
65
+ MAP[:risshun], # 3
66
+ MAP[:usui], # 4
67
+ MAP[:keichitsu], # 5
68
+ MAP[:shunbun], # 6
69
+ MAP[:seimei], # 7
70
+ MAP[:kokuu], # 8
71
+ MAP[:rikka], # 9
72
+ MAP[:shouman], # 10
73
+ MAP[:boushu], # 11
74
+ MAP[:geshi], # 12
75
+ MAP[:shousho], # 13
76
+ MAP[:taisho], # 14
77
+ MAP[:risshuu], # 15
78
+ MAP[:shosho], # 16
79
+ MAP[:hakuro], # 17
80
+ MAP[:shuubun], # 18
81
+ MAP[:kanro], # 19
82
+ MAP[:soukou], # 20
83
+ MAP[:rittou], # 21
84
+ MAP[:shousetsu], # 22
85
+ MAP[:taisetsu] # 23
86
+ ].freeze
87
+
88
+ class << self
89
+ #
90
+ # 入気定日加減数を引き当てる
91
+ #
92
+ # @param [Integer] index 二十四節気番号
93
+ #
94
+ # @return [Cycle::Remainder] 入気定日加減数
95
+ #
96
+ def index_of(index)
97
+ LIST[index]
98
+ end
99
+
100
+ #
101
+ # 入気定日加減数の総数を返す
102
+ #
103
+ # @return [Integer] 入気定日加減数の総数
104
+ #
105
+ def size
106
+ LIST.size
107
+ end
105
108
  end
106
109
  end
107
110
  end
@@ -9,51 +9,54 @@ require_relative './interval'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Daien
12
+ module Version
13
13
  # :nodoc:
14
- module Solar
15
- #
16
- # Location 入定気
17
- #
18
- class Location < Calculation::Solar::AbstractLocation
19
- # @return [Cycle::Remainder] 弦
20
- QUARTER = Const::Remainder::Solar::QUARTER
21
-
22
- #
23
- # 初期化
14
+ module Daien
15
+ # :nodoc:
16
+ module Solar
24
17
  #
25
- # @param [Cycle::Remainder] lunar_age 天正閏余(大余小余)
18
+ # Location 入定気
26
19
  #
27
- def initialize(lunar_age:)
28
- super(lunar_age: lunar_age, quarter: QUARTER)
29
- end
20
+ class Location < Calculation::Solar::AbstractLocation
21
+ # @return [Cycle::Remainder]
22
+ QUARTER = Const::Remainder::Solar::QUARTER
30
23
 
31
- # :reek:UtilityFunction
24
+ #
25
+ # 初期化
26
+ #
27
+ # @param [Cycle::Remainder] lunar_age 天正閏余(大余小余)
28
+ #
29
+ def initialize(lunar_age:)
30
+ super(lunar_age: lunar_age, quarter: QUARTER)
31
+ end
32
32
 
33
- #
34
- # 二十四節気番号に対応する入気定日加減数を返す
35
- #
36
- # @note 継承のためクラスメソッドにしない
37
- #
38
- # @param [Integer] index 二十四節気番号
39
- #
40
- # @return [Cycle::Remainder] 入気定日加減数
41
- #
42
- def interval(index:)
43
- Interval.index_of(index)
44
- end
33
+ # :reek:UtilityFunction
45
34
 
46
- # :reek:UtilityFunction
35
+ #
36
+ # 二十四節気番号に対応する入気定日加減数を返す
37
+ #
38
+ # @note 継承のためクラスメソッドにしない
39
+ #
40
+ # @param [Integer] index 二十四節気番号
41
+ #
42
+ # @return [Cycle::Remainder] 入気定日加減数
43
+ #
44
+ def interval(index:)
45
+ Interval.index_of(index)
46
+ end
47
47
 
48
- #
49
- # 入気定日加減数の要素数を返す
50
- #
51
- # @note 継承のためクラスメソッドにしない
52
- #
53
- # @return [Integer] 入気定日加減数の要素数
54
- #
55
- def interval_size
56
- Interval.size
48
+ # :reek:UtilityFunction
49
+
50
+ #
51
+ # 入気定日加減数の要素数を返す
52
+ #
53
+ # @note 継承のためクラスメソッドにしない
54
+ #
55
+ # @return [Integer] 入気定日加減数の要素数
56
+ #
57
+ def interval_size
58
+ Interval.size
59
+ end
57
60
  end
58
61
  end
59
62
  end
@@ -9,27 +9,30 @@ require_relative './adjustment'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Daien
12
+ module Version
13
13
  # :nodoc:
14
- module Solar
15
- #
16
- # Value 太陽補正値
17
- #
18
- module Value
19
- class << self
20
- #
21
- # 太陽の運行による補正値を算出する
22
- #
23
- # @param [SolarTerm] solar_location 入定気
24
- #
25
- # @return [Integer] 補正値
26
- #
27
- def get(solar_location:)
28
- remainder = solar_location.remainder
14
+ module Daien
15
+ # :nodoc:
16
+ module Solar
17
+ #
18
+ # Value 太陽補正値
19
+ #
20
+ module Value
21
+ class << self
22
+ #
23
+ # 太陽の運行による補正値を算出する
24
+ #
25
+ # @param [SolarTerm] solar_location 入定気
26
+ #
27
+ # @return [Integer] 補正値
28
+ #
29
+ def get(solar_location:)
30
+ remainder = solar_location.remainder
29
31
 
30
- row = Adjustment.specify(index: solar_location.index)
32
+ row = Adjustment.specify(index: solar_location.index)
31
33
 
32
- Calculation::Solar::ChoukeiValue.get(remainder: remainder, row: row)
34
+ Calculation::Solar::ChoukeiValue.get(remainder: remainder, row: row)
35
+ end
33
36
  end
34
37
  end
35
38
  end
@@ -3,39 +3,42 @@
3
3
  # :nodoc:
4
4
  module Zakuro
5
5
  # :nodoc:
6
- module Genka
7
- #
8
- # Const 定数
9
- #
10
- module Const
6
+ module Version
7
+ # :nodoc:
8
+ module Genka
11
9
  #
12
- # Number 数値
10
+ # Const 定数
13
11
  #
14
- module Number
12
+ module Const
15
13
  #
16
- # Cycle 周期
14
+ # Number 数値
17
15
  #
18
- module Cycle
19
- # @return [Integer] 日法(1日=752分)
20
- DAY = 752
21
- # @return [Integer] 度法(1日=304分)
22
- TERM_DAY = 304
23
- # @return [Integer] 朔望月
24
- SYNODIC_MONTH = 22_207
25
- end
16
+ module Number
17
+ #
18
+ # Cycle 周期
19
+ #
20
+ module Cycle
21
+ # @return [Integer] 日法(1日=752分)
22
+ DAY = 752
23
+ # @return [Integer] 度法(1日=304分)
24
+ TERM_DAY = 304
25
+ # @return [Integer] 朔望月
26
+ SYNODIC_MONTH = 22_207
27
+ end
26
28
 
27
- #
28
- # 累積
29
- #
30
- module Stack
31
- # @return [Integer] 積年(甲子夜半朔旦冬至〜暦の開始前)
32
- TOTAL_YEAR = 5703
33
- # @return [Integer] 暦の開始年(元嘉20年)
34
- BEGIN_YEAR = 443
35
- # @return [Integer] 西暦0年の積年
36
- WESTERN_YEAR = 1612
37
- # @return [Integer] 余数
38
- YEAR_REMAINDER = 1595
29
+ #
30
+ # 累積
31
+ #
32
+ module Stack
33
+ # @return [Integer] 積年(甲子夜半朔旦冬至〜暦の開始前)
34
+ TOTAL_YEAR = 5703
35
+ # @return [Integer] 暦の開始年(元嘉20年)
36
+ BEGIN_YEAR = 443
37
+ # @return [Integer] 西暦0年の積年
38
+ WESTERN_YEAR = 1612
39
+ # @return [Integer] 余数
40
+ YEAR_REMAINDER = 1595
41
+ end
39
42
  end
40
43
  end
41
44
  end
@@ -5,28 +5,31 @@ require_relative '../cycle/remainder'
5
5
  # :nodoc:
6
6
  module Zakuro
7
7
  # :nodoc:
8
- module Genka
9
- #
10
- # Const 定数
11
- #
12
- module Const
8
+ module Version
9
+ # :nodoc:
10
+ module Genka
13
11
  #
14
- # Remainder 大余小余
12
+ # Const 定数
15
13
  #
16
- module Remainder
14
+ module Const
17
15
  #
18
- # @note 『歴代天文律暦等志彙編 六』中華書房 p.1727
19
- # 「推弦望法..加朔大餘七,小餘二百八十七,小分三,小分満四從小餘」
16
+ # Remainder 大余小余
20
17
  #
21
- # @return [Cycle::Remainder] 弦(1分=4秒)
22
- QUARTER = Cycle::Remainder.new(day: 7, minute: 287, second: 3)
18
+ module Remainder
19
+ #
20
+ # @note 『歴代天文律暦等志彙編 六』中華書房 p.1727
21
+ # 「推弦望法..加朔大餘七,小餘二百八十七,小分三,小分満四從小餘」
22
+ #
23
+ # @return [Cycle::Remainder] 弦(1分=4秒)
24
+ QUARTER = Cycle::Remainder.new(day: 7, minute: 287, second: 3)
23
25
 
24
- #
25
- # @note 『歴代天文律暦等志彙編 六』中華書房 p.1727
26
- # 「推二十四氣術」「求次氣,加朔大餘十五,小餘六十六,小分十一,小分満氣法從小餘,小餘満度法從大餘」
27
- #
28
- # @return [Cycle::Remainder] 気策(24分の1年)
29
- SOLAR_TERM_AVERAGE = Cycle::TermRemainder.new(day: 15, minute: 66 + 11.0 / 24, second: 0)
26
+ #
27
+ # @note 『歴代天文律暦等志彙編 六』中華書房 p.1727
28
+ # 「推二十四氣術」「求次氣,加朔大餘十五,小餘六十六,小分十一,小分満氣法從小餘,小餘満度法從大餘」
29
+ #
30
+ # @return [Cycle::Remainder] 気策(24分の1年)
31
+ SOLAR_TERM_AVERAGE = Cycle::TermRemainder.new(day: 15, minute: 66 + 11.0 / 24, second: 0)
32
+ end
30
33
  end
31
34
  end
32
35
  end