zakuro 0.9.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/README.md +41 -8
- data/VERSION +1 -1
- data/doc/gengou.md +1 -1
- data/doc/operation/csv/month.csv +8 -9
- data/doc/operation/operation.xlsx +0 -0
- data/images/logo-text.png +0 -0
- data/lib/zakuro/calculation/base/gengou.rb +2 -4
- data/lib/zakuro/calculation/base/year.rb +1 -1
- data/lib/zakuro/calculation/cycle/abstract_solar_term.rb +6 -0
- data/lib/zakuro/calculation/era/gengou/abstract_scroll.rb +2 -2
- data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +4 -2
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +1 -1
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +13 -7
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_range.rb +18 -9
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +6 -2
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_range.rb +5 -2
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +3 -3
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +12 -4
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +10 -4
- data/lib/zakuro/calculation/era/gengou/named_scroll.rb +5 -2
- data/lib/zakuro/calculation/era/version/internal/crawler.rb +3 -3
- data/lib/zakuro/calculation/monthly/abstract_lunar_phase.rb +1 -1
- data/lib/zakuro/calculation/monthly/internal/date_comparer.rb +78 -0
- data/lib/zakuro/calculation/monthly/{meta → internal/meta}/all_solar_term.rb +1 -1
- data/lib/zakuro/calculation/monthly/{meta → internal/meta}/meta_collector.rb +2 -2
- data/lib/zakuro/calculation/monthly/{first_day.rb → internal/part/first_day.rb} +2 -2
- data/lib/zakuro/calculation/monthly/{meta.rb → internal/part/meta.rb} +1 -1
- data/lib/zakuro/calculation/monthly/internal/solar_term_selector.rb +203 -0
- data/lib/zakuro/calculation/monthly/month.rb +38 -74
- data/lib/zakuro/calculation/monthly/operated_month.rb +7 -2
- data/lib/zakuro/calculation/option/dropped_date/location.rb +8 -1
- data/lib/zakuro/calculation/range/dated_full_range.rb +6 -3
- data/lib/zakuro/calculation/range/dated_operation_range.rb +2 -1
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +0 -2
- data/lib/zakuro/calculation/range/named_full_range.rb +1 -1
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +24 -10
- data/lib/zakuro/calculation/stella/solar/abstract_average.rb +3 -3
- data/lib/zakuro/calculation/summary/internal/option/dropped_date.rb +102 -0
- data/lib/zakuro/calculation/summary/internal/option/vanished_date.rb +111 -0
- data/lib/zakuro/calculation/summary/internal/option.rb +4 -137
- data/lib/zakuro/calculation/summary/japan/range.rb +4 -5
- data/lib/zakuro/calculation/summary/western/range.rb +8 -1
- data/lib/zakuro/calculation/summary/western/single.rb +10 -5
- data/lib/zakuro/context/version_class_resolver.rb +5 -5
- data/lib/zakuro/era/japan/calendar.rb +4 -4
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +2 -2
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +2 -2
- data/lib/zakuro/era/japan/gengou/alignment.rb +35 -6
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +17 -16
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +3 -394
- data/lib/zakuro/era/japan/gengou/resource/yaml/set-001-until-south.yaml +2 -2
- data/lib/zakuro/era/japan/gengou.rb +8 -6
- data/lib/zakuro/era/japan/type/base/both/date.rb +51 -0
- data/lib/zakuro/era/japan/type/base/both/year.rb +53 -0
- data/lib/zakuro/era/japan/type/base/gengou.rb +177 -0
- data/lib/zakuro/era/japan/type/base/gengou_set.rb +78 -0
- data/lib/zakuro/era/japan/type/base/switch_date.rb +74 -0
- data/lib/zakuro/era/japan/type/base/version_range.rb +189 -0
- data/lib/zakuro/era/japan/type/validation/both/date.rb +99 -0
- data/lib/zakuro/era/japan/type/validation/both/year.rb +75 -0
- data/lib/zakuro/era/japan/type/validation/gengou.rb +93 -0
- data/lib/zakuro/era/japan/type/validation/gengou_set.rb +133 -0
- data/lib/zakuro/era/japan/type/validation/switch_date.rb +73 -0
- data/lib/zakuro/era/japan/type/validation/version_range.rb +109 -0
- data/lib/zakuro/era/japan/type/validation/version_root.rb +102 -0
- data/lib/zakuro/era/japan/version/resource/parser.rb +266 -0
- data/lib/zakuro/era/japan/version/resource/validator.rb +37 -0
- data/lib/zakuro/era/japan/version/resource/yaml/version.yaml +80 -0
- data/lib/zakuro/era/japan/version/resource.rb +22 -0
- data/lib/zakuro/era/japan/version.rb +4 -115
- data/lib/zakuro/era/western/calendar.rb +2 -2
- data/lib/zakuro/exception/zakuro_error.rb +1 -1
- data/lib/zakuro/merchant.rb +5 -5
- data/lib/zakuro/operation/month/parser.rb +2 -2
- data/lib/zakuro/operation/yaml/month.yaml +8 -40
- data/lib/zakuro/output/logger.rb +4 -4
- data/lib/zakuro/parameter/catalog/basis_date.rb +55 -0
- data/lib/zakuro/parameter/catalog/column.rb +57 -0
- data/lib/zakuro/parameter/catalog/option.rb +60 -0
- data/lib/zakuro/parameter/catalog/range.rb +81 -0
- data/lib/zakuro/parameter/condition.rb +108 -0
- data/lib/zakuro/result/core.rb +2 -2
- data/lib/zakuro/{tools → tool}/remainder_comparer.rb +3 -2
- data/lib/zakuro/{tools → tool}/stringifier.rb +3 -3
- data/lib/zakuro/{tools → tool}/typeconv.rb +2 -2
- data/lib/zakuro/{tools → tool}/typeof.rb +2 -2
- data/lib/zakuro/version/daien/const/number.rb +42 -39
- data/lib/zakuro/version/daien/const/remainder.rb +38 -35
- data/lib/zakuro/version/daien/cycle/remainder.rb +77 -74
- data/lib/zakuro/version/daien/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/daien/daien.rb +8 -5
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +67 -64
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +15 -12
- data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +15 -12
- data/lib/zakuro/version/daien/range/annual_range.rb +27 -24
- data/lib/zakuro/version/daien/stella/lunar/adjustment.rb +209 -206
- data/lib/zakuro/version/daien/stella/lunar/localization.rb +32 -29
- data/lib/zakuro/version/daien/stella/lunar/location.rb +53 -50
- data/lib/zakuro/version/daien/stella/lunar/value.rb +65 -62
- data/lib/zakuro/version/daien/stella/origin/average_november.rb +23 -20
- data/lib/zakuro/version/daien/stella/origin/lunar_age.rb +42 -39
- data/lib/zakuro/version/daien/stella/origin/winter_solstice.rb +44 -41
- data/lib/zakuro/version/daien/stella/solar/adjustment.rb +74 -71
- data/lib/zakuro/version/daien/stella/solar/average.rb +68 -65
- data/lib/zakuro/version/daien/stella/solar/interval.rb +95 -92
- data/lib/zakuro/version/daien/stella/solar/location.rb +41 -38
- data/lib/zakuro/version/daien/stella/solar/value.rb +21 -18
- data/lib/zakuro/version/genka/const/number.rb +31 -28
- data/lib/zakuro/version/genka/const/remainder.rb +20 -17
- data/lib/zakuro/version/genka/cycle/remainder.rb +72 -69
- data/lib/zakuro/version/genka/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/genka/genka.rb +8 -5
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +82 -79
- data/lib/zakuro/version/genka/option/dropped_date/parameter.rb +13 -10
- data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +13 -10
- data/lib/zakuro/version/genka/range/annual_range.rb +57 -54
- data/lib/zakuro/version/genka/stella/origin/first_term.rb +44 -41
- data/lib/zakuro/version/genka/stella/origin/january.rb +38 -35
- data/lib/zakuro/version/genka/stella/solar/average.rb +24 -21
- data/lib/zakuro/version/gihou/const/number.rb +40 -37
- data/lib/zakuro/version/gihou/const/remainder.rb +32 -29
- data/lib/zakuro/version/gihou/cycle/remainder.rb +38 -35
- data/lib/zakuro/version/gihou/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/gihou/gihou.rb +8 -5
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +68 -65
- data/lib/zakuro/version/gihou/option/dropped_date/parameter.rb +13 -10
- data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +13 -10
- data/lib/zakuro/version/gihou/range/annual_range.rb +27 -24
- data/lib/zakuro/version/gihou/stella/lunar/adjustment.rb +212 -209
- data/lib/zakuro/version/gihou/stella/lunar/localization.rb +32 -29
- data/lib/zakuro/version/gihou/stella/lunar/location.rb +53 -50
- data/lib/zakuro/version/gihou/stella/lunar/value.rb +65 -62
- data/lib/zakuro/version/gihou/stella/origin/average_november.rb +23 -20
- data/lib/zakuro/version/gihou/stella/origin/lunar_age.rb +42 -39
- data/lib/zakuro/version/gihou/stella/origin/winter_solstice.rb +44 -41
- data/lib/zakuro/version/gihou/stella/solar/adjustment.rb +74 -71
- data/lib/zakuro/version/gihou/stella/solar/average.rb +67 -64
- data/lib/zakuro/version/gihou/stella/solar/interval.rb +95 -92
- data/lib/zakuro/version/gihou/stella/solar/location.rb +41 -38
- data/lib/zakuro/version/gihou/stella/solar/value.rb +21 -18
- data/lib/zakuro/version/gregorio/gregorio.rb +8 -5
- data/lib/zakuro/version/houryaku/houryaku.rb +8 -5
- data/lib/zakuro/version/joukyou/joukyou.rb +8 -5
- data/lib/zakuro/version/kansei/kansei.rb +8 -5
- data/lib/zakuro/version/senmyou/const/number.rb +40 -37
- data/lib/zakuro/version/senmyou/const/remainder.rb +35 -32
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +74 -71
- data/lib/zakuro/version/senmyou/cycle/solar_term.rb +18 -15
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +69 -66
- data/lib/zakuro/version/senmyou/option/dropped_date/parameter.rb +15 -12
- data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +15 -12
- data/lib/zakuro/version/senmyou/range/annual_range.rb +27 -24
- data/lib/zakuro/version/senmyou/senmyou.rb +8 -5
- data/lib/zakuro/version/senmyou/stella/lunar/adjustment.rb +206 -203
- data/lib/zakuro/version/senmyou/stella/lunar/localization.rb +32 -29
- data/lib/zakuro/version/senmyou/stella/lunar/location.rb +60 -57
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +66 -63
- data/lib/zakuro/version/senmyou/stella/origin/average_november.rb +23 -20
- data/lib/zakuro/version/senmyou/stella/origin/lunar_age.rb +42 -39
- data/lib/zakuro/version/senmyou/stella/origin/winter_solstice.rb +44 -41
- data/lib/zakuro/version/senmyou/stella/solar/adjustment.rb +74 -71
- data/lib/zakuro/version/senmyou/stella/solar/average.rb +67 -64
- data/lib/zakuro/version/senmyou/stella/solar/interval.rb +93 -90
- data/lib/zakuro/version/senmyou/stella/solar/location.rb +41 -38
- data/lib/zakuro/version/senmyou/stella/solar/value.rb +23 -20
- data/lib/zakuro/version/tenpou/tenpou.rb +8 -5
- metadata +40 -15
- data/lib/zakuro/condition.rb +0 -306
- data/lib/zakuro/era/japan/gengou/resource/type.rb +0 -356
- /data/lib/zakuro/calculation/monthly/{operated_solar_term.rb → internal/operated_solar_term.rb} +0 -0
- /data/lib/zakuro/calculation/monthly/{const.rb → internal/part/const.rb} +0 -0
- /data/lib/zakuro/calculation/monthly/{month_label.rb → internal/part/month_label.rb} +0 -0
@@ -9,69 +9,72 @@ require_relative './adjustment'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Version
|
13
13
|
# :nodoc:
|
14
|
-
module
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
14
|
+
module Gihou
|
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
|
+
#
|
32
|
+
# @return [Integer] 補正値
|
33
|
+
#
|
34
|
+
def get(remainder:)
|
35
|
+
valid?(remainder: remainder)
|
36
|
+
|
37
|
+
day, minute = Calculation::Lunar::ChoukeiValue.remainder_without_second(
|
38
|
+
remainder: remainder
|
39
|
+
)
|
40
|
+
|
41
|
+
# 引き当て
|
42
|
+
row = Adjustment.specify(day: day, minute: minute)
|
43
|
+
|
44
|
+
value = row.value
|
45
|
+
|
46
|
+
# LOGGER.debug("value.per: #{value.per}")
|
47
|
+
# LOGGER.debug("row.denominator: #{row.denominator}")
|
48
|
+
# LOGGER.debug("value.stack: #{value.stack}")
|
49
|
+
|
50
|
+
minus_minute = Adjustment.minus_minute(day: day, minute: minute)
|
51
|
+
|
52
|
+
day = Calculation::Lunar::ChoukeiValue.rounded_day(
|
53
|
+
per: value.per, denominator: row.denominator, minute: minus_minute
|
54
|
+
)
|
55
|
+
|
56
|
+
# LOGGER.debug("day: #{day}")
|
57
|
+
|
58
|
+
value.stack + day
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
#
|
64
|
+
# 大余小余を検証する
|
65
|
+
#
|
66
|
+
# @param [Cycle::LunarRemainder] remainder 大余小余
|
67
|
+
#
|
68
|
+
# @return [True] 正しい(月の位相計算に使う大余小余)
|
69
|
+
# @return [True] 正しくない
|
70
|
+
#
|
71
|
+
# @raise [ArgumentError] 引数エラー
|
72
|
+
#
|
73
|
+
def valid?(remainder:)
|
74
|
+
return if remainder.is_a?(Cycle::LunarRemainder)
|
75
|
+
|
76
|
+
raise ArgumentError, "unmatch parameter type: #{remainder.class}"
|
77
|
+
end
|
75
78
|
end
|
76
79
|
end
|
77
80
|
end
|
@@ -6,28 +6,31 @@ require_relative './winter_solstice'
|
|
6
6
|
# :nodoc:
|
7
7
|
module Zakuro
|
8
8
|
# :nodoc:
|
9
|
-
module
|
9
|
+
module Version
|
10
10
|
# :nodoc:
|
11
|
-
module
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
11
|
+
module Gihou
|
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
|
-
|
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
|
10
|
+
module Version
|
11
11
|
# :nodoc:
|
12
|
-
module
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
module Gihou
|
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
|
-
|
27
|
-
|
28
|
+
# @return [Output::Logger] ロガー
|
29
|
+
LOGGER = Output::Logger.new(location: 'lunar_age')
|
28
30
|
|
29
|
-
|
31
|
+
# :reek:TooManyStatements { max_statements: 7 }
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
45
|
-
|
46
|
+
# 12朔望月に対する1年の余り(単位:分)
|
47
|
+
remainder_minute = YEAR - (SYNODIC_MONTH * 12)
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
# 朔望月に含まれなかった余り(単位:年)
|
50
|
+
remainder_year = total % SYNODIC_MONTH
|
49
51
|
|
50
|
-
|
52
|
+
LOGGER.debug("[01]: #{remainder_year}")
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
+
# 天正閏余
|
55
|
+
lunar_age = remainder_minute * remainder_year % SYNODIC_MONTH
|
54
56
|
|
55
|
-
|
57
|
+
LOGGER.debug("[02]: #{lunar_age}")
|
56
58
|
|
57
|
-
|
58
|
-
|
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
|
10
|
+
module Version
|
11
11
|
# :nodoc:
|
12
|
-
module
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
12
|
+
module Gihou
|
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
|
+
class << self
|
32
|
+
# :reek:TooManyStatements { max_statements: 6 }
|
33
|
+
|
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
|
10
|
+
module Version
|
11
11
|
# :nodoc:
|
12
|
-
module
|
13
|
-
#
|
14
|
-
|
15
|
-
#
|
16
|
-
module Adjustment
|
12
|
+
module Gihou
|
13
|
+
# :nodoc:
|
14
|
+
module Solar
|
17
15
|
#
|
18
|
-
#
|
16
|
+
# Adjustment 24気損益眺朒(ちょうじく)数
|
19
17
|
#
|
20
|
-
|
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
|
-
#
|
32
|
-
# @param [Integer] per_term 眺朒(ちょうじく)数
|
33
|
-
# @param [Integer] per_day 毎日差
|
20
|
+
# Row 行データ
|
34
21
|
#
|
35
|
-
|
36
|
-
@
|
37
|
-
|
38
|
-
@
|
39
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
53
|
+
# @return [Array<Row>] 24気損益眺朒(ちょうじく)数
|
54
|
+
MAP = {
|
55
|
+
touji: Row.new(stack: 0.0, per_term: +3.9546, per_day: -0.0372), # 冬至(とうじ)
|
56
|
+
shoukan: Row.new(stack: +54.0, per_term: +3.4091, per_day: -0.0372), # 小寒(しょうかん)
|
57
|
+
daikan: Row.new(stack: +100.0, per_term: +2.8636, per_day: -0.0372), # 大寒(だいかん)
|
58
|
+
risshun: Row.new(stack: +138.0, per_term: +2.3181, per_day: +0.0372), # 立春(りっしゅん)
|
59
|
+
usui: Row.new(stack: +176.0, per_term: +2.8636, per_day: +0.0372), # 雨水(うすい)
|
60
|
+
keichitsu: Row.new(stack: +222.0, per_term: +3.4091, per_day: +0.0372), # 啓蟄(けいちつ)
|
61
|
+
shunbun: Row.new(stack: +276.0, per_term: -3.7220, per_day: +0.0329), # 春分(しゅんぶん)
|
62
|
+
seimei: Row.new(stack: +222.0, per_term: -3.2086, per_day: +0.0329), # 清明(せいめい)
|
63
|
+
kokuu: Row.new(stack: +176.0, per_term: -2.6952, per_day: +0.0329), # 穀雨(こくう)
|
64
|
+
rikka: Row.new(stack: +138.0, per_term: -2.1818, per_day: -0.0329), # 立夏(りっか)
|
65
|
+
shouman: Row.new(stack: +100.0, per_term: -2.6952, per_day: -0.0329), # 小満(しょうまん)
|
66
|
+
boushu: Row.new(stack: +54.0, per_term: -3.2086, per_day: -0.0329), # 芒種(ぼうしゅ)
|
67
|
+
geshi: Row.new(stack: 0.0, per_term: -3.7220, per_day: +0.0329), # 夏至(げし)
|
68
|
+
shousho: Row.new(stack: -54.0, per_term: -3.2086, per_day: +0.0329), # 小暑(しょうしょ)
|
69
|
+
taisho: Row.new(stack: -100.0, per_term: -2.6952, per_day: +0.0329), # 大暑(たいしょ)
|
70
|
+
risshuu: Row.new(stack: -138.0, per_term: -2.1818, per_day: -0.0329), # 立秋(りっしゅう)
|
71
|
+
shosho: Row.new(stack: -176.0, per_term: -2.6952, per_day: -0.0329), # 処暑(しょしょ)
|
72
|
+
hakuro: Row.new(stack: -222.0, per_term: -3.2086, per_day: -0.0329), # 白露(はくろ)
|
73
|
+
shuubun: Row.new(stack: -276.0, per_term: +3.9546, per_day: -0.0372), # 秋分(しゅうぶん)
|
74
|
+
kanro: Row.new(stack: -222.0, per_term: +3.4091, per_day: -0.0372), # 寒露(かんろ)
|
75
|
+
soukou: Row.new(stack: -176.0, per_term: +2.8636, per_day: -0.0372), # 霜降(そうこう)
|
76
|
+
rittou: Row.new(stack: -138.0, per_term: +2.3181, per_day: +0.0372), # 立冬(りっとう)
|
77
|
+
shousetsu: Row.new(stack: -100.0, per_term: +2.8636, per_day: +0.0372), # 小雪(しょうせつ)
|
78
|
+
taisetsu: Row.new(stack: -54.0, per_term: +3.4091, per_day: +0.0372) # 大雪(たいせつ)
|
79
|
+
}.freeze
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|