質問編集履歴
72
test
CHANGED
File without changes
|
test
CHANGED
@@ -187,3 +187,23 @@
|
|
187
187
|
|
188
188
|
|
189
189
|
以上二点をご説明頂ければ幸いです。
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
追記(7/16)
|
194
|
+
|
195
|
+
---
|
196
|
+
|
197
|
+
createCalendarメソッドの省略部分を展開しました。
|
198
|
+
|
199
|
+
実は昨日このメソッドを読んでる最中にパニックになってしまった上に、拒否反応を起こしてパソコンを閉じてしまったのです。
|
200
|
+
|
201
|
+
しかし悩みは解決したいという僕の都合の良いところ。
|
202
|
+
|
203
|
+
しっかりと把握すべきところに目を通さず、質問に走ってしまいました。
|
204
|
+
|
205
|
+
事実先程確認しましたところ、Calendarクラスが継承元であるクラスがnewされてる現場を目撃してしまいました。
|
206
|
+
|
207
|
+
今回の一件は僕の甘さと汚い性格が引き起こしたに他なりません。
|
208
|
+
|
209
|
+
皆様に多大なる迷惑をおかけしたこと心からお詫び申し上げます。
|
71
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,15 +132,15 @@
|
|
132
132
|
|
133
133
|
cal=new BuddhistCalendar(zone,aLocale);
|
134
134
|
|
135
|
-
}else if(aLocale.getVariant()=="JP"&&aLocale.getLanguage()=="ja"&&aLocale.getCountry()=="JP"){
|
135
|
+
}else if(aLocale.getVariant()=="JP"&&aLocale.getLanguage()=="ja"&&aLocale.getCountry()=="JP"){
|
136
136
|
|
137
|
-
cal=new JapaneseImperialCalendar(zone,aLoacale);
|
137
|
+
cal=new JapaneseImperialCalendar(zone,aLoacale);
|
138
138
|
|
139
|
-
}else{
|
139
|
+
}else{
|
140
140
|
|
141
|
-
cal=new GregorianCalendar(zone,aLocale);
|
141
|
+
cal=new GregorianCalendar(zone,aLocale);
|
142
142
|
|
143
|
-
}
|
143
|
+
}
|
144
144
|
|
145
145
|
}
|
146
146
|
|
70
test
CHANGED
File without changes
|
test
CHANGED
@@ -122,9 +122,27 @@
|
|
122
122
|
|
123
123
|
}
|
124
124
|
|
125
|
-
}
|
125
|
+
}
|
126
126
|
|
127
|
+
|
128
|
+
|
129
|
+
if(cal==nul){
|
130
|
+
|
131
|
+
if(aLocale.getLanguage()=="th"&&aLocale.getCountry()=="TH"){
|
132
|
+
|
133
|
+
cal=new BuddhistCalendar(zone,aLocale);
|
134
|
+
|
135
|
+
}else if(aLocale.getVariant()=="JP"&&aLocale.getLanguage()=="ja"&&aLocale.getCountry()=="JP"){
|
136
|
+
|
137
|
+
cal=new JapaneseImperialCalendar(zone,aLoacale);
|
138
|
+
|
127
|
-
|
139
|
+
}else{
|
140
|
+
|
141
|
+
cal=new GregorianCalendar(zone,aLocale);
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
}
|
128
146
|
|
129
147
|
return cal;
|
130
148
|
|
69
test
CHANGED
File without changes
|
test
CHANGED
@@ -128,6 +128,8 @@
|
|
128
128
|
|
129
129
|
return cal;
|
130
130
|
|
131
|
+
}
|
132
|
+
|
131
133
|
```
|
132
134
|
|
133
135
|
|
68
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,6 +124,10 @@
|
|
124
124
|
|
125
125
|
}
|
126
126
|
|
127
|
+
...(省略)
|
128
|
+
|
129
|
+
return cal;
|
130
|
+
|
127
131
|
```
|
128
132
|
|
129
133
|
|
67
test
CHANGED
File without changes
|
test
CHANGED
@@ -118,9 +118,9 @@
|
|
118
118
|
|
119
119
|
break;
|
120
120
|
|
121
|
-
}
|
121
|
+
}
|
122
122
|
|
123
|
-
}
|
123
|
+
}
|
124
124
|
|
125
125
|
}
|
126
126
|
|
66
test
CHANGED
File without changes
|
test
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
if(aLocale.hasExtensions()){
|
96
96
|
|
97
|
-
String caltype=aLocale.getUnicodeLocaleType("ca")
|
97
|
+
String caltype=aLocale.getUnicodeLocaleType("ca");
|
98
98
|
|
99
99
|
if(caltype!=null){
|
100
100
|
|
@@ -104,19 +104,19 @@
|
|
104
104
|
|
105
105
|
cal=new BuddhistCalender(zone,aLocale);
|
106
106
|
|
107
|
-
break;
|
107
|
+
break;
|
108
108
|
|
109
|
-
case "japanese":
|
109
|
+
case "japanese":
|
110
110
|
|
111
|
-
cal=new JapaneseImperialCalendar(zone,aLocale);
|
111
|
+
cal=new JapaneseImperialCalendar(zone,aLocale);
|
112
112
|
|
113
|
-
break;
|
113
|
+
break;
|
114
114
|
|
115
|
-
case "gregory":
|
115
|
+
case "gregory":
|
116
116
|
|
117
|
-
cal=new GregorianCalendar(zone,aLocale);
|
117
|
+
cal=new GregorianCalendar(zone,aLocale);
|
118
118
|
|
119
|
-
break;
|
119
|
+
break;
|
120
120
|
|
121
121
|
}
|
122
122
|
|
65
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,13 +96,13 @@
|
|
96
96
|
|
97
97
|
String caltype=aLocale.getUnicodeLocaleType("ca"):
|
98
98
|
|
99
|
-
if(caltype!=null){
|
99
|
+
if(caltype!=null){
|
100
100
|
|
101
|
-
switch(caltype){
|
101
|
+
switch(caltype){
|
102
102
|
|
103
|
-
case "buddhist":
|
103
|
+
case "buddhist":
|
104
104
|
|
105
|
-
cal=new BuddhistCalender(zone,aLocale);
|
105
|
+
cal=new BuddhistCalender(zone,aLocale);
|
106
106
|
|
107
107
|
break;
|
108
108
|
|
64
test
CHANGED
File without changes
|
test
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
if(aLocale.hasExtensions()){
|
96
96
|
|
97
|
-
String caltype=aLocale.getUnicodeLocaleType("ca"):
|
97
|
+
String caltype=aLocale.getUnicodeLocaleType("ca"):
|
98
98
|
|
99
99
|
if(caltype!=null){
|
100
100
|
|
63
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,7 +90,39 @@
|
|
90
90
|
|
91
91
|
Calendar cal=null;
|
92
92
|
|
93
|
+
|
94
|
+
|
95
|
+
if(aLocale.hasExtensions()){
|
96
|
+
|
97
|
+
String caltype=aLocale.getUnicodeLocaleType("ca"):
|
98
|
+
|
99
|
+
if(caltype!=null){
|
100
|
+
|
101
|
+
switch(caltype){
|
102
|
+
|
103
|
+
case "buddhist":
|
104
|
+
|
105
|
+
cal=new BuddhistCalender(zone,aLocale);
|
106
|
+
|
93
|
-
|
107
|
+
break;
|
108
|
+
|
109
|
+
case "japanese":
|
110
|
+
|
111
|
+
cal=new JapaneseImperialCalendar(zone,aLocale);
|
112
|
+
|
113
|
+
break;
|
114
|
+
|
115
|
+
case "gregory":
|
116
|
+
|
117
|
+
cal=new GregorianCalendar(zone,aLocale);
|
118
|
+
|
119
|
+
break;
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
}
|
94
126
|
|
95
127
|
```
|
96
128
|
|
62
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
今回はJava.utilパッケージのCalendarクラスについて勉強していた時に問題が生じました。
|
8
8
|
|
9
9
|
それはCalendar.getInstanceメソッドで返される値は何なのか?というものです。
|
10
10
|
|
61
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
今回はJava.utilパッケージのCalendarクラスについて勉強していた時に問題が生じました。
|
7
|
+
###今回はJava.utilパッケージのCalendarクラスについて勉強していた時に問題が生じました。
|
8
8
|
|
9
9
|
それはCalendar.getInstanceメソッドで返される値は何なのか?というものです。
|
10
10
|
|
60
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
59
test
CHANGED
File without changes
|
test
CHANGED
@@ -128,4 +128,6 @@
|
|
128
128
|
|
129
129
|
- 正体がCalendarインスタンスならどうして生成出来るのか?
|
130
130
|
|
131
|
+
|
132
|
+
|
131
133
|
以上二点をご説明頂ければ幸いです。
|
58
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,8 +124,8 @@
|
|
124
124
|
|
125
125
|
質問の内容は
|
126
126
|
|
127
|
-
-Calender.getInstanceメソッドの戻り値の正体
|
127
|
+
- Calender.getInstanceメソッドの戻り値の正体
|
128
128
|
|
129
|
-
-正体がCalendarインスタンスならどうして生成出来るのか?
|
129
|
+
- 正体がCalendarインスタンスならどうして生成出来るのか?
|
130
130
|
|
131
131
|
以上二点をご説明頂ければ幸いです。
|
57
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,8 +124,8 @@
|
|
124
124
|
|
125
125
|
質問の内容は
|
126
126
|
|
127
|
-
|
127
|
+
-Calender.getInstanceメソッドの戻り値の正体
|
128
128
|
|
129
|
-
|
129
|
+
-正体がCalendarインスタンスならどうして生成出来るのか?
|
130
130
|
|
131
131
|
以上二点をご説明頂ければ幸いです。
|
56
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
以下はそのメソッドの定義です。
|
12
12
|
|
13
|
-
|
13
|
+
|
14
14
|
|
15
15
|
```
|
16
16
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
22
22
|
|
23
|
-
|
23
|
+
|
24
24
|
|
25
25
|
この定義の戻り値の型にはCalendarクラス型が指定されています。
|
26
26
|
|
55
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
以下はそのメソッドの定義です。
|
12
12
|
|
13
|
-
|
13
|
+
----
|
14
14
|
|
15
15
|
```
|
16
16
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
22
22
|
|
23
|
-
|
23
|
+
---
|
24
24
|
|
25
25
|
この定義の戻り値の型にはCalendarクラス型が指定されています。
|
26
26
|
|
54
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
こんばんは。
|
2
2
|
|
3
3
|
Javaでよくわからない点があったので質問させてください。
|
4
4
|
|
53
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`こんばんは。`
|
1
|
+
` こんばんは。 `
|
2
2
|
|
3
3
|
Javaでよくわからない点があったので質問させてください。
|
4
4
|
|
52
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
こんばんは。
|
1
|
+
`こんばんは。`
|
2
2
|
|
3
3
|
Javaでよくわからない点があったので質問させてください。
|
4
4
|
|
51
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,11 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
+
```
|
16
|
+
|
15
|
-
|
17
|
+
public static Calendar getInstance()
|
18
|
+
|
19
|
+
```
|
16
20
|
|
17
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
18
22
|
|
50
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
`
|
15
|
+
`public static Calendar getInstance()`
|
16
16
|
|
17
17
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
18
18
|
|
49
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,11 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
```
|
16
|
-
|
17
|
-
public static Calendar getInstance()
|
15
|
+
` public static Calendar getInstance() `
|
18
|
-
|
19
|
-
```
|
20
16
|
|
21
17
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
22
18
|
|
48
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
こんばんは。
|
2
2
|
|
3
3
|
Javaでよくわからない点があったので質問させてください。
|
4
4
|
|
47
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
> こんばんは。
|
2
2
|
|
3
|
-
|
3
|
+
Javaでよくわからない点があったので質問させてください。
|
4
4
|
|
5
5
|
|
6
6
|
|
46
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
>こんばんは。
|
1
|
+
> こんばんは。
|
2
2
|
|
3
|
-
>Javaでよくわからない点があったので質
|
3
|
+
> Javaでよくわからない点があったので質問させてください。
|
4
4
|
|
5
5
|
|
6
6
|
|
45
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
こんばんは。
|
1
|
+
>こんばんは。
|
2
2
|
|
3
|
-
Javaでよくわからない点があったので質問させてください。
|
3
|
+
>Javaでよくわからない点があったので質>問させてください。
|
4
4
|
|
5
5
|
|
6
6
|
|
44
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
こんばんは。
|
2
2
|
|
3
3
|
Javaでよくわからない点があったので質問させてください。
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
---
|
8
4
|
|
9
5
|
|
10
6
|
|
43
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
こんばんは。
|
2
2
|
|
3
3
|
Javaでよくわからない点があったので質問させてください。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
---
|
4
8
|
|
5
9
|
|
6
10
|
|
42
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
|
33
|
+
public abstract class Calendar extends
|
34
34
|
|
35
35
|
...(省略)
|
36
36
|
|
41
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
---
|
33
|
+
---public abstract class Calendar extends
|
34
34
|
|
35
35
|
...(省略)
|
36
36
|
|
40
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
---public abstract class Calendar extends
|
33
|
+
--- public abstract class Calendar extends
|
34
34
|
|
35
35
|
...(省略)
|
36
36
|
|
39
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,13 +24,13 @@
|
|
24
24
|
|
25
25
|
この定義の戻り値の型にはCalendarクラス型が指定されています。
|
26
26
|
|
27
|
-
|
27
|
+
しかしCalendarクラスは以下のように抽象クラスとして定義されています。
|
28
28
|
|
29
29
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
public abstract class Calendar extends
|
33
|
+
---public abstract class Calendar extends
|
34
34
|
|
35
35
|
...(省略)
|
36
36
|
|
38
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
この定義の戻り値の型にはCalendarクラス型が指定されています。
|
26
26
|
|
27
|
-
---しかしCalendarクラスは以下のように抽象クラスとして定義されています。
|
27
|
+
--- しかしCalendarクラスは以下のように抽象クラスとして定義されています。
|
28
28
|
|
29
29
|
|
30
30
|
|
37
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
この定義の戻り値の型にはCalendarクラス型が指定されています。
|
26
26
|
|
27
|
-
しかしCalendarクラスは以下のように抽象クラスとして定義されています。
|
27
|
+
---しかしCalendarクラスは以下のように抽象クラスとして定義されています。
|
28
28
|
|
29
29
|
|
30
30
|
|
36
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
|
33
|
+
public abstract class Calendar extends
|
34
34
|
|
35
35
|
...(省略)
|
36
36
|
|
35
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
public abstract class Calendar extends
|
33
|
+
> public abstract class Calendar extends
|
34
34
|
|
35
35
|
...(省略)
|
36
36
|
|
@@ -68,7 +68,7 @@
|
|
68
68
|
|
69
69
|
|
70
70
|
|
71
|
-
|
71
|
+
CalendarProvider provider=LocaleProviderAdapter.getAdapter(CalendarProvider.class,aLocale).getCalendarProvider();
|
72
72
|
|
73
73
|
|
74
74
|
|
34
test
CHANGED
File without changes
|
test
CHANGED
@@ -68,7 +68,7 @@
|
|
68
68
|
|
69
69
|
|
70
70
|
|
71
|
-
CalendarProvider provider=LocaleProviderAdapter.getAdapter(CalendarProvider.class,aLocale).getCalendarProvider();
|
71
|
+
> CalendarProvider provider=LocaleProviderAdapter.getAdapter(CalendarProvider.class,aLocale).getCalendarProvider();
|
72
72
|
|
73
73
|
|
74
74
|
|
33
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
|
17
|
+
public static Calendar getInstance()
|
18
18
|
|
19
19
|
```
|
20
20
|
|
32
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
public static Calendar getInstance()
|
17
|
+
---public static Calendar getInstance()
|
18
18
|
|
19
19
|
```
|
20
20
|
|
31
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,9 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
public static Calendar getInstance()
|
17
|
+
public static Calendar getInstance()
|
18
|
+
|
19
|
+
```
|
18
20
|
|
19
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
20
22
|
|
30
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,9 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
+
```
|
16
|
+
|
15
|
-
|
17
|
+
public static Calendar getInstance()```
|
16
18
|
|
17
19
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
18
20
|
|
29
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,11 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
```
|
16
|
-
|
17
|
-
public static Calendar getInstance()
|
15
|
+
```public static Calendar getInstance()```
|
18
|
-
|
19
|
-
```
|
20
16
|
|
21
17
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
22
18
|
|
28
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,13 +44,9 @@
|
|
44
44
|
|
45
45
|
でもgetInstanceメソッドのコードを確認したところ
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
###Calendar.getInstance
|
50
|
-
|
51
47
|
```
|
52
48
|
|
53
|
-
public static Calendar getInstance(){
|
49
|
+
public staticm Calendar getInstance(){
|
54
50
|
|
55
51
|
|
56
52
|
|
27
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
##Calendar.getInstance
|
49
|
+
###Calendar.getInstance
|
50
50
|
|
51
51
|
```
|
52
52
|
|
26
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
#Calendar.getInstance
|
49
|
+
##Calendar.getInstance
|
50
50
|
|
51
51
|
```
|
52
52
|
|
25
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,6 +44,10 @@
|
|
44
44
|
|
45
45
|
でもgetInstanceメソッドのコードを確認したところ
|
46
46
|
|
47
|
+
|
48
|
+
|
49
|
+
#Calendar.getInstance
|
50
|
+
|
47
51
|
```
|
48
52
|
|
49
53
|
public static Calendar getInstance(){
|
@@ -72,7 +76,7 @@
|
|
72
76
|
|
73
77
|
|
74
78
|
|
75
|
-
|
79
|
+
if(provider != null){
|
76
80
|
|
77
81
|
|
78
82
|
|
24
test
CHANGED
File without changes
|
test
CHANGED
@@ -72,7 +72,7 @@
|
|
72
72
|
|
73
73
|
|
74
74
|
|
75
|
-
if(provider != null){
|
75
|
+
>if(provider != null){
|
76
76
|
|
77
77
|
|
78
78
|
|
23
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
今回はJava.utilパッケージのCalendarクラスについて勉強していた時に問題が生じました。
|
8
8
|
|
9
|
-
それは
|
9
|
+
それはCalendar.getInstanceメソッドで返される値は何なのか?というものです。
|
10
10
|
|
11
11
|
以下はそのメソッドの定義です。
|
12
12
|
|
22
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
今回はJava.utilパッケージのCalendarクラスについて勉強していた時に問題が生じました。
|
8
8
|
|
9
|
-
それは
|
9
|
+
それは'Calendar.getInstance'メソッドで返される値は何なのか?というものです。
|
10
10
|
|
11
11
|
以下はそのメソッドの定義です。
|
12
12
|
|
@@ -74,7 +74,7 @@
|
|
74
74
|
|
75
75
|
if(provider != null){
|
76
76
|
|
77
|
-
|
77
|
+
|
78
78
|
|
79
79
|
try{
|
80
80
|
|
21
test
CHANGED
File without changes
|
test
CHANGED
@@ -74,6 +74,8 @@
|
|
74
74
|
|
75
75
|
if(provider != null){
|
76
76
|
|
77
|
+
(tab)
|
78
|
+
|
77
79
|
try{
|
78
80
|
|
79
81
|
return provider.getInstance(zone,aLocale);
|
20
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
今回はJava.utilパッケージのCalendarクラスについて勉強していた時に問題が生じました。
|
8
8
|
|
9
|
-
それはCalendar.getInstanceメソッドで返される値は何なのか?というものです。
|
9
|
+
それは`Calendar.getInstance`メソッドで返される値は何なのか?というものです。
|
10
10
|
|
11
11
|
以下はそのメソッドの定義です。
|
12
12
|
|
19
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,11 +12,11 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
`
|
15
|
+
```
|
16
16
|
|
17
17
|
public static Calendar getInstance()
|
18
18
|
|
19
|
-
`
|
19
|
+
```
|
20
20
|
|
21
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
22
22
|
|
18
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,11 +12,11 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
`
|
15
|
+
`
|
16
16
|
|
17
17
|
public static Calendar getInstance()
|
18
18
|
|
19
|
-
`
|
19
|
+
`
|
20
20
|
|
21
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
22
22
|
|
17
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,9 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
public abstract class Calendar extends
|
33
|
+
public abstract class Calendar extends
|
34
|
+
|
35
|
+
...(省略)
|
34
36
|
|
35
37
|
```
|
36
38
|
|
@@ -86,9 +88,9 @@
|
|
86
88
|
|
87
89
|
Calendar cal=null;
|
88
90
|
|
91
|
+
...(省略)
|
92
|
+
|
89
93
|
```
|
90
|
-
|
91
|
-
...(省略)
|
92
94
|
|
93
95
|
|
94
96
|
|
16
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,11 +30,9 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
public abstract class Calendar extends
|
33
|
+
public abstract class Calendar extends...(省略)
|
34
34
|
|
35
35
|
```
|
36
|
-
|
37
|
-
...(省略)
|
38
36
|
|
39
37
|
|
40
38
|
|
15
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
}catch(IllegalArgumentException iae){
|
82
82
|
|
83
|
-
}
|
83
|
+
}
|
84
84
|
|
85
85
|
}
|
86
86
|
|
14
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,9 +80,7 @@
|
|
80
80
|
|
81
81
|
}catch(IllegalArgumentException iae){
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
}
|
83
|
+
}
|
86
84
|
|
87
85
|
}
|
88
86
|
|
13
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,11 +48,11 @@
|
|
48
48
|
|
49
49
|
public static Calendar getInstance(){
|
50
50
|
|
51
|
-
return createCalendar
|
52
51
|
|
53
|
-
(TimeZone.getDefault(),Locale.getDefault
|
54
52
|
|
55
|
-
(Locale.Category.FORMAT));
|
53
|
+
return createCalendar(TimeZone.getDefault(),Locale.getDefault(Locale.Category.FORMAT));
|
54
|
+
|
55
|
+
|
56
56
|
|
57
57
|
}
|
58
58
|
|
@@ -65,6 +65,8 @@
|
|
65
65
|
private static Calendar createCalendar
|
66
66
|
|
67
67
|
(TimeZone zone,Locale aLocale){
|
68
|
+
|
69
|
+
|
68
70
|
|
69
71
|
CalendarProvider provider=LocaleProviderAdapter.getAdapter(CalendarProvider.class,aLocale).getCalendarProvider();
|
70
72
|
|
12
test
CHANGED
File without changes
|
test
CHANGED
@@ -62,7 +62,9 @@
|
|
62
62
|
|
63
63
|
```
|
64
64
|
|
65
|
-
private static Calendar createCalendar
|
65
|
+
private static Calendar createCalendar
|
66
|
+
|
67
|
+
(TimeZone zone,Locale aLocale){
|
66
68
|
|
67
69
|
CalendarProvider provider=LocaleProviderAdapter.getAdapter(CalendarProvider.class,aLocale).getCalendarProvider();
|
68
70
|
|
11
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,7 +50,9 @@
|
|
50
50
|
|
51
51
|
return createCalendar
|
52
52
|
|
53
|
-
(TimeZone.getDefault(),Locale.getDefault
|
53
|
+
(TimeZone.getDefault(),Locale.getDefault
|
54
|
+
|
55
|
+
(Locale.Category.FORMAT));
|
54
56
|
|
55
57
|
}
|
56
58
|
|
10
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,7 +48,9 @@
|
|
48
48
|
|
49
49
|
public static Calendar getInstance(){
|
50
50
|
|
51
|
+
return createCalendar
|
52
|
+
|
51
|
-
|
53
|
+
(TimeZone.getDefault(),Locale.getDefault(Locale.Category.FORMAT));
|
52
54
|
|
53
55
|
}
|
54
56
|
|
9
test
CHANGED
File without changes
|
test
CHANGED
@@ -102,7 +102,11 @@
|
|
102
102
|
|
103
103
|
LocaleServiceProviderクラスの定義は
|
104
104
|
|
105
|
+
```
|
106
|
+
|
105
107
|
public abstract class LocaleServiceProvider
|
108
|
+
|
109
|
+
```
|
106
110
|
|
107
111
|
|
108
112
|
|
8
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,7 +90,13 @@
|
|
90
90
|
|
91
91
|
CalendarProviderクラスの定義は
|
92
92
|
|
93
|
+
|
94
|
+
|
95
|
+
```
|
96
|
+
|
93
97
|
public abstract class CalendarProvider extends LocaleServiceProvider
|
98
|
+
|
99
|
+
```
|
94
100
|
|
95
101
|
|
96
102
|
|
7
test
CHANGED
File without changes
|
test
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
createCalendarメソッドは
|
58
58
|
|
59
|
-
|
59
|
+
```
|
60
60
|
|
61
61
|
private static Calendar createCalendar(TimeZone zone,Locale aLocale){
|
62
62
|
|
@@ -81,6 +81,8 @@
|
|
81
81
|
|
82
82
|
|
83
83
|
Calendar cal=null;
|
84
|
+
|
85
|
+
```
|
84
86
|
|
85
87
|
...(省略)
|
86
88
|
|
6
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
でもgetInstanceメソッドのコードを確認したところ
|
46
46
|
|
47
|
-
|
47
|
+
```
|
48
48
|
|
49
49
|
public static Calendar getInstance(){
|
50
50
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
```
|
56
56
|
|
57
57
|
createCalendarメソッドは
|
58
58
|
|
5
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,8 +18,6 @@
|
|
18
18
|
|
19
19
|
```
|
20
20
|
|
21
|
-
|
22
|
-
|
23
21
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
24
22
|
|
25
23
|
|
@@ -30,7 +28,13 @@
|
|
30
28
|
|
31
29
|
|
32
30
|
|
31
|
+
```
|
32
|
+
|
33
|
-
public abstract class Calendar extends
|
33
|
+
public abstract class Calendar extends
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
...(省略)
|
34
38
|
|
35
39
|
|
36
40
|
|
4
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,11 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
+
```
|
16
|
+
|
15
|
-
|
17
|
+
public static Calendar getInstance()
|
18
|
+
|
19
|
+
```
|
16
20
|
|
17
21
|
|
18
22
|
|
3
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
`public static Calendar getInstance()`
|
15
|
+
```public static Calendar getInstance()```
|
16
16
|
|
17
17
|
|
18
18
|
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
|
14
14
|
|
15
15
|
`public static Calendar getInstance()`
|
16
|
+
|
17
|
+
|
16
18
|
|
17
19
|
(厳密には何種類かありますが今回の話とは関係ないと思うので省略します)
|
18
20
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
|
27
|
+
public abstract class Calendar extends...(省略)
|
28
28
|
|
29
29
|
|
30
30
|
|
@@ -36,11 +36,11 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
|
39
|
+
public static Calendar getInstance(){
|
40
40
|
|
41
41
|
return createCalendar(TimeZone.getDefault(),Locale.getDefault(Locale.Category.FORMAT));
|
42
42
|
|
43
|
-
}
|
43
|
+
}
|
44
44
|
|
45
45
|
|
46
46
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
|
50
50
|
|
51
|
-
|
51
|
+
private static Calendar createCalendar(TimeZone zone,Locale aLocale){
|
52
52
|
|
53
53
|
CalendarProvider provider=LocaleProviderAdapter.getAdapter(CalendarProvider.class,aLocale).getCalendarProvider();
|
54
54
|
|
@@ -70,7 +70,7 @@
|
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
-
Calendar cal=null;
|
73
|
+
Calendar cal=null;
|
74
74
|
|
75
75
|
...(省略)
|
76
76
|
|
@@ -78,13 +78,13 @@
|
|
78
78
|
|
79
79
|
CalendarProviderクラスの定義は
|
80
80
|
|
81
|
-
|
81
|
+
public abstract class CalendarProvider extends LocaleServiceProvider
|
82
82
|
|
83
83
|
|
84
84
|
|
85
85
|
LocaleServiceProviderクラスの定義は
|
86
86
|
|
87
|
-
|
87
|
+
public abstract class LocaleServiceProvider
|
88
88
|
|
89
89
|
|
90
90
|
|