zakuro 0.9.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) 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 +5 -5
  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/era/gengou/abstract_scroll.rb +2 -2
  12. data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +1 -1
  13. data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +4 -4
  14. data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +3 -3
  15. data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +1 -1
  16. data/lib/zakuro/calculation/era/version/internal/crawler.rb +3 -3
  17. data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +1 -1
  18. data/lib/zakuro/calculation/monthly/internal/date_comparer.rb +78 -0
  19. data/lib/zakuro/calculation/monthly/{meta → internal/meta}/all_solar_term.rb +1 -1
  20. data/lib/zakuro/calculation/monthly/{meta → internal/meta}/meta_collector.rb +2 -2
  21. data/lib/zakuro/calculation/monthly/{first_day.rb → internal/part/first_day.rb} +2 -2
  22. data/lib/zakuro/calculation/monthly/{meta.rb → internal/part/meta.rb} +1 -1
  23. data/lib/zakuro/calculation/monthly/internal/solar_term_selector.rb +203 -0
  24. data/lib/zakuro/calculation/monthly/month.rb +30 -125
  25. data/lib/zakuro/calculation/monthly/operated_month.rb +5 -2
  26. data/lib/zakuro/calculation/range/medieval_annual_range.rb +0 -2
  27. data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +24 -10
  28. data/lib/zakuro/calculation/stella/solar/abstract_average.rb +3 -3
  29. data/lib/zakuro/calculation/summary/internal/option/dropped_date.rb +102 -0
  30. data/lib/zakuro/calculation/summary/internal/option/vanished_date.rb +111 -0
  31. data/lib/zakuro/calculation/summary/internal/option.rb +4 -137
  32. data/lib/zakuro/calculation/summary/japan/range.rb +4 -5
  33. data/lib/zakuro/calculation/summary/western/single.rb +0 -2
  34. data/lib/zakuro/context/version_class_resolver.rb +5 -5
  35. data/lib/zakuro/era/japan/calendar.rb +4 -4
  36. data/lib/zakuro/era/japan/gengou/alignment/division.rb +2 -2
  37. data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +2 -2
  38. data/lib/zakuro/era/japan/gengou/alignment.rb +5 -3
  39. data/lib/zakuro/era/japan/gengou/resource/parser.rb +17 -16
  40. data/lib/zakuro/era/japan/gengou/resource/validator.rb +3 -394
  41. data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +2 -2
  42. data/lib/zakuro/era/japan/gengou.rb +3 -3
  43. data/lib/zakuro/era/japan/type/base/both/date.rb +51 -0
  44. data/lib/zakuro/era/japan/type/base/both/year.rb +53 -0
  45. data/lib/zakuro/era/japan/type/base/gengou.rb +177 -0
  46. data/lib/zakuro/era/japan/type/base/gengou_set.rb +78 -0
  47. data/lib/zakuro/era/japan/type/base/switch_date.rb +74 -0
  48. data/lib/zakuro/era/japan/type/base/version_range.rb +189 -0
  49. data/lib/zakuro/era/japan/type/validation/both/date.rb +99 -0
  50. data/lib/zakuro/era/japan/type/validation/both/year.rb +75 -0
  51. data/lib/zakuro/era/japan/type/validation/gengou.rb +93 -0
  52. data/lib/zakuro/era/japan/type/validation/gengou_set.rb +133 -0
  53. data/lib/zakuro/era/japan/type/validation/switch_date.rb +73 -0
  54. data/lib/zakuro/era/japan/type/validation/version_range.rb +109 -0
  55. data/lib/zakuro/era/japan/type/validation/version_root.rb +102 -0
  56. data/lib/zakuro/era/japan/version/resource/parser.rb +266 -0
  57. data/lib/zakuro/era/japan/version/resource/validator.rb +37 -0
  58. data/lib/zakuro/era/japan/version/resource/yaml/version.yaml +80 -0
  59. data/lib/zakuro/era/japan/version/resource.rb +22 -0
  60. data/lib/zakuro/era/japan/version.rb +4 -115
  61. data/lib/zakuro/era/western/calendar.rb +2 -2
  62. data/lib/zakuro/exception/zakuro_error.rb +1 -1
  63. data/lib/zakuro/merchant.rb +5 -5
  64. data/lib/zakuro/operation/month/parser.rb +2 -2
  65. data/lib/zakuro/operation/yaml/month.yaml +5 -5
  66. data/lib/zakuro/output/logger.rb +4 -4
  67. data/lib/zakuro/parameter/catalog/basis_date.rb +55 -0
  68. data/lib/zakuro/parameter/catalog/column.rb +57 -0
  69. data/lib/zakuro/parameter/catalog/option.rb +60 -0
  70. data/lib/zakuro/parameter/catalog/range.rb +81 -0
  71. data/lib/zakuro/parameter/condition.rb +108 -0
  72. data/lib/zakuro/result/core.rb +2 -2
  73. data/lib/zakuro/{tools → tool}/remainder_comparer.rb +2 -4
  74. data/lib/zakuro/{tools → tool}/stringifier.rb +3 -3
  75. data/lib/zakuro/{tools → tool}/typeconv.rb +2 -2
  76. data/lib/zakuro/{tools → tool}/typeof.rb +2 -2
  77. data/lib/zakuro/version/daien/const/number.rb +42 -39
  78. data/lib/zakuro/version/daien/const/remainder.rb +38 -35
  79. data/lib/zakuro/version/daien/cycle/remainder.rb +77 -74
  80. data/lib/zakuro/version/daien/cycle/solar_term.rb +18 -15
  81. data/lib/zakuro/version/daien/daien.rb +8 -5
  82. data/lib/zakuro/version/daien/monthly/lunar_phase.rb +67 -64
  83. data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +15 -12
  84. data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +15 -12
  85. data/lib/zakuro/version/daien/range/annual_range.rb +27 -24
  86. data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +209 -206
  87. data/lib/zakuro/version/daien/stella/lunar/localization.rb +32 -29
  88. data/lib/zakuro/version/daien/stella/lunar/location.rb +53 -50
  89. data/lib/zakuro/version/daien/stella/lunar/value.rb +65 -62
  90. data/lib/zakuro/version/daien/stella/origin/average_november.rb +23 -20
  91. data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +42 -39
  92. data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +44 -41
  93. data/lib/zakuro/version/daien/stella/solar/adjustment.rb +74 -71
  94. data/lib/zakuro/version/daien/stella/solar/average.rb +68 -65
  95. data/lib/zakuro/version/daien/stella/solar/interval.rb +95 -92
  96. data/lib/zakuro/version/daien/stella/solar/location.rb +41 -38
  97. data/lib/zakuro/version/daien/stella/solar/value.rb +21 -18
  98. data/lib/zakuro/version/genka/const/number.rb +31 -28
  99. data/lib/zakuro/version/genka/const/remainder.rb +20 -17
  100. data/lib/zakuro/version/genka/cycle/remainder.rb +72 -69
  101. data/lib/zakuro/version/genka/cycle/solar_term.rb +18 -15
  102. data/lib/zakuro/version/genka/genka.rb +8 -5
  103. data/lib/zakuro/version/genka/monthly/lunar_phase.rb +82 -79
  104. data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +13 -10
  105. data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +13 -10
  106. data/lib/zakuro/version/genka/range/annual_range.rb +57 -54
  107. data/lib/zakuro/version/genka/stella/origin/first_term.rb +44 -41
  108. data/lib/zakuro/version/genka/stella/origin/january.rb +38 -35
  109. data/lib/zakuro/version/genka/stella/solar/average.rb +24 -21
  110. data/lib/zakuro/version/gihou/const/number.rb +40 -37
  111. data/lib/zakuro/version/gihou/const/remainder.rb +32 -29
  112. data/lib/zakuro/version/gihou/cycle/remainder.rb +38 -35
  113. data/lib/zakuro/version/gihou/cycle/solar_term.rb +18 -15
  114. data/lib/zakuro/version/gihou/gihou.rb +8 -5
  115. data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +68 -65
  116. data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +13 -10
  117. data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +13 -10
  118. data/lib/zakuro/version/gihou/range/annual_range.rb +27 -24
  119. data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +212 -209
  120. data/lib/zakuro/version/gihou/stella/lunar/localization.rb +32 -29
  121. data/lib/zakuro/version/gihou/stella/lunar/location.rb +53 -50
  122. data/lib/zakuro/version/gihou/stella/lunar/value.rb +65 -62
  123. data/lib/zakuro/version/gihou/stella/origin/average_november.rb +23 -20
  124. data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +42 -39
  125. data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +44 -41
  126. data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +74 -71
  127. data/lib/zakuro/version/gihou/stella/solar/average.rb +67 -64
  128. data/lib/zakuro/version/gihou/stella/solar/interval.rb +95 -92
  129. data/lib/zakuro/version/gihou/stella/solar/location.rb +41 -38
  130. data/lib/zakuro/version/gihou/stella/solar/value.rb +21 -18
  131. data/lib/zakuro/version/gregorio/gregorio.rb +8 -5
  132. data/lib/zakuro/version/houryaku/houryaku.rb +8 -5
  133. data/lib/zakuro/version/joukyou/joukyou.rb +8 -5
  134. data/lib/zakuro/version/kansei/kansei.rb +8 -5
  135. data/lib/zakuro/version/senmyou/const/number.rb +40 -37
  136. data/lib/zakuro/version/senmyou/const/remainder.rb +35 -32
  137. data/lib/zakuro/version/senmyou/cycle/remainder.rb +74 -71
  138. data/lib/zakuro/version/senmyou/cycle/solar_term.rb +18 -15
  139. data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +69 -66
  140. data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +15 -12
  141. data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +15 -12
  142. data/lib/zakuro/version/senmyou/range/annual_range.rb +27 -24
  143. data/lib/zakuro/version/senmyou/senmyou.rb +8 -5
  144. data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +206 -203
  145. data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +32 -29
  146. data/lib/zakuro/version/senmyou/stella/lunar/location.rb +60 -57
  147. data/lib/zakuro/version/senmyou/stella/lunar/value.rb +66 -63
  148. data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +23 -20
  149. data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +42 -39
  150. data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +44 -41
  151. data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +74 -71
  152. data/lib/zakuro/version/senmyou/stella/solar/average.rb +67 -64
  153. data/lib/zakuro/version/senmyou/stella/solar/interval.rb +93 -90
  154. data/lib/zakuro/version/senmyou/stella/solar/location.rb +41 -38
  155. data/lib/zakuro/version/senmyou/stella/solar/value.rb +23 -20
  156. data/lib/zakuro/version/tenpou/tenpou.rb +8 -5
  157. metadata +44 -20
  158. data/lib/zakuro/condition.rb +0 -306
  159. data/lib/zakuro/era/japan/gengou/resource/type.rb +0 -356
  160. data/lib/zakuro/tools/gengou_range_comparer.rb +0 -82
  161. /data/lib/zakuro/calculation/monthly/{operated_solar_term.rb → internal/operated_solar_term.rb} +0 -0
  162. /data/lib/zakuro/calculation/monthly/{const.rb → internal/part/const.rb} +0 -0
  163. /data/lib/zakuro/calculation/monthly/{month_label.rb → internal/part/month_label.rb} +0 -0
