zakuro 0.8.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -160
- data/VERSION +1 -1
- data/doc/condition.md +36 -0
- data/doc/dropped_date.md +41 -0
- data/doc/expection.md +108 -0
- data/doc/operation/csv/month.csv +100 -79
- data/doc/operation/operation.xlsx +0 -0
- data/doc/usage.md +120 -0
- data/doc/vanished_date.md +86 -0
- data/doc/version/daien.md +163 -0
- data/doc/version/genka.md +116 -0
- data/doc/version/gihou.md +172 -0
- data/doc/version/section/common_post_process.md +60 -0
- data/doc/version/section/common_pre_process.md +185 -0
- data/doc/version/section/const.md +45 -0
- data/doc/version/section/decimal.md +101 -0
- data/doc/version/section/lunisolar_calendar.md +55 -0
- data/doc/version/section/senmyou_november_1st.md +41 -0
- data/{lib/zakuro/version/senmyou/README.md → doc/version/senmyou.md} +15 -168
- data/lib/zakuro/calculation/cycle/abstract_remainder.rb +58 -0
- data/lib/zakuro/calculation/monthly/first_day.rb +9 -1
- data/lib/zakuro/calculation/option/vanished_date/abstract_parameter.rb +40 -0
- data/lib/zakuro/calculation/option/vanished_date/location.rb +84 -0
- data/lib/zakuro/calculation/range/medieval_annual_range.rb +5 -3
- data/lib/zakuro/calculation/range/transfer/gengou_scroller.rb +1 -0
- data/lib/zakuro/calculation/stella/lunar/abstract_location.rb +6 -2
- data/lib/zakuro/calculation/stella/lunar/choukei_value.rb +14 -0
- data/lib/zakuro/calculation/summary/internal/option.rb +59 -4
- data/lib/zakuro/context/option.rb +17 -0
- data/lib/zakuro/context/version_class_resolver.rb +17 -1
- data/lib/zakuro/operation/yaml/month.yaml +955 -281
- data/lib/zakuro/result/data/option/vanished_date/calculation.rb +45 -0
- data/lib/zakuro/result/data/option/vanished_date/option.rb +47 -0
- data/lib/zakuro/result/data/single_day.rb +2 -0
- data/lib/zakuro/version/daien/const/number.rb +2 -0
- data/lib/zakuro/version/daien/const/remainder.rb +7 -2
- data/lib/zakuro/version/daien/cycle/remainder.rb +38 -20
- data/lib/zakuro/version/daien/monthly/lunar_phase.rb +2 -4
- data/lib/zakuro/version/daien/option/dropped_date/parameter.rb +5 -3
- data/lib/zakuro/version/daien/option/vanished_date/parameter.rb +33 -0
- data/lib/zakuro/version/daien/stella/lunar/location.rb +5 -8
- data/lib/zakuro/version/genka/cycle/remainder.rb +6 -2
- data/lib/zakuro/version/genka/monthly/lunar_phase.rb +14 -3
- data/lib/zakuro/version/genka/option/vanished_date/parameter.rb +31 -0
- data/lib/zakuro/version/gihou/const/remainder.rb +1 -5
- data/lib/zakuro/version/gihou/cycle/remainder.rb +0 -26
- data/lib/zakuro/version/gihou/monthly/lunar_phase.rb +2 -4
- data/lib/zakuro/version/gihou/option/vanished_date/parameter.rb +31 -0
- data/lib/zakuro/version/gihou/stella/lunar/location.rb +5 -8
- data/lib/zakuro/version/senmyou/const/number.rb +3 -1
- data/lib/zakuro/version/senmyou/const/remainder.rb +3 -0
- data/lib/zakuro/version/senmyou/cycle/remainder.rb +17 -34
- data/lib/zakuro/version/senmyou/monthly/lunar_phase.rb +5 -5
- data/lib/zakuro/version/senmyou/option/vanished_date/parameter.rb +33 -0
- data/lib/zakuro/version/senmyou/stella/lunar/location.rb +6 -8
- data/lib/zakuro/version/senmyou/stella/lunar/value.rb +9 -0
- metadata +24 -3
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :nodoc:
|
4
|
+
module Zakuro
|
5
|
+
#
|
6
|
+
# Result 演算結果
|
7
|
+
#
|
8
|
+
module Result
|
9
|
+
#
|
10
|
+
# データ部
|
11
|
+
#
|
12
|
+
module Data
|
13
|
+
#
|
14
|
+
# Option オプション
|
15
|
+
#
|
16
|
+
module Option
|
17
|
+
#
|
18
|
+
# VanishedDate 滅日
|
19
|
+
#
|
20
|
+
module VanishedDate
|
21
|
+
#
|
22
|
+
# Calculation 演算値
|
23
|
+
#
|
24
|
+
class Calculation
|
25
|
+
# @return [String] 大余小余(滅余)
|
26
|
+
attr_reader :remainder
|
27
|
+
# @return [String] 経朔
|
28
|
+
attr_reader :average_remainder
|
29
|
+
|
30
|
+
#
|
31
|
+
# 初期化
|
32
|
+
#
|
33
|
+
# @param [String] remainder 大余小余(滅余)
|
34
|
+
# @param [String] average_remainder 経朔
|
35
|
+
#
|
36
|
+
def initialize(remainder: '', average_remainder: '')
|
37
|
+
@remainder = remainder
|
38
|
+
@average_remainder = average_remainder
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../abstract_option'
|
4
|
+
|
5
|
+
require_relative './calculation'
|
6
|
+
|
7
|
+
# :nodoc:
|
8
|
+
module Zakuro
|
9
|
+
#
|
10
|
+
# Result 演算結果
|
11
|
+
#
|
12
|
+
module Result
|
13
|
+
#
|
14
|
+
# データ部
|
15
|
+
#
|
16
|
+
module Data
|
17
|
+
#
|
18
|
+
# Option オプション
|
19
|
+
#
|
20
|
+
module Option
|
21
|
+
#
|
22
|
+
# VanishedDate 滅日
|
23
|
+
#
|
24
|
+
module VanishedDate
|
25
|
+
#
|
26
|
+
# Option 滅日集約
|
27
|
+
#
|
28
|
+
class Option < AbstractOption
|
29
|
+
# @return [Calculation] 演算値
|
30
|
+
attr_reader :calculation
|
31
|
+
|
32
|
+
#
|
33
|
+
# 初期化
|
34
|
+
#
|
35
|
+
# @param [True, False] matched オプション値有無
|
36
|
+
# @param [Calculation] calculation 演算値
|
37
|
+
#
|
38
|
+
def initialize(matched: false, calculation: Calculation.new)
|
39
|
+
super(matched: matched)
|
40
|
+
@calculation = calculation
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -29,6 +29,12 @@ module Zakuro
|
|
29
29
|
#
|
30
30
|
# @return [Cycle::Remainder] 弦(1分=80秒)
|
31
31
|
QUARTER = Cycle::Remainder.new(day: 7, minute: 1163, second: 6)
|
32
|
+
|
33
|
+
# @return [Cycle::Remainder] 有没判定
|
34
|
+
DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 2375, second: 17)
|
35
|
+
|
36
|
+
# @return [Cycle::Remainder] 有滅判定
|
37
|
+
VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 1427, second: 0)
|
32
38
|
end
|
33
39
|
|
34
40
|
#
|
@@ -44,8 +50,7 @@ module Zakuro
|
|
44
50
|
# * 0.25 * 80(1分=80秒) = 20
|
45
51
|
#
|
46
52
|
# @return [Cycle::LunarRemainder] 弦(1分=80秒)
|
47
|
-
|
48
|
-
QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20.01247)
|
53
|
+
QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 1163, second: 20)
|
49
54
|
end
|
50
55
|
end
|
51
56
|
end
|
@@ -32,19 +32,6 @@ module Zakuro
|
|
32
32
|
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
33
33
|
day: day, minute: minute, second: second, total: total)
|
34
34
|
end
|
35
|
-
|
36
|
-
#
|
37
|
-
# 特定の文字フォーマットにして出力する
|
38
|
-
#
|
39
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
40
|
-
#
|
41
|
-
# @return [String] フォーマットした結果
|
42
|
-
#
|
43
|
-
def format(form: '%d-%d')
|
44
|
-
return '' if invalid?
|
45
|
-
|
46
|
-
super(form, @day, @minute, @second)
|
47
|
-
end
|
48
35
|
end
|
49
36
|
|
50
37
|
#
|
@@ -66,18 +53,49 @@ module Zakuro
|
|
66
53
|
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
67
54
|
day: day, minute: minute, second: second, total: total)
|
68
55
|
end
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# DroppedRemainder 没日の計算向け時刻情報(没余)
|
60
|
+
#
|
61
|
+
class DroppedRemainder < Calculation::Cycle::AbstractRemainder
|
62
|
+
# @return [Integer] 分(1分=24秒)
|
63
|
+
MINUTE = 24
|
69
64
|
|
70
65
|
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
66
|
+
# 初期化
|
74
67
|
#
|
75
|
-
# @
|
68
|
+
# @param [Integer] day 大余("日"に相当)
|
69
|
+
# @param [Integer] minute 小余("分"に相当)
|
70
|
+
# @param [Integer] second 秒
|
71
|
+
# @param [Integer] total 繰り上げなしの小余
|
76
72
|
#
|
77
|
-
def
|
78
|
-
|
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
|
79
|
+
|
80
|
+
#
|
81
|
+
# VanishedRemainder 滅日の計算向け時刻情報(滅余)
|
82
|
+
#
|
83
|
+
class VanishedRemainder < Calculation::Cycle::AbstractRemainder
|
84
|
+
# @return [Integer] 分(1分=24秒)
|
85
|
+
MINUTE = 24
|
79
86
|
|
80
|
-
|
87
|
+
#
|
88
|
+
# 初期化
|
89
|
+
#
|
90
|
+
# @param [Integer] day 大余("日"に相当)
|
91
|
+
# @param [Integer] minute 小余("分"に相当)
|
92
|
+
# @param [Integer] second 秒
|
93
|
+
# @param [Integer] total 繰り上げなしの小余
|
94
|
+
#
|
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)
|
81
99
|
end
|
82
100
|
end
|
83
101
|
end
|
@@ -64,7 +64,7 @@ module Zakuro
|
|
64
64
|
# NOTE: 大衍暦では進朔しない
|
65
65
|
# adjusted.up_on_new_moon!
|
66
66
|
|
67
|
-
debug("result: #{adjusted.format}")
|
67
|
+
debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
|
68
68
|
|
69
69
|
adjusted
|
70
70
|
end
|
@@ -92,9 +92,7 @@ module Zakuro
|
|
92
92
|
|
93
93
|
remainder = lunar_location.adjusted_remainder
|
94
94
|
|
95
|
-
|
96
|
-
# debug("[lunar]remainder.day: #{remainder.day}")
|
97
|
-
# debug("[lunar]remainder.minute: #{remainder.minute}")
|
95
|
+
debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
|
98
96
|
|
99
97
|
Lunar::Value.get(remainder: remainder)
|
100
98
|
end
|
@@ -9,9 +9,9 @@ require_relative '../../cycle/remainder'
|
|
9
9
|
# :nodoc:
|
10
10
|
module Zakuro
|
11
11
|
# :nodoc:
|
12
|
-
module
|
12
|
+
module Daien
|
13
13
|
# :nodoc:
|
14
|
-
module
|
14
|
+
module Option
|
15
15
|
# :nodoc:
|
16
16
|
module DroppedDate
|
17
17
|
#
|
@@ -22,7 +22,9 @@ module Zakuro
|
|
22
22
|
# 初期化
|
23
23
|
#
|
24
24
|
def initialize
|
25
|
-
super(valid:
|
25
|
+
super(valid: true, year: Const::Number::Cycle::YEAR,
|
26
|
+
limit: Const::Remainder::Solar::DROPPED_DATE_LIMIT,
|
27
|
+
remainder_class: Cycle::DroppedRemainder)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/vanished_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Daien
|
13
|
+
# :nodoc:
|
14
|
+
module Option
|
15
|
+
# :nodoc:
|
16
|
+
module VanishedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: true,
|
26
|
+
limit: Const::Remainder::Solar::VANISHED_DATE_LIMIT,
|
27
|
+
remainder_class: Cycle::VanishedRemainder)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -28,7 +28,11 @@ module Zakuro
|
|
28
28
|
# @param [Integer] western_year 西暦年
|
29
29
|
#
|
30
30
|
def initialize(lunar_age:, western_year:)
|
31
|
-
super(
|
31
|
+
super(
|
32
|
+
lunar_age: lunar_age,
|
33
|
+
quarter: QUARTER,
|
34
|
+
western_year: western_year
|
35
|
+
)
|
32
36
|
end
|
33
37
|
|
34
38
|
#
|
@@ -43,13 +47,6 @@ module Zakuro
|
|
43
47
|
first
|
44
48
|
end
|
45
49
|
|
46
|
-
#
|
47
|
-
# 弦の分だけ月地点を進める
|
48
|
-
#
|
49
|
-
def add_quarter
|
50
|
-
remainder.add!(QUARTER)
|
51
|
-
end
|
52
|
-
|
53
50
|
private
|
54
51
|
|
55
52
|
#
|
@@ -43,7 +43,9 @@ module Zakuro
|
|
43
43
|
return '' if invalid?
|
44
44
|
|
45
45
|
decimal = day + minute / base_day.to_f
|
46
|
-
|
46
|
+
|
47
|
+
# NOTE: 親クラスを迂回する
|
48
|
+
Kernel.instance_method(:format).bind(self).call(form, decimal.round(digit))
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
@@ -84,7 +86,9 @@ module Zakuro
|
|
84
86
|
# 具体的には、468年の中気は '55.7813' だが '55.7812' になる
|
85
87
|
# これは '55.7812500' を4桁にした際に、境界値の少数点以下5桁目の '5' が切り捨てを受けたためである
|
86
88
|
# format による四捨五入は避け、roundによる四捨五入を採用する
|
87
|
-
|
89
|
+
|
90
|
+
# NOTE: 親クラスを迂回する
|
91
|
+
Kernel.instance_method(:format).bind(self).call(form, decimal.round(digit))
|
88
92
|
end
|
89
93
|
end
|
90
94
|
end
|
@@ -47,7 +47,7 @@ module Zakuro
|
|
47
47
|
#
|
48
48
|
# 次の弦に進める
|
49
49
|
#
|
50
|
-
# @return [Remainder]
|
50
|
+
# @return [Remainder] 経朔
|
51
51
|
#
|
52
52
|
def next_phase
|
53
53
|
adjusted = remainder.clone
|
@@ -59,9 +59,9 @@ module Zakuro
|
|
59
59
|
|
60
60
|
#
|
61
61
|
# 次の月に進める
|
62
|
-
# @note
|
62
|
+
# @note 進めた後の月の経朔ではなく、当月のものを返却する
|
63
63
|
#
|
64
|
-
# @return [Remainder]
|
64
|
+
# @return [Remainder] 当月初の経朔
|
65
65
|
#
|
66
66
|
def next_month
|
67
67
|
result = nil
|
@@ -73,6 +73,17 @@ module Zakuro
|
|
73
73
|
result
|
74
74
|
end
|
75
75
|
|
76
|
+
#
|
77
|
+
# 経朔を返す
|
78
|
+
#
|
79
|
+
# 元嘉暦には経朔しかないが他の暦と揃える
|
80
|
+
#
|
81
|
+
# @return [Remainder] 経朔
|
82
|
+
#
|
83
|
+
def average_remainder
|
84
|
+
@remainder
|
85
|
+
end
|
86
|
+
|
76
87
|
private
|
77
88
|
|
78
89
|
#
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/vanished_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Genka
|
13
|
+
# :nodoc:
|
14
|
+
module Option
|
15
|
+
# :nodoc:
|
16
|
+
module VanishedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -42,11 +42,7 @@ module Zakuro
|
|
42
42
|
# * 0.75 * 12(1分=12秒) = 9
|
43
43
|
#
|
44
44
|
# @return [Cycle::LunarRemainder] 弦(1分=12秒)
|
45
|
-
|
46
|
-
# QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9)
|
47
|
-
# QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9.00378)
|
48
|
-
# QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9.0208)
|
49
|
-
QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9.00378)
|
45
|
+
QUARTER = Cycle::LunarRemainder.new(day: 7, minute: 512, second: 9)
|
50
46
|
end
|
51
47
|
end
|
52
48
|
end
|
@@ -29,19 +29,6 @@ module Zakuro
|
|
29
29
|
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
30
30
|
day: day, minute: minute, second: second, total: total)
|
31
31
|
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# 特定の文字フォーマットにして出力する
|
35
|
-
#
|
36
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
37
|
-
#
|
38
|
-
# @return [String] フォーマットした結果
|
39
|
-
#
|
40
|
-
def format(form: '%d-%d')
|
41
|
-
return '' if invalid?
|
42
|
-
|
43
|
-
super(form, @day, @minute, @second)
|
44
|
-
end
|
45
32
|
end
|
46
33
|
|
47
34
|
#
|
@@ -63,19 +50,6 @@ module Zakuro
|
|
63
50
|
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
64
51
|
day: day, minute: minute, second: second, total: total)
|
65
52
|
end
|
66
|
-
|
67
|
-
#
|
68
|
-
# 特定の文字フォーマットにして出力する
|
69
|
-
#
|
70
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
71
|
-
#
|
72
|
-
# @return [String] フォーマットした結果
|
73
|
-
#
|
74
|
-
def format(form: '%d-%d')
|
75
|
-
return '' if invalid?
|
76
|
-
|
77
|
-
super(form, @day, @minute, @second)
|
78
|
-
end
|
79
53
|
end
|
80
54
|
end
|
81
55
|
end
|
@@ -64,7 +64,7 @@ module Zakuro
|
|
64
64
|
# NOTE: 儀鳳暦では進朔しない
|
65
65
|
# adjusted.up_on_new_moon!
|
66
66
|
|
67
|
-
debug("result: #{adjusted.format}")
|
67
|
+
debug("result: #{adjusted.format(form: '%d-%d.%.5f')}")
|
68
68
|
|
69
69
|
adjusted
|
70
70
|
end
|
@@ -94,9 +94,7 @@ module Zakuro
|
|
94
94
|
|
95
95
|
remainder = lunar_location.adjusted_remainder
|
96
96
|
|
97
|
-
|
98
|
-
# debug("[lunar]remainder.day: #{remainder.day}")
|
99
|
-
# debug("[lunar]remainder.minute: #{remainder.minute}")
|
97
|
+
debug("[lunar]remainder.format: #{remainder.format(form: '%d-%d-%.5f')}")
|
100
98
|
|
101
99
|
Lunar::Value.get(remainder: remainder)
|
102
100
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../calculation/option/vanished_date/abstract_parameter'
|
4
|
+
|
5
|
+
require_relative '../../const/number'
|
6
|
+
require_relative '../../const/remainder'
|
7
|
+
require_relative '../../cycle/remainder'
|
8
|
+
|
9
|
+
# :nodoc:
|
10
|
+
module Zakuro
|
11
|
+
# :nodoc:
|
12
|
+
module Gihou
|
13
|
+
# :nodoc:
|
14
|
+
module Option
|
15
|
+
# :nodoc:
|
16
|
+
module VanishedDate
|
17
|
+
#
|
18
|
+
# Parameter 引数
|
19
|
+
#
|
20
|
+
class Parameter < Calculation::Option::VanishedDate::AbstractParameter
|
21
|
+
#
|
22
|
+
# 初期化
|
23
|
+
#
|
24
|
+
def initialize
|
25
|
+
super(valid: false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -28,7 +28,11 @@ module Zakuro
|
|
28
28
|
# @param [Integer] western_year 西暦年
|
29
29
|
#
|
30
30
|
def initialize(lunar_age:, western_year:)
|
31
|
-
super(
|
31
|
+
super(
|
32
|
+
lunar_age: lunar_age,
|
33
|
+
quarter: QUARTER,
|
34
|
+
western_year: western_year
|
35
|
+
)
|
32
36
|
end
|
33
37
|
|
34
38
|
#
|
@@ -43,13 +47,6 @@ module Zakuro
|
|
43
47
|
first
|
44
48
|
end
|
45
49
|
|
46
|
-
#
|
47
|
-
# 弦の分だけ月地点を進める
|
48
|
-
#
|
49
|
-
def add_quarter
|
50
|
-
remainder.add!(QUARTER)
|
51
|
-
end
|
52
|
-
|
53
50
|
private
|
54
51
|
|
55
52
|
#
|
@@ -30,10 +30,12 @@ module Zakuro
|
|
30
30
|
# Derivation 導出
|
31
31
|
#
|
32
32
|
module Derivation
|
33
|
-
# @return [Integer] 通余:
|
33
|
+
# @return [Integer] 通余: (YEAR - DAY * 12 * 30) = 44055
|
34
34
|
REMAINDER_ALL_YEAR = 44_055
|
35
35
|
# @return [Integer] 旬周(60日) DAY * 60
|
36
36
|
SIXTY_DAYS = 504_000
|
37
|
+
# @return [Integer] 朔虚分: (30 * 8400) % 248057
|
38
|
+
REMAINDER_IDEAL_MONTH = 3943
|
37
39
|
end
|
38
40
|
|
39
41
|
#
|
@@ -30,6 +30,9 @@ module Zakuro
|
|
30
30
|
# * 中盈(小余3671秒2)/ 2 = 小余1835秒5
|
31
31
|
# * 日(小余8400) - 小余1835秒5 = 小余6564秒3
|
32
32
|
DROPPED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 6564, second: 3)
|
33
|
+
|
34
|
+
# @return [Cycle::Remainder] 有滅判定
|
35
|
+
VANISHED_DATE_LIMIT = Cycle::Remainder.new(day: 0, minute: 3943, second: 0)
|
33
36
|
end
|
34
37
|
|
35
38
|
#
|
@@ -29,19 +29,6 @@ module Zakuro
|
|
29
29
|
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
30
30
|
day: day, minute: minute, second: second, total: total)
|
31
31
|
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# 特定の文字フォーマットにして出力する
|
35
|
-
#
|
36
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
37
|
-
#
|
38
|
-
# @return [String] フォーマットした結果
|
39
|
-
#
|
40
|
-
def format(form: '%d-%d')
|
41
|
-
return '' if invalid?
|
42
|
-
|
43
|
-
super(form, @day, @minute, @second)
|
44
|
-
end
|
45
32
|
end
|
46
33
|
|
47
34
|
#
|
@@ -63,19 +50,6 @@ module Zakuro
|
|
63
50
|
super(base_day: Const::Number::Cycle::DAY, base_minute: MINUTE,
|
64
51
|
day: day, minute: minute, second: second, total: total)
|
65
52
|
end
|
66
|
-
|
67
|
-
#
|
68
|
-
# 特定の文字フォーマットにして出力する
|
69
|
-
#
|
70
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
71
|
-
#
|
72
|
-
# @return [String] フォーマットした結果
|
73
|
-
#
|
74
|
-
def format(form: '%d-%d')
|
75
|
-
return '' if invalid?
|
76
|
-
|
77
|
-
super(form, @day, @minute, @second)
|
78
|
-
end
|
79
53
|
end
|
80
54
|
|
81
55
|
#
|
@@ -98,18 +72,27 @@ module Zakuro
|
|
98
72
|
super(base_day: Const::Number::Derivation::REMAINDER_ALL_YEAR, base_minute: MINUTE,
|
99
73
|
day: day, minute: minute, second: second, total: total)
|
100
74
|
end
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# VanishedRemainder 滅日の計算向け時刻情報(滅余)
|
79
|
+
#
|
80
|
+
class VanishedRemainder < Calculation::Cycle::AbstractRemainder
|
81
|
+
# @return [Integer] 分(1分=8秒)
|
82
|
+
MINUTE = 8
|
101
83
|
|
102
84
|
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
# @param [String] form フォーマット(大余、小余、秒それぞれを%dで指定する)
|
85
|
+
# 初期化
|
106
86
|
#
|
107
|
-
# @
|
87
|
+
# @param [Integer] day 大余("日"に相当)
|
88
|
+
# @param [Integer] minute 小余("分"に相当)
|
89
|
+
# @param [Integer] second 秒
|
90
|
+
# @param [Integer] total 繰り上げなしの小余
|
108
91
|
#
|
109
|
-
def
|
110
|
-
|
111
|
-
|
112
|
-
|
92
|
+
def initialize(day: -1, minute: -1, second: -1, total: -1)
|
93
|
+
# 小余 = 朔虚分
|
94
|
+
super(base_day: Const::Number::Derivation::REMAINDER_IDEAL_MONTH, base_minute: MINUTE,
|
95
|
+
day: day, minute: minute, second: second, total: total)
|
113
96
|
end
|
114
97
|
end
|
115
98
|
end
|