zakuro 0.9.4 → 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 +5 -5
- 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/era/gengou/abstract_scroll.rb +2 -2
- data/lib/zakuro/calculation/era/gengou/internal/publisher.rb +1 -1
- data/lib/zakuro/calculation/era/gengou/internal/reserve/abstract_list.rb +4 -4
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +3 -3
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +1 -1
- 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 +30 -125
- data/lib/zakuro/calculation/monthly/operated_month.rb +5 -2
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +0 -2
- 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/single.rb +0 -2
- 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 +5 -3
- 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 +3 -3
- 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 +5 -5
- 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 +2 -4
- 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 +44 -20
- data/lib/zakuro/condition.rb +0 -306
- data/lib/zakuro/era/japan/gengou/resource/type.rb +0 -356
- data/lib/zakuro/tools/gengou_range_comparer.rb +0 -82
- /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
@@ -15,88 +15,91 @@ require_relative '../stella/origin/average_november'
|
|
15
15
|
# :nodoc:
|
16
16
|
module Zakuro
|
17
17
|
# :nodoc:
|
18
|
-
module
|
18
|
+
module Version
|
19
19
|
# :nodoc:
|
20
|
-
module
|
21
|
-
#
|
22
|
-
|
23
|
-
#
|
24
|
-
class LunarPhase < Calculation::Monthly::AbstractLunarPhase
|
25
|
-
# @return [Cycle::Remainder] 弦
|
26
|
-
QUARTER = Const::Remainder::Solar::QUARTER
|
27
|
-
|
28
|
-
#
|
29
|
-
# 初期化
|
20
|
+
module Gihou
|
21
|
+
# :nodoc:
|
22
|
+
module Monthly
|
30
23
|
#
|
31
|
-
#
|
24
|
+
# LunarPhase 月の位相
|
32
25
|
#
|
33
|
-
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
50
|
+
private
|
49
51
|
|
50
|
-
|
52
|
+
# :reek:TooManyStatements { max_statements: 6 }
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
69
|
+
debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
+
adjusted
|
72
|
+
end
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
83
|
-
|
84
|
+
Solar::Value.get(solar_location: solar_location)
|
85
|
+
end
|
84
86
|
|
85
|
-
|
87
|
+
# :reek:TooManyStatements { max_statements: 6 }
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
#
|
90
|
+
# 月運動の補正値を得る
|
91
|
+
#
|
92
|
+
# @return [Integer] 月運動の補正値
|
93
|
+
#
|
94
|
+
def correction_moon_value
|
95
|
+
lunar_location.run
|
94
96
|
|
95
|
-
|
97
|
+
remainder = lunar_location.adjusted_remainder
|
96
98
|
|
97
|
-
|
99
|
+
debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
|
98
100
|
|
99
|
-
|
101
|
+
Lunar::Value.get(remainder: remainder)
|
102
|
+
end
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
@@ -9,20 +9,23 @@ require_relative '../../cycle/remainder'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Version
|
13
13
|
# :nodoc:
|
14
|
-
module
|
14
|
+
module Gihou
|
15
15
|
# :nodoc:
|
16
|
-
module
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
16
|
+
module Option
|
17
|
+
# :nodoc:
|
18
|
+
module DroppedDate
|
21
19
|
#
|
22
|
-
#
|
20
|
+
# Parameter 引数
|
23
21
|
#
|
24
|
-
|
25
|
-
|
22
|
+
class Parameter < Calculation::Option::DroppedDate::AbstractParameter
|
23
|
+
#
|
24
|
+
# 初期化
|
25
|
+
#
|
26
|
+
def initialize
|
27
|
+
super(valid: false)
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -9,20 +9,23 @@ require_relative '../../cycle/remainder'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Version
|
13
13
|
# :nodoc:
|
14
|
-
module
|
14
|
+
module Gihou
|
15
15
|
# :nodoc:
|
16
|
-
module
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
16
|
+
module Option
|
17
|
+
# :nodoc:
|
18
|
+
module VanishedDate
|
21
19
|
#
|
22
|
-
#
|
20
|
+
# Parameter 引数
|
23
21
|
#
|
24
|
-
|
25
|
-
|
22
|
+
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
23
|
+
#
|
24
|
+
# 初期化
|
25
|
+
#
|
26
|
+
def initialize
|
27
|
+
super(valid: false)
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -7,32 +7,35 @@ require_relative '../stella/solar/average'
|
|
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
|
-
|
12
|
+
module Gihou
|
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
|
-
|
34
|
-
|
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
|