@@ -9,70 +9,73 @@ require_relative './adjustment'
9
9
  # :nodoc:
10
10
  module Zakuro
11
11
  # :nodoc:
12
- module Senmyou
12
+ module Version
13
13
  # :nodoc:
14
- module Lunar
15
- #
16
- # Value 月補正値
17
- #
18
- module Value
19
- # @return [Output::Logger] ロガー
20
- LOGGER = Output::Logger.new(location: 'lunar_value')
21
-
22
- # :reek:TooManyStatements { max_statements: 9 }
23
-
24
- class << self
25
- #
26
- # 月の運行による補正値を算出する
27
- #
28
- # @param [Cycle::LunarRemainder] remainder 月の大余小余
29
- # @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
30
- #
31
- # @return [Integer] 補正値
32
- #
33
- def get(remainder:, forward:)
34
- valid?(remainder: remainder)
35
-
36
- day, minute = Calculation::Lunar::ChoukeiValue.remainder_without_second(
37
- remainder: remainder
38
- )
39
-
40
- # 引き当て
41
- row = Adjustment.specify(forward: forward, day: day, minute: minute)
42
-
43
- value = row.value
44
-
45
- # LOGGER.debug("value.per: #{value.per}")
46
- # LOGGER.debug("row.denominator: #{row.denominator}")
47
- # LOGGER.debug("value.stack: #{value.stack}")
48
-
49
- minus_minute = Adjustment.minus_minute(day: day, minute: minute)
50
-
51
- day = Calculation::Lunar::ChoukeiValue.rounded_day(
52
- per: value.per, denominator: row.denominator, minute: minus_minute
53
- )
54
-
55
- # LOGGER.debug("day: #{day}")
56
-
57
- value.stack + day
58
- end
59
-
60
- private
61
-
62
- #
63
- # 大余小余を検証する
64
- #
65
- # @param [Cycle::LunarRemainder] remainder 大余小余
66
- #
67
- # @return [True] 正しい(月の位相計算に使う大余小余)
68
- # @return [True] 正しくない
69
- #
70
- # @raise [ArgumentError] 引数エラー
71
- #
72
- def valid?(remainder:)
73
- return if remainder.is_a?(Cycle::LunarRemainder)
74
-
75
- raise ArgumentError, "unmatch parameter type: #{remainder.class}"
14
+ module Senmyou
15
+ # :nodoc:
16
+ module Lunar
17
+ #
18
+ # Value 月補正値
19
+ #
20
+ module Value
21
+ # @return [Output::Logger] ロガー
22
+ LOGGER = Output::Logger.new(location: 'lunar_value')
23
+
24
+ # :reek:TooManyStatements { max_statements: 9 }
25
+
26
+ class << self
27
+ #
28
+ # 月の運行による補正値を算出する
29
+ #
30
+ # @param [Cycle::LunarRemainder] remainder 月の大余小余
31
+ # @param [True, False] forward 進(遠地点より数える)/退(近地点より数える)
32
+ #
33
+ # @return [Integer] 補正値
34
+ #
35
+ def get(remainder:, forward:)
36
+ valid?(remainder: remainder)
37
+
38
+ day, minute = Calculation::Lunar::ChoukeiValue.remainder_without_second(
39
+ remainder: remainder
40
+ )
41
+
42
+ # 引き当て
43
+ row = Adjustment.specify(forward: forward, day: day, minute: minute)
44
+
45
+ value = row.value
46
+
47
+ # LOGGER.debug("value.per: #{value.per}")
48
+ # LOGGER.debug("row.denominator: #{row.denominator}")
49
+ # LOGGER.debug("value.stack: #{value.stack}")
50
+
51
+ minus_minute = Adjustment.minus_minute(day: day, minute: minute)
52
+
53
+ day = Calculation::Lunar::ChoukeiValue.rounded_day(
54
+ per: value.per, denominator: row.denominator, minute: minus_minute
55
+ )
56
+
57
+ # LOGGER.debug("day: #{day}")
58
+
59
+ value.stack + day
60
+ end
61
+
62
+ private
63
+
64
+ #
65
+ # 大余小余を検証する
66
+ #
67
+ # @param [Cycle::LunarRemainder] remainder 大余小余
68
+ #
69
+ # @return [True] 正しい(月の位相計算に使う大余小余)
70
+ # @return [True] 正しくない
71
+ #
72
+ # @raise [ArgumentError] 引数エラー
73
+ #
74
+ def valid?(remainder:)
75
+ return if remainder.is_a?(Cycle::LunarRemainder)
76
+
77
+ raise ArgumentError, "unmatch parameter type: #{remainder.class}"
78
+ end
76
79
  end
