zakuro 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +3 -0
- data/README.md +6 -4
- data/VERSION +1 -1
- data/doc/operation/transfer.rb +8 -8
- data/lib/zakuro/calculation/base/gengou.rb +46 -0
- data/lib/zakuro/calculation/era/gengou/{scroll.rb → abstract_scroll.rb} +6 -8
- data/lib/zakuro/calculation/era/gengou/dated_scroll.rb +30 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/{list.rb → abstract_list.rb} +37 -51
- data/lib/zakuro/calculation/era/gengou/internal/reserve/{range.rb → abstract_range.rb} +17 -17
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_list.rb +48 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/dated_range.rb +30 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/empty_link.rb +158 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_list.rb +125 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve/named_range.rb +75 -0
- data/lib/zakuro/calculation/era/gengou/internal/reserve.rb +2 -3
- data/lib/zakuro/calculation/era/gengou/named_scroll.rb +30 -0
- data/lib/zakuro/calculation/monthly/month.rb +39 -0
- data/lib/zakuro/calculation/monthly/operated_month.rb +1 -1
- data/lib/zakuro/calculation/range/{full_range.rb → abstract_full_range.rb} +5 -4
- data/lib/zakuro/calculation/range/{operated_range.rb → abstract_operation_range.rb} +9 -11
- data/lib/zakuro/calculation/range/dated_full_range.rb +32 -0
- data/lib/zakuro/calculation/range/dated_operation_range.rb +33 -0
- data/lib/zakuro/calculation/range/named_full_range.rb +38 -0
- data/lib/zakuro/calculation/range/named_operation_range.rb +36 -0
- data/lib/zakuro/calculation/range/operated_solar_terms.rb +0 -2
- data/lib/zakuro/calculation/{specifier → summary}/internal/month.rb +1 -1
- data/lib/zakuro/calculation/summary/japan/range.rb +152 -0
- data/lib/zakuro/calculation/summary/japan/single.rb +118 -0
- data/lib/zakuro/calculation/summary/japan/specifier/single_day.rb +91 -0
- data/lib/zakuro/calculation/summary/western/range.rb +124 -0
- data/lib/zakuro/calculation/summary/western/single.rb +113 -0
- data/lib/zakuro/calculation/summary/western/specifier/multiple_day.rb +169 -0
- data/lib/zakuro/calculation/summary/western/specifier/single_day.rb +93 -0
- data/lib/zakuro/condition.rb +1 -2
- data/lib/zakuro/era/japan/gengou/alignment/aligner.rb +89 -74
- data/lib/zakuro/era/japan/gengou/alignment/division.rb +125 -122
- data/lib/zakuro/era/japan/gengou/alignment/line.rb +141 -122
- data/lib/zakuro/era/japan/gengou/alignment/linear_gengou.rb +171 -168
- data/lib/zakuro/era/japan/gengou/alignment.rb +38 -25
- data/lib/zakuro/era/japan/gengou/resource/parser.rb +183 -182
- data/lib/zakuro/era/japan/gengou/resource/type.rb +233 -232
- data/lib/zakuro/era/japan/gengou/resource/validator.rb +255 -254
- data/lib/zakuro/era/japan/gengou/resource.rb +23 -22
- data/lib/zakuro/era/japan/gengou.rb +5 -20
- data/lib/zakuro/era/western/calendar.rb +9 -9
- data/lib/zakuro/exception/case/pattern.rb +35 -0
- data/lib/zakuro/exception/case/preset.rb +51 -0
- data/lib/zakuro/exception/case/template.rb +48 -0
- data/lib/zakuro/exception/cause.rb +28 -0
- data/lib/zakuro/exception/exception.rb +37 -0
- data/lib/zakuro/exception/zakuro_error.rb +28 -0
- data/lib/zakuro/gateway/locale/date.rb +127 -0
- data/lib/zakuro/gateway/locale/range.rb +67 -0
- data/lib/zakuro/gateway/range.rb +99 -0
- data/lib/zakuro/gateway/single.rb +70 -0
- data/lib/zakuro/merchant.rb +8 -44
- data/lib/zakuro/operation/month/parser.rb +9 -9
- data/lib/zakuro/operation/month/type.rb +31 -31
- data/lib/zakuro/operation/month/validator.rb +49 -49
- data/lib/zakuro/operation/yaml/month.yaml +3736 -3736
- data/lib/zakuro/output/logger.rb +17 -3
- data/lib/zakuro/result/data/day.rb +43 -0
- data/lib/zakuro/result/data/gengou.rb +35 -0
- data/lib/zakuro/result/data/month.rb +63 -0
- data/lib/zakuro/result/data/single_day.rb +48 -0
- data/lib/zakuro/result/data/solar_term.rb +35 -0
- data/lib/zakuro/result/data/year.rb +45 -0
- data/lib/zakuro/result/operation/month/annotation.rb +40 -0
- data/lib/zakuro/result/operation/month/bundle.rb +36 -0
- data/lib/zakuro/result/operation/month/history.rb +54 -0
- data/lib/zakuro/result/operation/operation.rb +44 -0
- data/lib/zakuro/result/result.rb +4 -2
- metadata +46 -14
- data/lib/zakuro/calculation/specifier/multiple_day.rb +0 -162
- data/lib/zakuro/calculation/specifier/single_day.rb +0 -87
- data/lib/zakuro/calculation/summary/range.rb +0 -120
- data/lib/zakuro/calculation/summary/single.rb +0 -110
- data/lib/zakuro/result/data.rb +0 -187
- data/lib/zakuro/result/operation.rb +0 -114
@@ -7,158 +7,161 @@ module Zakuro
|
|
7
7
|
# :nodoc:
|
8
8
|
module Japan
|
9
9
|
# :nodoc:
|
10
|
-
module
|
11
|
-
#
|
12
|
-
|
13
|
-
#
|
14
|
-
module Division
|
10
|
+
module Gengou
|
11
|
+
# :nodoc:
|
12
|
+
module Alignment
|
15
13
|
#
|
16
|
-
#
|
14
|
+
# Division 元号区分
|
17
15
|
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
if other.covered?(start_date: this.start_date, last_date: this.last_date)
|
36
|
-
# 範囲内のみ返す
|
37
|
-
result.push(trim_gengou(this: this, other: other))
|
38
|
-
return result
|
39
|
-
end
|
16
|
+
module Division
|
17
|
+
#
|
18
|
+
# 重複した範囲を返す
|
19
|
+
#
|
20
|
+
# @param [LinearGengou] this 残り元号
|
21
|
+
# @param [LinearGengou] other 比較元号
|
22
|
+
#
|
23
|
+
# @return [Array<LinearGengou>] 重複分
|
24
|
+
#
|
25
|
+
def self.match(this:, other:)
|
26
|
+
result = []
|
27
|
+
if other.in?(start_date: this.start_date, last_date: this.last_date)
|
28
|
+
result.push(this)
|
29
|
+
return result
|
30
|
+
end
|
40
31
|
|
41
|
-
|
32
|
+
if other.out?(start_date: this.start_date, last_date: this.last_date)
|
33
|
+
# 該当なし
|
34
|
+
return result
|
35
|
+
end
|
42
36
|
|
43
|
-
|
44
|
-
|
37
|
+
if other.covered?(start_date: this.start_date, last_date: this.last_date)
|
38
|
+
# 範囲内のみ返す
|
39
|
+
result.push(trim_gengou(this: this, other: other))
|
40
|
+
return result
|
41
|
+
end
|
45
42
|
|
46
|
-
|
47
|
-
# 範囲が重複しない差分を返す
|
48
|
-
#
|
49
|
-
# @param [LinearGengou] this 積元号
|
50
|
-
# @param [LinearGengou] other 比較元号
|
51
|
-
#
|
52
|
-
# @return [Array<LinearGengou>] 差分
|
53
|
-
#
|
54
|
-
def self.mismatch(this:, other:)
|
55
|
-
result = []
|
56
|
-
if other.in?(start_date: this.start_date, last_date: this.last_date)
|
57
|
-
# 該当なし
|
58
|
-
return result
|
59
|
-
end
|
43
|
+
result.push(narrow_gengou(this: this, other: other))
|
60
44
|
|
61
|
-
|
62
|
-
result.push(this)
|
63
|
-
return result
|
45
|
+
result
|
64
46
|
end
|
65
47
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
48
|
+
#
|
49
|
+
# 範囲が重複しない差分を返す
|
50
|
+
#
|
51
|
+
# @param [LinearGengou] this 積元号
|
52
|
+
# @param [LinearGengou] other 比較元号
|
53
|
+
#
|
54
|
+
# @return [Array<LinearGengou>] 差分
|
55
|
+
#
|
56
|
+
def self.mismatch(this:, other:)
|
57
|
+
result = []
|
58
|
+
if other.in?(start_date: this.start_date, last_date: this.last_date)
|
59
|
+
# 該当なし
|
60
|
+
return result
|
61
|
+
end
|
70
62
|
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
if other.out?(start_date: this.start_date, last_date: this.last_date)
|
64
|
+
result.push(this)
|
65
|
+
return result
|
66
|
+
end
|
74
67
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
# @param [Array<LinearGengou>] list 元号
|
79
|
-
#
|
80
|
-
# @return [Array<LinearGengou>] 同一元号がつながった元号
|
81
|
-
#
|
82
|
-
def self.connect(list: []) # rubocop:disable Metrics/MethodLength
|
83
|
-
result = []
|
84
|
-
list.each do |linear_gengou|
|
85
|
-
if result.size.zero?
|
86
|
-
result.push(linear_gengou)
|
87
|
-
next
|
68
|
+
if other.covered?(start_date: this.start_date, last_date: this.last_date)
|
69
|
+
result |= split_gengou(this: this, other: other)
|
70
|
+
return result
|
88
71
|
end
|
89
72
|
|
90
|
-
|
73
|
+
result.push(shave_gengou(this: this, other: other))
|
74
|
+
result
|
75
|
+
end
|
91
76
|
|
92
|
-
|
93
|
-
|
94
|
-
|
77
|
+
#
|
78
|
+
# 比較により分離した元号をつなげる
|
79
|
+
#
|
80
|
+
# @param [Array<LinearGengou>] list 元号
|
81
|
+
#
|
82
|
+
# @return [Array<LinearGengou>] 同一元号がつながった元号
|
83
|
+
#
|
84
|
+
def self.connect(list: []) # rubocop:disable Metrics/MethodLength
|
85
|
+
result = []
|
86
|
+
list.each do |linear_gengou|
|
87
|
+
if result.size.zero?
|
88
|
+
result.push(linear_gengou)
|
89
|
+
next
|
90
|
+
end
|
91
|
+
|
92
|
+
before = result[-1]
|
93
|
+
|
94
|
+
if unconnectable?(current: linear_gengou, before: before)
|
95
|
+
result.push(linear_gengou)
|
96
|
+
next
|
97
|
+
end
|
98
|
+
|
99
|
+
result[-1] = LinearGengou.new(
|
100
|
+
start_date: before.start_date, last_date: linear_gengou.last_date,
|
101
|
+
gengou: linear_gengou.gengou
|
102
|
+
)
|
95
103
|
end
|
96
104
|
|
97
|
-
result
|
98
|
-
start_date: before.start_date, last_date: linear_gengou.last_date,
|
99
|
-
gengou: linear_gengou.gengou
|
100
|
-
)
|
105
|
+
result
|
101
106
|
end
|
102
107
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
def self.unconnectable?(current:, before:)
|
107
|
-
return true unless current.gengou.name == before.gengou.name
|
108
|
+
def self.unconnectable?(current:, before:)
|
109
|
+
return true unless current.gengou.name == before.gengou.name
|
108
110
|
|
109
|
-
|
111
|
+
return true unless (before.last_date.clone + 1) == current.start_date
|
110
112
|
|
111
|
-
|
112
|
-
|
113
|
-
|
113
|
+
false
|
114
|
+
end
|
115
|
+
private_class_method :unconnectable?
|
116
|
+
|
117
|
+
def self.split_gengou(this:, other:)
|
118
|
+
[
|
119
|
+
LinearGengou.new(
|
120
|
+
start_date: this.start_date.clone, last_date: other.start_date.clone - 1,
|
121
|
+
gengou: this.gengou
|
122
|
+
),
|
123
|
+
LinearGengou.new(
|
124
|
+
start_date: other.last_date.clone + 1, last_date: this.last_date.clone,
|
125
|
+
gengou: this.gengou
|
126
|
+
)
|
127
|
+
]
|
128
|
+
end
|
129
|
+
private_class_method :split_gengou
|
114
130
|
|
115
|
-
|
116
|
-
[
|
117
|
-
LinearGengou.new(
|
118
|
-
start_date: this.start_date.clone, last_date: other.start_date.clone - 1,
|
119
|
-
gengou: this.gengou
|
120
|
-
),
|
131
|
+
def self.trim_gengou(this:, other:)
|
121
132
|
LinearGengou.new(
|
122
|
-
start_date: other.
|
133
|
+
start_date: other.start_date, last_date: other.last_date,
|
123
134
|
gengou: this.gengou
|
124
135
|
)
|
125
|
-
|
126
|
-
|
127
|
-
private_class_method :split_gengou
|
128
|
-
|
129
|
-
def self.trim_gengou(this:, other:)
|
130
|
-
LinearGengou.new(
|
131
|
-
start_date: other.start_date, last_date: other.last_date,
|
132
|
-
gengou: this.gengou
|
133
|
-
)
|
134
|
-
end
|
135
|
-
private_class_method :trim_gengou
|
136
|
+
end
|
137
|
+
private_class_method :trim_gengou
|
136
138
|
|
137
|
-
|
138
|
-
|
139
|
-
|
139
|
+
def self.narrow_gengou(this:, other:)
|
140
|
+
start = this.start_date > other.start_date ? this.start_date : other.start_date
|
141
|
+
last = this.last_date < other.last_date ? this.last_date : other.last_date
|
140
142
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
143
|
+
LinearGengou.new(
|
144
|
+
start_date: start.clone, last_date: last.clone, gengou: this.gengou
|
145
|
+
)
|
146
|
+
end
|
147
|
+
private_class_method :narrow_gengou
|
146
148
|
|
147
|
-
|
148
|
-
|
149
|
-
|
149
|
+
def self.shave_gengou(this:, other:) # rubocop:disable Metrics/AbcSize
|
150
|
+
start = this.start_date
|
151
|
+
last = this.last_date
|
150
152
|
|
151
|
-
|
152
|
-
|
153
|
+
# 開始日が比較元号の開始日より前の範囲
|
154
|
+
last = other.start_date.clone - 1 if this.start_date < other.start_date
|
153
155
|
|
154
|
-
|
155
|
-
|
156
|
+
# 終了日が比較元号の開始日より後の範囲
|
157
|
+
start = other.last_date.clone + 1 if this.last_date > other.last_date
|
156
158
|
|
157
|
-
|
158
|
-
|
159
|
-
|
159
|
+
LinearGengou.new(
|
160
|
+
start_date: start.clone, last_date: last.clone, gengou: this.gengou
|
161
|
+
)
|
162
|
+
end
|
163
|
+
private_class_method :shave_gengou
|
160
164
|
end
|
161
|
-
private_class_method :shave_gengou
|
162
165
|
end
|
163
166
|
end
|
164
167
|
end
|
@@ -9,146 +9,165 @@ module Zakuro
|
|
9
9
|
# :nodoc:
|
10
10
|
module Japan
|
11
11
|
# :nodoc:
|
12
|
-
module
|
13
|
-
#
|
14
|
-
|
15
|
-
#
|
16
|
-
class Line
|
17
|
-
# @return [Array<LinearGengou>] 元号
|
18
|
-
attr_reader :list
|
19
|
-
|
12
|
+
module Gengou
|
13
|
+
# :nodoc:
|
14
|
+
module Alignment
|
20
15
|
#
|
21
|
-
#
|
16
|
+
# Line 行
|
22
17
|
#
|
23
|
-
|
24
|
-
@
|
25
|
-
|
18
|
+
class Line
|
19
|
+
# @return [Array<LinearGengou>] 元号
|
20
|
+
attr_reader :list
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# 1. 完全に範囲外(開始日より前)
|
33
|
-
# [@list]: |-------|-------|
|
34
|
-
# [list]: |---|
|
35
|
-
# 2. 前半のみ範囲外
|
36
|
-
# [@list]: |-------|-------|
|
37
|
-
# [list]: |------|
|
38
|
-
# 3. 範囲内
|
39
|
-
# [@list]: |-------|-------|
|
40
|
-
# [list]: |------|
|
41
|
-
# 4. 後半のみ範囲外
|
42
|
-
# [@list]: |-------|-------|
|
43
|
-
# [list]: |------|
|
44
|
-
# 5. 完全に範囲外(開始日より後)
|
45
|
-
# [@list]: |-------|-------|
|
46
|
-
# [list]: |----|
|
47
|
-
# 6. 両端が範囲外
|
48
|
-
# [@list]: |-------|-------|
|
49
|
-
# [list]: |--------------------|
|
50
|
-
#
|
51
|
-
# @param [Array<LinearGengou>] list 元号
|
52
|
-
#
|
53
|
-
# @return [Array<LinearGengou>] 未登録元号
|
54
|
-
#
|
55
|
-
def push(list: [])
|
56
|
-
rest = rest(list: list)
|
57
|
-
|
58
|
-
insert(list: list)
|
59
|
-
|
60
|
-
rest
|
61
|
-
end
|
62
|
-
|
63
|
-
#
|
64
|
-
# 範囲内の元号を取得する
|
65
|
-
#
|
66
|
-
# @param [Western::Calendar] start_date 開始日
|
67
|
-
# @param [Western::Calendar] last_date 終了日
|
68
|
-
#
|
69
|
-
# @return [Array<LinearGengou>] 元号
|
70
|
-
#
|
71
|
-
def get(start_date:, last_date:)
|
72
|
-
result = []
|
73
|
-
@list.each do |gengou|
|
74
|
-
next if gengou.out?(start_date: start_date, last_date: last_date)
|
75
|
-
|
76
|
-
# 1日でも範囲内であれば対象とみなす
|
77
|
-
result.push(gengou)
|
22
|
+
#
|
23
|
+
# 初期化
|
24
|
+
#
|
25
|
+
def initialize
|
26
|
+
@list = []
|
78
27
|
end
|
79
28
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
29
|
+
#
|
30
|
+
# 追加する
|
31
|
+
#
|
32
|
+
# 下記のパターンが存在し、戻り値は重複分となる
|
33
|
+
#
|
34
|
+
# 1. 完全に範囲外(開始日より前)
|
35
|
+
# [@list]: |-------|-------|
|
36
|
+
# [list]: |---|
|
37
|
+
# 2. 前半のみ範囲外
|
38
|
+
# [@list]: |-------|-------|
|
39
|
+
# [list]: |------|
|
40
|
+
# 3. 範囲内
|
41
|
+
# [@list]: |-------|-------|
|
42
|
+
# [list]: |------|
|
43
|
+
# 4. 後半のみ範囲外
|
44
|
+
# [@list]: |-------|-------|
|
45
|
+
# [list]: |------|
|
46
|
+
# 5. 完全に範囲外(開始日より後)
|
47
|
+
# [@list]: |-------|-------|
|
48
|
+
# [list]: |----|
|
49
|
+
# 6. 両端が範囲外
|
50
|
+
# [@list]: |-------|-------|
|
51
|
+
# [list]: |--------------------|
|
52
|
+
#
|
53
|
+
# @param [Array<LinearGengou>] list 元号
|
54
|
+
#
|
55
|
+
# @return [Array<LinearGengou>] 未登録元号
|
56
|
+
#
|
57
|
+
def push(list: [])
|
58
|
+
rest = rest(list: list)
|
59
|
+
|
60
|
+
insert(list: list)
|
61
|
+
|
62
|
+
rest
|
63
|
+
end
|
84
64
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
65
|
+
#
|
66
|
+
# 範囲内の元号を取得する
|
67
|
+
#
|
68
|
+
# @param [Western::Calendar] start_date 開始日
|
69
|
+
# @param [Western::Calendar] last_date 終了日
|
70
|
+
#
|
71
|
+
# @return [Array<LinearGengou>] 元号
|
72
|
+
#
|
73
|
+
def get(start_date:, last_date:)
|
74
|
+
result = []
|
75
|
+
@list.each do |gengou|
|
76
|
+
next if gengou.out?(start_date: start_date, last_date: last_date)
|
77
|
+
|
78
|
+
# 1日でも範囲内であれば対象とみなす
|
79
|
+
result.push(gengou)
|
80
|
+
end
|
81
|
+
|
82
|
+
result
|
83
|
+
end
|
94
84
|
|
95
|
-
|
96
|
-
|
85
|
+
#
|
86
|
+
# 範囲内の元号を取得する(元号名)
|
87
|
+
#
|
88
|
+
# @param [String] name 元号名
|
89
|
+
#
|
90
|
+
# @return [Array<LinearGengou>] 元号
|
91
|
+
#
|
92
|
+
def get_by_name(name:)
|
93
|
+
result = []
|
94
|
+
@list.each do |gengou|
|
95
|
+
result.push(gengou) if gengou.name == name
|
96
|
+
end
|
97
|
+
|
98
|
+
result
|
97
99
|
end
|
98
100
|
|
99
|
-
|
100
|
-
end
|
101
|
+
private
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
103
|
+
#
|
104
|
+
# 重複分(空きがないため追加できない範囲の元号)を返す
|
105
|
+
#
|
106
|
+
# @param [Array<LinearGengou>] list 元号
|
107
|
+
#
|
108
|
+
# @return [Array<LinearGengou>] 重複分元号
|
109
|
+
#
|
110
|
+
def rest(list: [])
|
111
|
+
result = []
|
112
112
|
|
113
|
-
|
113
|
+
@list.each do |gengou|
|
114
|
+
result |= and!(rest: list, other: gengou)
|
115
|
+
end
|
114
116
|
|
115
|
-
|
116
|
-
@list.push(gengou)
|
117
|
+
Division.connect(list: result)
|
117
118
|
end
|
118
|
-
end
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
120
|
+
#
|
121
|
+
# 空き範囲に元号を登録する
|
122
|
+
#
|
123
|
+
# @param [Array<LinearGengou>] list 元号
|
124
|
+
#
|
125
|
+
def insert(list: [])
|
126
|
+
surplus_result = list.clone
|
127
|
+
@list.each do |gengou|
|
128
|
+
surplus_result = not!(surplus: surplus_result, other: gengou)
|
129
|
+
end
|
130
|
+
|
131
|
+
surplus_result = Division.connect(list: surplus_result)
|
132
|
+
|
133
|
+
surplus_result.each do |gengou|
|
134
|
+
@list.push(gengou)
|
135
|
+
end
|
132
136
|
end
|
133
137
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
result
|
138
|
+
#
|
139
|
+
# 重複した範囲を返す
|
140
|
+
#
|
141
|
+
# @param [Array<LinearGengou>] rest 残り元号
|
142
|
+
# @param [LinearGengou] other 比較元号
|
143
|
+
#
|
144
|
+
# @return [Array<LinearGengou>] 重複分
|
145
|
+
#
|
146
|
+
def and!(rest:, other:)
|
147
|
+
result = []
|
148
|
+
rest.each do |gengou|
|
149
|
+
result |= Division.match(this: gengou, other: other)
|
150
|
+
end
|
151
|
+
|
152
|
+
result
|
149
153
|
end
|
150
154
|
|
151
|
-
|
155
|
+
#
|
156
|
+
# 範囲が重複しない差分を返す
|
157
|
+
#
|
158
|
+
# @param [Array<LinearGengou>] surplus 積元号
|
159
|
+
# @param [LinearGengou] other 比較元号
|
160
|
+
#
|
161
|
+
# @return [Array<LinearGengou>] 差分
|
162
|
+
#
|
163
|
+
def not!(surplus:, other:)
|
164
|
+
result = []
|
165
|
+
surplus.each do |gengou|
|
166
|
+
result |= Division.mismatch(this: gengou, other: other)
|
167
|
+
end
|
168
|
+
|
169
|
+
result
|
170
|
+
end
|
152
171
|
end
|
153
172
|
end
|
154
173
|
end
|