annotate src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs @ 17:01a08cf4b2d9

Liq Files
author Kazuma
date Mon, 07 Nov 2016 01:05:24 +0900
parents abe0c247f5a5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
1 
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
2 public class DefaultEither<A,B> : Either<A,B> {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
3 private A theA;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
4 private B theB;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
5
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
6 private DefaultEither(A _theA, B _theB){
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
7 theA = _theA;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
8 theB = _theB;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
9 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
10
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
11 public static DefaultEither<A,B> newA(A _theA)
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
12 {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
13 return new DefaultEither<A,B>(_theA,default(B));
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
14 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
15
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
16 public static DefaultEither<A,B> newB(B _theB)
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
17 {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
18 return new DefaultEither<A,B>(default(A),_theB);
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
19 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
20
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
21 public A a()
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
22 {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
23 return theA;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
24 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
25
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
26
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
27 public bool isA()
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
28 {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
29 return theA != null;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
30 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
31
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
32
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
33 public B b()
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
34 {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
35 return theB;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
36 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
37
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
38
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
39 public bool isB()
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
40 {
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
41 return theB != null;
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
42 }
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
43
abe0c247f5a5 Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
parents:
diff changeset
44 }