77
80
  end
78
81
  end
@@ -6,28 +6,31 @@ require_relative './winter_solstice'
6
6
  # :nodoc:
7
7
  module Zakuro
8
8
  # :nodoc:
9
- module Senmyou
9
+ module Version
10
10
  # :nodoc:
11
- module Origin
12
- #
13
- # AverageNovember 11月経
14
- #
15
- module AverageNovember
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)
11
+ module Senmyou
12
+ # :nodoc:
13
+ module Origin
14
+ #
15
+ # AverageNovember 11月経
16
+ #
17
+ module AverageNovember
18
+ class << self
19
+ #
20
+ # 11月経朔(冬至が含まれる月の1日)を求める
21
+ #
22
+ # @param [Integer] western_year 西暦年
23
+ #
24
+ # @return [Remainder] 11月経朔
25
+ #
26
+ def get(western_year:)
27
+ # 冬至
28
+ winter_solstice = WinterSolstice.get(western_year: western_year)
29
+ # 天正閏余
30
+ lunar_age = LunarAge.get(western_year: western_year)
29
31
 
30
- winter_solstice.sub(lunar_age)
32
+ winter_solstice.sub(lunar_age)
33
+ end
31
34
  end
32
35
  end
33
36
  end
@@ -7,55 +7,58 @@ require_relative '../../const/number'
7
7
  # :nodoc:
8
8
  module Zakuro
9
9
  # :nodoc:
10
- module Senmyou
10
+ module Version
11
11
  # :nodoc:
12
- module Origin
13
- #
14
- # LunarAge 天正閏余
15
- #
16
- module LunarAge
17
- # @return [Integer] 朔望月
18
- SYNODIC_MONTH = Const::Number::Cycle::SYNODIC_MONTH
19
- # @return [Integer] 一年
20
- YEAR = Const::Number::Cycle::YEAR
21
- # @return [Integer] 積年
22
- TOTAL_YEAR = Const::Number::Stack::TOTAL_YEAR
23
- # @return [Integer] 暦の開始年
24
- BEGIN_YEAR = Const::Number::Stack::BEGIN_YEAR
12
+ module Senmyou
13
+ # :nodoc:
14
+ module Origin
15
+ #
16
+ # LunarAge 天正閏余
17
+ #
18
+ module LunarAge
19
+ # @return [Integer] 朔望月
20
+ SYNODIC_MONTH = Const::Number::Cycle::SYNODIC_MONTH
21
+ # @return [Integer] 一年
22
+ YEAR = Const::Number::Cycle::YEAR
23
+ # @return [Integer] 積年
24
+ TOTAL_YEAR = Const::Number::Stack::TOTAL_YEAR
25
+ # @return [Integer] 暦の開始年
26
+ BEGIN_YEAR = Const::Number::Stack::BEGIN_YEAR
25
27
 
