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
@@ -5,52 +5,55 @@ require_relative '../cycle/remainder'
5
5
  # :nodoc:
6
6
  module Zakuro
7
7
  # :nodoc:
8
- module Daien
9
- #
10
- # Const 定数
11
- #
12
- module Const
8
+ module Version
9
+ # :nodoc:
10
+ module Daien
13
11
  #
14
- # Remainder 大余小余
12
+ # Const 定数
15
13
  #
16
- module Remainder
14
+ module Const
17
15
  #
18
- # Solar 太陽
16
+ # Remainder 大余小余
19
17
  #
20
- module Solar
21
- # @return [Remainder] 気策(24分の1年)
22
- # 1年(1_110_343) / 24 / 1日(3040)= 15 余り 664.2916666666642
23
- # * 0.2916666666642 * 24(1分=24秒) = 6.999999999940799 ≒ 7
24
- SOLAR_TERM_AVERAGE = Cycle::Remainder.new(day: 15, minute: 664, second: 7)
18
+ module Remainder
25
19
  #
26
- # @note 揲法 89773 = 29-1613
27
- # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
28
- # * 0.25 * 24(1分=24秒) = 6
20
+ # Solar 太陽
29
21
  #
30
- # @return [Cycle::Remainder] 弦(1分=80秒)
31
- QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
22
+ module Solar
23
+ # @return [Remainder] 気策(24分の1年)
24
+ # 1年(1_110_343) / 24 / 1日(3040)= 15 余り 664.2916666666642
25
+ # * 0.2916666666642 * 24(1分=24秒) = 6.999999999940799 ≒ 7
26
+ SOLAR_TERM_AVERAGE = Cycle::Remainder.new(day: 15, minute: 664, second: 7)
27
+ #
28
+ # @note 揲法 89773 = 29-1613
29
+ # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
30
+ # * 0.25 * 24(1分=24秒) = 6
31
+ #
32
+ # @return [Cycle::Remainder] 弦(1分=80秒)
33
+ QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
32
34
 
33
- # @return [Cycle::Remainder] 有没判定
34
- DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 2375, second: 17)
35
+ # @return [Cycle::Remainder] 有没判定
36
+ DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 2375, second: 17)
35
37
 
36
- # @return [Cycle::Remainder] 有滅判定
37
- VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 1427, second: 0)
38
- end
38
+ # @return [Cycle::Remainder] 有滅判定
39
+ VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 1427, second: 0)
40
+ end
39
41
 
40
- #
41
- # Lunar 月
42
- #
43
- module Lunar
44
- # @return [Cycle::LunarRemainder] 転日(1近点月)
45
- ANOMALISTIC_MONTH = \
46
- Cycle::LunarRemainder.new(day: 27, minute: 1685, second: 79)
47
42
  #
48
- # @note 揲法 89773 = 29-1613
49
- # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
50
- # * 0.25 * 80(1分=80秒) = 20
43
+ # Lunar
51
44
  #
52
- # @return [Cycle::LunarRemainder] 弦(1分=80秒)
53
- QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20)
45
+ module Lunar
46
+ # @return [Cycle::LunarRemainder] 転日(1近点月)
47
+ ANOMALISTIC_MONTH = \
48
+ Cycle::LunarRemainder.new(day: 27, minute: 1685, second: 79)
49
+ #
50
+ # @note 揲法 89773 = 29-1613
51
+ # * 89773 / 4 = 22443.25 / 3040 = 7 余り 1163.25
52
+ # * 0.25 * 80(1分=80秒) = 20
53
+ #
54
+ # @return [Cycle::LunarRemainder] 弦(1分=80秒)
55
+ QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20)
56
+ end
54
57
  end
55
58
  end
56
59
  end
@@ -7,95 +7,98 @@ require_relative '../const/number'
7
7
  # :nodoc:
8
8
  module Zakuro
9
9
  # :nodoc:
10
- module Daien
10
+ module Version
11
11
  # :nodoc:
12
- module Cycle
13
- #
14
- # Remainder 時刻情報(大余小余)
15
- #
16
- class Remainder < Calculation::Cycle::AbstractRemainder
17
- # 『歴代天文律暦等志彙編 七』中華書房 p.2056
18
- # 「象統;二十四」「其秒盈象統,従小餘」
19
- # 上記は舊唐志の記述だが、新唐志(p.2218)でも同様であることを確認した
20
- # @return [Integer] 分(1分=24秒)
21
- MINUTE = 24
22
-
23
- #
24
- # 初期化
12
+ module Daien
13
+ # :nodoc:
14
+ module Cycle
25
15
  #