26
- # @return [Output::Logger] ロガー
27
- LOGGER = Output::Logger.new(location: 'lunar_age')
28
+ # @return [Output::Logger] ロガー
29
+ LOGGER = Output::Logger.new(location: 'lunar_age')
28
30
 
29
- # :reek:TooManyStatements { max_statements: 7 }
31
+ # :reek:TooManyStatements { max_statements: 7 }
30
32
 
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
33
+ class << self
34
+ #
35
+ # 対象年の天正閏余(冬至より前にある11月経朔との差 = 月齢)を算出する
36
+ # 太陽と月の運動による補正値を算出し、その補正結果を返す
37
+ #
38
+ # @param [Integer] western_year 西暦年
39
+ #
40
+ # @return [Remainder] 天正閏余
41
+ #
42
+ def get(western_year:)
43
+ # 積年の開始から対象年までの年数
44
+ total = TOTAL_YEAR + western_year - BEGIN_YEAR
43
45
 
44
- # 12朔望月に対する1年の余り(単位:分)
45
- remainder_minute = YEAR - (SYNODIC_MONTH * 12)
46
+ # 12朔望月に対する1年の余り(単位:分)
47
+ remainder_minute = YEAR - (SYNODIC_MONTH * 12)
46
48
 
47
- # 朔望月に含まれなかった余り(単位:年)
48
- remainder_year = total % SYNODIC_MONTH
49
+ # 朔望月に含まれなかった余り(単位:年)
50
+ remainder_year = total % SYNODIC_MONTH
49
51
 
50
- LOGGER.debug("[01]: #{remainder_year}")
52
+ LOGGER.debug("[01]: #{remainder_year}")
51
53
 
52
- # 天正閏余
53
- lunar_age = remainder_minute * remainder_year % SYNODIC_MONTH
54
+ # 天正閏余
55
+ lunar_age = remainder_minute * remainder_year % SYNODIC_MONTH
54
56
 
55
- LOGGER.debug("[02]: #{lunar_age}")
57
+ LOGGER.debug("[02]: #{lunar_age}")
56
58
 
57
- # 大余・小余に変換する
58
- Cycle::Remainder.new(total: lunar_age)
59
+ # 大余・小余に変換する
60
+ Cycle::Remainder.new(total: lunar_age)
61
+ end
59
62
  end
60
63
  end
61
64
  end
@@ -7,48 +7,51 @@ require_relative '../../const/number'
7
7
  # :nodoc:
8
8
  module Zakuro
9
9
  # :nodoc:
10
- module Senmyou
10
+ module Version
11
11
  # :nodoc:
12
- module Origin
13
- #
14
- # WinterSolstice 冬至
15
- #
16
- module WinterSolstice
17
- # @return [Integer] 通余
18
- REMAINDER_ALL_YEAR = Const::Number::Derivation::REMAINDER_ALL_YEAR
19
- # @return [Integer] 60日
20
- SIXTY_DAYS = Const::Number::Derivation::SIXTY_DAYS
21
- # @return [Integer] 積年
22
- TOTAL_YEAR = Const::Number::Stack::TOTAL_YEAR
23
- # @return [Integer] 暦の開始年
24
- BEGIN_YEAR = Const::Number::Stack::BEGIN_YEAR
25
-
26
- # @return [Output::Logger] ロガー
27
- LOGGER = Output::Logger.new(location: 'winter_solstice')
28
-
29
- # :reek:TooManyStatements { max_statements: 6 }
30
-
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)
12
+ module Senmyou
13
+ # :nodoc:
14
+ module Origin
15
+ #
16
+ # WinterSolstice 冬至
17
+ #
18
+ module WinterSolstice
19
+ # @return [Integer] 通余
20
+ REMAINDER_ALL_YEAR = Const::Number::Derivation::REMAINDER_ALL_YEAR
21
+ # @return [Integer] 60日
22
+ SIXTY_DAYS = Const::Number::Derivation::SIXTY_DAYS
23
+ # @return [Integer] 積年
24
+ TOTAL_YEAR = Const::Number::Stack::TOTAL_YEAR
25
+ # @return [Integer] 暦の開始年
26
+ BEGIN_YEAR = Const::Number::Stack::BEGIN_YEAR
27
+
28
+ # @return [Output::Logger] ロガー
29
+ LOGGER = Output::Logger.new(location: 'winter_solstice')
30
+
31
+ # :reek:TooManyStatements { max_statements: 6 }
32
+
33
+ class << self
34
+ #
35
+ # 対象年の前年の冬至を求める
36
+ #
37
+ # @param [Integer] western_year 西暦年
38
+ #
39
+ # @return [Remainder] 前年の冬至
40
+ #
41
+ def get(western_year:)
42
+ # 積年の開始から対象年までの年数
43
+ total = TOTAL_YEAR + western_year - BEGIN_YEAR
44
+ remainder_year = total % SIXTY_DAYS
45
+
46
+ LOGGER.debug("[01]:#{remainder_year}")
47
+
48
+ # 通余を使う
49
+ winter_solstice_minute = (remainder_year * REMAINDER_ALL_YEAR) % SIXTY_DAYS
50
+
51
+ LOGGER.debug("[02]:#{winter_solstice_minute}")
52
+
53
+ Cycle::Remainder.new(total: winter_solstice_minute)
54
+ end
52
55
  end
53
56
  end
54
57
  end
@@ -7,86 +7,89 @@ require_relative '../../const/number'
7
7
  # :nodoc:
8
8
  module Zakuro
9
9
  # :nodoc:
10
- module Senmyou
10
+ module Version
11
11
  # :nodoc:
12
- module Solar
13
- #
14
- # Adjustment 24気損益眺朒(ちょうじく)数
15
- #
16
- module Adjustment
12
+ module Senmyou
13
+ # :nodoc:
14
+ module Solar
17
15
  #
18
- # Row 行データ
16
+ # Adjustment 24気損益眺朒(ちょうじく)数
19
17
  #
20
- class Row
21
- # @return [Integer] 眺朒(ちょうじく)積
22
- attr_reader :stack
23
- # @return [Integer] 眺朒(ちょうじく)数
24
- attr_reader :per_term
25
- # @return [Integer] 毎日差
26
- attr_reader :per_day
27
-
28
- #
29
- # 初期化
18
+ module Adjustment
30
19
  #
31
- # @param [Integer] stack 眺朒(ちょうじく)積
32
- # @param [Integer] per_term 眺朒(ちょうじく)数
33
- # @param [Integer] per_day 毎日差
20
+ # Row 行データ
34
21
  #