26
- # @param [Integer] day 大余("日"に相当)
27
- # @param [Integer] minute 小余("分"に相当)
28
- # @param [Integer] second 秒
29
- # @param [Integer] total 繰り上げなしの小余
16
+ # Remainder 時刻情報(大余小余)
30
17
  #
31
- def initialize(day: -1, minute: -1, second: -1, total: -1)
32
- super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
33
- day: day, minute: minute, second: second, total: total)
34
- end
35
- end
18
+ class Remainder < Calculation::Cycle::AbstractRemainder
19
+ # 『歴代天文律暦等志彙編 七』中華書房 p.2056
20
+ # 「象統;二十四」「其秒盈象統,従小餘」
21
+ # 上記は舊唐志の記述だが、新唐志(p.2218)でも同様であることを確認した
22
+ # @return [Integer] 分(1分=24秒)
23
+ MINUTE = 24
36
24
 
37
- #
38
- # LunarRemainder 月の位相計算向け時刻情報(大余小余)
39
- #
40
- class LunarRemainder < Calculation::Cycle::AbstractRemainder
41
- # @return [Integer] 分(1分=80秒)
42
- MINUTE = 80
25
+ #
26
+ # 初期化
27
+ #
28
+ # @param [Integer] day 大余("日"に相当)
29
+ # @param [Integer] minute 小余("分"に相当)
30
+ # @param [Integer] second 秒
31
+ # @param [Integer] total 繰り上げなしの小余
32
+ #
33
+ def initialize(day: -1, minute: -1, second: -1, total: -1)
34
+ super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
35
+ day: day, minute: minute, second: second, total: total)
36
+ end
37
+ end
43
38
 
44
39
  #
45
- # 初期化
46
- #
47
- # @param [Integer] day 大余("日"に相当)
48
- # @param [Integer] minute 小余("分"に相当)
49
- # @param [Integer] second 秒
50
- # @param [Integer] total 繰り上げなしの小余
40
+ # LunarRemainder 月の位相計算向け時刻情報(大余小余)
51
41
  #
52
- def initialize(day: -1, minute: -1, second: -1, total: -1)
53
- super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
54
- day: day, minute: minute, second: second, total: total)
55
- end
56
- end
42
+ class LunarRemainder < Calculation::Cycle::AbstractRemainder
43
+ # @return [Integer] 分(1分=80秒)
44
+ MINUTE = 80
57
45
 
58
- #
59
- # DroppedRemainder 没日の計算向け時刻情報(没余)
60
- #
61
- class DroppedRemainder < Calculation::Cycle::AbstractRemainder
62
- # @return [Integer] 分(1分=24秒)
63
- MINUTE = 24
46
+ #
47
+ # 初期化
48
+ #
49
+ # @param [Integer] day 大余("日"に相当)
50
+ # @param [Integer] minute 小余("分"に相当)
51
+ # @param [Integer] second 秒
52
+ # @param [Integer] total 繰り上げなしの小余
53
+ #
54
+ def initialize(day: -1, minute: -1, second: -1, total: -1)
55
+ super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
56
+ day: day, minute: minute, second: second, total: total)
57
+ end
58
+ end
64
59
 
65
60
  #
66
- # 初期化
67
- #
68
- # @param [Integer] day 大余("日"に相当)
69
- # @param [Integer] minute 小余("分"に相当)
70
- # @param [Integer] second 秒
71
- # @param [Integer] total 繰り上げなしの小余
61
+ # DroppedRemainder 没日の計算向け時刻情報(没余)
72
62
  #
73
- def initialize(day: -1, minute: -1, second: -1, total: -1)
74
- # 小余 = 通余
75
- super(base_day: Const::Number::Derivation::REMAINDER_ALL_YEAR, base_minute: MINUTE,
76
- day: day, minute: minute, second: second, total: total)
77
- end
78
- end
63
+ class DroppedRemainder < Calculation::Cycle::AbstractRemainder
64
+ # @return [Integer] 分(1分=24秒)
65
+ MINUTE = 24
79
66
 
80
- #
81
- # VanishedRemainder 滅日の計算向け時刻情報(滅余)
82
- #
83
- class VanishedRemainder < Calculation::Cycle::AbstractRemainder
84
- # @return [Integer] 分(1分=24秒)
85
- MINUTE = 24
67
+ #
68
+ # 初期化
69
+ #
70
+ # @param [Integer] day 大余("日"に相当)
71
+ # @param [Integer] minute 小余("分"に相当)
72
+ # @param [Integer] second 秒
73
+ # @param [Integer] total 繰り上げなしの小余
74
+ #
75
+ def initialize(day: -1, minute: -1, second: -1, total: -1)
76
+ # 小余 = 通余
77
+ super(base_day: Const::Number::Derivation::REMAINDER_ALL_YEAR, base_minute: MINUTE,
78
+ day: day, minute: minute, second: second, total: total)
79
+ end
80
+ end
86
81
 