35
- def initialize(stack:, per_term:, per_day:)
36
- @stack = stack
37
- @per_term = per_term
38
- @per_day = per_day
39
- end
22
+ class Row
23
+ # @return [Integer] 眺朒(ちょうじく)積
24
+ attr_reader :stack
25
+ # @return [Integer] 眺朒(ちょうじく)数
26
+ attr_reader :per_term
27
+ # @return [Integer] 毎日差
28
+ attr_reader :per_day
40
29
 
41
- #
42
- # 文字化
43
- #
44
- # @return [String] 文字
45
- #
46
- def to_s
47
- "stack:#{@stack}, per_term:#{@per_term}, per_day:#{@per_day}"
30
+ #
31
+ # 初期化
32
+ #
33
+ # @param [Integer] stack 眺朒(ちょうじく)積
34
+ # @param [Integer] per_term 眺朒(ちょうじく)数
35
+ # @param [Integer] per_day 毎日差
36
+ #
37
+ def initialize(stack:, per_term:, per_day:)
38
+ @stack = stack
39
+ @per_term = per_term
40
+ @per_day = per_day
41
+ end
42
+
43
+ #
44
+ # 文字化
45
+ #
46
+ # @return [String] 文字
47
+ #
48
+ def to_s
49
+ "stack:#{@stack}, per_term:#{@per_term}, per_day:#{@per_day}"
50
+ end
48
51
  end
49
- end
50
52
 