87
82
  #
88
- # 初期化
89
- #
90
- # @param [Integer] day 大余("日"に相当)
91
- # @param [Integer] minute 小余("分"に相当)
92
- # @param [Integer] second 秒
93
- # @param [Integer] total 繰り上げなしの小余
83
+ # VanishedRemainder 滅日の計算向け時刻情報(滅余)
94
84
  #
95
- def initialize(day: -1, minute: -1, second: -1, total: -1)
96
- # 小余 = 朔虚分
97
- super(base_day: Const::Number::Derivation::REMAINDER_IDEAL_MONTH, base_minute: MINUTE,
98
- day: day, minute: minute, second: second, total: total)
85
+ class VanishedRemainder < Calculation::Cycle::AbstractRemainder
86
+ # @return [Integer] 分(1分=24秒)
87
+ MINUTE = 24
88
+
89
+ #
90
+ # 初期化
91
+ #
92
+ # @param [Integer] day 大余("日"に相当)
93
+ # @param [Integer] minute 小余("分"に相当)
94
+ # @param [Integer] second 秒
95
+ # @param [Integer] total 繰り上げなしの小余
96
+ #
97
+ def initialize(day: -1, minute: -1, second: -1, total: -1)
98
+ # 小余 = 朔虚分
99
+ super(base_day: Const::Number::Derivation::REMAINDER_IDEAL_MONTH, base_minute: MINUTE,
100
+ day: day, minute: minute, second: second, total: total)
101
+ end
99
102
  end
100
103
  end
101
104
  end
@@ -9,24 +9,27 @@ require_relative './remainder'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Daien
12
+ module Version
13
13
  # :nodoc:
14
- module Cycle
15
- #
16
- # SolarTerm 二十四節気
17
- #
18
- class SolarTerm < Calculation::Cycle::AbstractSolarTerm
19
- # @return [Remainder] 気策(24分の1年)
20
- SOLAR_TERM_AVERAGE = Const::Remainder::Solar::SOLAR_TERM_AVERAGE
21
-
22
- #
23
- # 初期化
14
+ module Daien
15
+ # :nodoc:
16
+ module Cycle
24
17
  #
25
- # @param [Integer] index 連番
26
- # @param [Remainder] remainder 時刻情報(大余小余)
18
+ # SolarTerm 二十四節気
27
19
  #
28
- def initialize(index: -1, remainder: Remainder.new)
29
- super(index: index, remainder: remainder, average: SOLAR_TERM_AVERAGE)
20
+ class SolarTerm < Calculation::Cycle::AbstractSolarTerm
21
+ # @return [Remainder] 気策(24分の1年)
22
+ SOLAR_TERM_AVERAGE = Const::Remainder::Solar::SOLAR_TERM_AVERAGE
23
+
24
+ #
25
+ # 初期化
26
+ #
27
+ # @param [Integer] index 連番
28
+ # @param [Remainder] remainder 時刻情報(大余小余)
29
+ #
30
+ def initialize(index: -1, remainder: Remainder.new)
31
+ super(index: index, remainder: remainder, average: SOLAR_TERM_AVERAGE)
32
+ end
30
33
  end
31
34
  end
32
35
  end
@@ -2,10 +2,13 @@
2
2
 
3
3
  # :nodoc:
4
4
  module Zakuro
5
- #
6
- # Daien 大衍暦
7
- #
8
- module Daien
9
- # none
5
+ # :nodoc:
6
+ module Version
7
+ #
8
+ # Daien 大衍暦
9
+ #
10
+ module Daien
11
+ # none
12
+ end
10
13
  end
11
14
  end
@@ -15,86 +15,89 @@ require_relative '../stella/origin/average_november'
15
15
  # :nodoc:
16
16
  module Zakuro
17
17
  # :nodoc:
18
- module Daien
18
+ module Version
19
19
  # :nodoc:
20
- module Monthly
21
- #
22
- # LunarPhase 月の位相
23
- #
24
- class LunarPhase < Calculation::Monthly::AbstractLunarPhase
25
- # @return [Cycle::Remainder] 弦
26
- QUARTER = Const::Remainder::Solar::QUARTER
27
-
28
- #
29
- # 初期化
20
+ module Daien
21
+ # :nodoc:
22
+ module Monthly
30
23
  #
31
- # @param [Integer] western_year 西暦年
24
+ # LunarPhase 月の位相
32
25
  #
33
- def initialize(western_year:)
34
- # 天正閏余
35
- lunar_age = Origin::LunarAge.get(western_year: western_year)
36
-
37
- super(
38
- quarter: QUARTER,
39
- average_remainder: Origin::AverageNovember.get(western_year: western_year),
40
- solar_location: Solar::Location.new(lunar_age: lunar_age),
41
- lunar_location: Lunar::Location.new(
42
- western_year: western_year,
43
- lunar_age: Cycle::LunarRemainder.new(total: 0).add!(lunar_age)
26
+ class LunarPhase < Calculation::Monthly::AbstractLunarPhase
27
+ # @return [Cycle::Remainder] 弦
28
+ QUARTER = Const::Remainder::Solar::QUARTER
29
+
30
+ #
31
+ # 初期化
32
+ #
33
+ # @param [Integer] western_year 西暦年
34
+ #
35
+ def initialize(western_year:)
36
+ # 天正閏余
37
+ lunar_age = Origin::LunarAge.get(western_year: western_year)
38
+
39
+ super(
40
+ quarter: QUARTER,
41
+ average_remainder: Origin::AverageNovember.get(western_year: western_year),
42
+ solar_location: Solar::Location.new(lunar_age: lunar_age),
43
+ lunar_location: Lunar::Location.new(
44
+ western_year: western_year,
45
+ lunar_age: Cycle::LunarRemainder.new(total: 0).add!(lunar_age)
46
+ )
44
47
  )
45
- )
46
- end
48
+ end
47
49
 
48
- private
50
+ private
49
51
 
50
- # :reek:TooManyStatements { max_statements: 6 }
52
+ # :reek:TooManyStatements { max_statements: 6 }
51
53
 
52
- #
53
- # 現在の定朔を取得する
54
- #
55
- # @return [Remainder] 定朔
56
- #
57
- def current_remainder
58
- # debug("average_remainder.format: #{average_remainder.format(form: '%d-%d-%.5f')}")
54
+ #
55
+ # 現在の定朔を取得する
56
+ #
57
+ # @return [Remainder] 定朔
58
+ #
59
+ def current_remainder
60
+ # debug("average_remainder.format: #{average_remainder.format(form: '%d-%d-%.5f')}")
59
61
 
60
- sum = correction_value
61
- adjusted = average_remainder.add(
62
- Cycle::Remainder.new(day: 0, minute: sum, second: 0)
63
- )
64
- # NOTE: 大衍暦では進朔しない
65
- # adjusted.up_on_new_moon!
62
+ sum = correction_value
63
+ adjusted = average_remainder.add(
64
+ Cycle::Remainder.new(day: 0, minute: sum, second: 0)
65
+ )
66
+ # NOTE: 大衍暦では進朔しない
67
+ # adjusted.up_on_new_moon!
66
68
 
67
- debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
69
+ debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
68
70
 
69
- adjusted
70
- end
71
+ adjusted
72
+ end
71
73
 
72
- #
73
- # 太陽運動の補正値を得る
74
- #
75
- # @return [Integer] 太陽運動の補正値
76
- #
77
- def correction_solar_value
78
- solar_location.run
79
- # debug("solar_term.remainder: #{solar_location.remainder.format(form: '%d-%d-%.5f')}")
80
- # debug("solar_term.index: #{solar_location.index}")
74
+ #
75
+ # 太陽運動の補正値を得る
76
+ #
77
+ # @return [Integer] 太陽運動の補正値
78
+ #
79
+ def correction_solar_value
80
+ solar_location.run
81
+ # debug("solar_term.remainder: #{solar_location.remainder.format(form: '%d-%d-%.5f')}")
82
+ # debug("solar_term.index: #{solar_location.index}")
81
83
 
82
- Solar::Value.get(solar_location: solar_location)
83
- end
84
+ Solar::Value.get(solar_location: solar_location)
85
+ end
84
86
 
85
- #
86
- # 月運動の補正値を得る
87
- #
88
- # @return [Integer] 月運動の補正値
89
- #
90
- def correction_moon_value
91
- lunar_location.run
87
+ #
88
+ # 月運動の補正値を得る
89
+ #
90
+ # @return [Integer] 月運動の補正値
91
+ #
92
+ def correction_moon_value
93
+ lunar_location.run
92
94
 
93
- remainder = lunar_location.adjusted_remainder
95
+ remainder = lunar_location.adjusted_remainder
94
96
 
95
- debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
97
+ debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
96
98
 
97
- Lunar::Value.get(remainder: remainder)
99
+ Lunar::Value.get(remainder: remainder)
100
+ end
98
101
  end
99
102
  end
100
103
  end
@@ -9,22 +9,25 @@ require_relative '../../cycle/remainder'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Daien
12
+ module Version
13
13
  # :nodoc:
14
- module Option
14
+ module Daien
15
15
  # :nodoc:
16
- module DroppedDate
17
- #
18
- # Parameter 引数
19
- #
20
- class Parameter < Calculation::Option::DroppedDate::AbstractParameter
16
+ module Option
17
+ # :nodoc:
18
+ module DroppedDate
21
19
  #
22
- # 初期化
20
+ # Parameter 引数
23
21
  #
24
- def initialize
25
- super(valid: true, year: Const::Number::Cycle::YEAR,
26
- limit: Const::Remainder::Solar::DROPPED_DATE_LIMIT,
27
- remainder_class: Cycle::DroppedRemainder)
22
+ class Parameter < Calculation::Option::DroppedDate::AbstractParameter
23
+ #
24
+ # 初期化
25
+ #
26
+ def initialize
27
+ super(valid: true, year: Const::Number::Cycle::YEAR,
28
+ limit: Const::Remainder::Solar::DROPPED_DATE_LIMIT,
29
+ remainder_class: Cycle::DroppedRemainder)
30
+ end
28
31
  end
29
32
  end
30
33
  end
@@ -9,22 +9,25 @@ require_relative '../../cycle/remainder'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Daien
12
+ module Version
13
13
  # :nodoc:
14
- module Option
14
+ module Daien
15
15
  # :nodoc:
16
- module VanishedDate
17
- #
18
- # Parameter 引数
19
- #
20
- class Parameter < Calculation::Option::VanishedDate::AbstractParameter
16
+ module Option
17
+ # :nodoc:
18
+ module VanishedDate
21
19
  #
22
- # 初期化
20
+ # Parameter 引数
23
21
  #
24
- def initialize
25
- super(valid: true,
26
- limit: Const::Remainder::Solar::VANISHED_DATE_LIMIT,
27
- remainder_class: Cycle::VanishedRemainder)
22
+ class Parameter < Calculation::Option::VanishedDate::AbstractParameter
23
+ #
24
+ # 初期化
25
+ #
26
+ def initialize
27
+ super(valid: true,
28
+ limit: Const::Remainder::Solar::VANISHED_DATE_LIMIT,
29
+ remainder_class: Cycle::VanishedRemainder)
30
+ end
28
31
  end
29
32
  end
30
33
  end
@@ -7,32 +7,35 @@ require_relative '../stella/solar/average'
7
7
  # :nodoc:
8
8
  module Zakuro
9
9
  # :nodoc:
10
- module Daien
10
+ module Version
11
11
  # :nodoc:
12
- module Range
13
- #
14
- # AnnualRange 年間範囲
15
- #
16
- module AnnualRange
17
- class << self
18
- #
19
- # 一覧取得する
20
- #
21
- # * 対象年に対して、前年11月-当年11月までを出力する
22
- # * 対象年(西暦)と計算年(元号x年)の紐付けは行わない
23
- #
24
- # @param [Context::Context] context 暦コンテキスト
25
- # @param [Integer] western_year 西暦年
26
- #
27
- # @return [Array<Month>] 1年データ
28
- #
29
- def get(context:, western_year:)
30
- lunar_phase = Monthly::LunarPhase.new(western_year: western_year)
31
- solar_average = Solar::Average.new(western_year: western_year)
12
+ module Daien
13
+ # :nodoc:
14
+ module Range
15
+ #
16
+ # AnnualRange 年間範囲
17
+ #
18
+ module AnnualRange
19
+ class << self
20
+ #
21
+ # 一覧取得する
22
+ #
23
+ # * 対象年に対して、前年11月-当年11月までを出力する
24
+ # * 対象年(西暦)と計算年(元号x年)の紐付けは行わない
25
+ #
26
+ # @param [Context::Context] context 暦コンテキスト
27
+ # @param [Integer] western_year 西暦年
28
+ #
29
+ # @return [Array<Month>] 1年データ
30
+ #
31
+ def get(context:, western_year:)
32
+ lunar_phase = Monthly::LunarPhase.new(western_year: western_year)
33
+ solar_average = Solar::Average.new(western_year: western_year)
32
34
 
33
- Calculation::Range::MedievalAnnualRange.get(
34
- context: context, lunar_phase: lunar_phase, solar_average: solar_average
35
- )
35
+ Calculation::Range::MedievalAnnualRange.get(
36
+ context: context, lunar_phase: lunar_phase, solar_average: solar_average
37
+ )
38
+ end
36
39
  end
37
40
  end
38
41
  end