51
- # @return [Array<Row>] 24気損益眺朒(ちょうじく)数
52
- MAP = {
53
- touji: Row.new(stack: 0.0, per_term: +33.4511, per_day: -0.3695), # 冬至(とうじ)
54
- shoukan: Row.new(stack: +449.0, per_term: +28.0389, per_day: -0.3606), # 小寒(しょうかん)
55
- daikan: Row.new(stack: +823.0, per_term: +22.6998, per_day: -0.3519), # 大寒(だいかん)
56
- risshun: Row.new(stack: +1122.0, per_term: +17.8923, per_day: -0.4068), # 立春(りっしゅん)
57
- usui: Row.new(stack: +1346.0, per_term: +11.7966, per_day: -0.3998), # 雨水(うすい)
58
- keichitsu: Row.new(stack: +1481.0, per_term: +5.7986, per_day: -0.3998), # 啓蟄(けいちつ)
59
- shunbun: Row.new(stack: +1526.0, per_term: -0.2433, per_day: -0.3779), # 春分(しゅんぶん)
60
- seimei: Row.new(stack: +1481.0, per_term: -6.1254, per_day: -0.3634), # 清明(せいめい)
61
- kokuu: Row.new(stack: +1346.0, per_term: -12.2048, per_day: -0.2987), # 穀雨(こくう)
62
- rikka: Row.new(stack: +1122.0, per_term: -16.9060, per_day: -0.2919), # 立夏(りっか)
63
- shouman: Row.new(stack: +823.0, per_term: -21.5362, per_day: -0.2854), # 小満(しょうまん)
64
- boushu: Row.new(stack: +449.0, per_term: -26.0498, per_day: -0.2854), # 芒種(ぼうしゅ)
65
- geshi: Row.new(stack: 0.0, per_term: -30.3119, per_day: +0.2854), # 夏至(げし)
66
- shousho: Row.new(stack: -449.0, per_term: -25.8126, per_day: +0.2919), # 小暑(しょうしょ)
67
- taisho: Row.new(stack: -823.0, per_term: -21.2454, per_day: +0.2987), # 大暑(たいしょ)
68
- risshuu: Row.new(stack: -1122.0, per_term: -17.0296, per_day: +0.3634), # 立秋(りっしゅう)
69
- shosho: Row.new(stack: -1346.0, per_term: -11.4744, per_day: +0.3779), # 処暑(しょしょ)
70
- hakuro: Row.new(stack: -1481.0, per_term: -5.6429, per_day: +0.3779), # 白露(はくろ)
71
- shuubun: Row.new(stack: -1526.0, per_term: +0.1432, per_day: +0.3998), # 秋分(しゅうぶん)
72
- kanro: Row.new(stack: -1481.0, per_term: +6.1488, per_day: +0.4068), # 寒露(かんろ)
73
- soukou: Row.new(stack: -1346.0, per_term: +12.6336, per_day: +0.3519), # 霜降(そうこう)
74
- rittou: Row.new(stack: -1122.0, per_term: +17.8043, per_day: +0.3606), # 立冬(りっとう)
75
- shousetsu: Row.new(stack: -823.0, per_term: +23.0590, per_day: +0.3695), # 小雪(しょうせつ)
76
- taisetsu: Row.new(stack: -449.0, per_term: +28.4618, per_day: +0.3695) # 大雪(たいせつ)
77
- }.freeze
53
+ # @return [Array<Row>] 24気損益眺朒(ちょうじく)数
54
+ MAP = {
55
+ touji: Row.new(stack: 0.0, per_term: +33.4511, per_day: -0.3695), # 冬至(とうじ)
56
+ shoukan: Row.new(stack: +449.0, per_term: +28.0389, per_day: -0.3606), # 小寒(しょうかん)
57
+ daikan: Row.new(stack: +823.0, per_term: +22.6998, per_day: -0.3519), # 大寒(だいかん)
58
+ risshun: Row.new(stack: +1122.0, per_term: +17.8923, per_day: -0.4068), # 立春(りっしゅん)
59
+ usui: Row.new(stack: +1346.0, per_term: +11.7966, per_day: -0.3998), # 雨水(うすい)
60
+ keichitsu: Row.new(stack: +1481.0, per_term: +5.7986, per_day: -0.3998), # 啓蟄(けいちつ)
61
+ shunbun: Row.new(stack: +1526.0, per_term: -0.2433, per_day: -0.3779), # 春分(しゅんぶん)
62
+ seimei: Row.new(stack: +1481.0, per_term: -6.1254, per_day: -0.3634), # 清明(せいめい)
63
+ kokuu: Row.new(stack: +1346.0, per_term: -12.2048, per_day: -0.2987), # 穀雨(こくう)
64
+ rikka: Row.new(stack: +1122.0, per_term: -16.9060, per_day: -0.2919), # 立夏(りっか)
65
+ shouman: Row.new(stack: +823.0, per_term: -21.5362, per_day: -0.2854), # 小満(しょうまん)
66
+ boushu: Row.new(stack: +449.0, per_term: -26.0498, per_day: -0.2854), # 芒種(ぼうしゅ)
67
+ geshi: Row.new(stack: 0.0, per_term: -30.3119, per_day: +0.2854), # 夏至(げし)
68
+ shousho: Row.new(stack: -449.0, per_term: -25.8126, per_day: +0.2919), # 小暑(しょうしょ)
69
+ taisho: Row.new(stack: -823.0, per_term: -21.2454, per_day: +0.2987), # 大暑(たいしょ)
70
+ risshuu: Row.new(stack: -1122.0, per_term: -17.0296, per_day: +0.3634), # 立秋(りっしゅう)
71
+ shosho: Row.new(stack: -1346.0, per_term: -11.4744, per_day: +0.3779), # 処暑(しょしょ)
72
+ hakuro: Row.new(stack: -1481.0, per_term: -5.6429, per_day: +0.3779), # 白露(はくろ)
73
+ shuubun: Row.new(stack: -1526.0, per_term: +0.1432, per_day: +0.3998), # 秋分(しゅうぶん)
74
+ kanro: Row.new(stack: -1481.0, per_term: +6.1488, per_day: +0.4068), # 寒露(かんろ)
75
+ soukou: Row.new(stack: -1346.0, per_term: +12.6336, per_day: +0.3519), # 霜降(そうこう)
76
+ rittou: Row.new(stack: -1122.0, per_term: +17.8043, per_day: +0.3606), # 立冬(りっとう)
77
+ shousetsu: Row.new(stack: -823.0, per_term: +23.0590, per_day: +0.3695), # 小雪(しょうせつ)
78
+ taisetsu: Row.new(stack: -449.0, per_term: +28.4618, per_day: +0.3695) # 大雪(たいせつ)
79
+ }.freeze
78
80
 
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
81
+ class << self
82
+ #
83
+ # 24気損益眺朒(ちょうじく)数の行データを特定する
84
+ #
85
+ # @param [Integer] index 連番(二十四節気)
86
+ #
87
+ # @return [Row] 行データ
88
+ #
89
+ def specify(index:)
90
+ key = Cycle::SolarTerm::ORDER[index]
91
+ Adjustment::MAP[key].clone
92
+ end
90
93
  end
91
94
  end
92
95
  end