Mercurial > hg > Database > jungle-sharp
comparison 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 |
comparison
equal
deleted
inserted
replaced
16:8f1ce942abfc | 17:01a08cf4b2d9 |
---|---|
1 | |
2 public class DefaultEither<A,B> : Either<A,B> { | |
3 private A theA; | |
4 private B theB; | |
5 | |
6 private DefaultEither(A _theA, B _theB){ | |
7 theA = _theA; | |
8 theB = _theB; | |
9 } | |
10 | |
11 public static DefaultEither<A,B> newA(A _theA) | |
12 { | |
13 return new DefaultEither<A,B>(_theA,default(B)); | |
14 } | |
15 | |
16 public static DefaultEither<A,B> newB(B _theB) | |
17 { | |
18 return new DefaultEither<A,B>(default(A),_theB); | |
19 } | |
20 | |
21 public A a() | |
22 { | |
23 return theA; | |
24 } | |
25 | |
26 | |
27 public bool isA() | |
28 { | |
29 return theA != null; | |
30 } | |
31 | |
32 | |
33 public B b() | |
34 { | |
35 return theB; | |
36 } | |
37 | |
38 | |
39 public bool isB() | |
40 { | |
41 return theB != null; | |
42 } | |
43 | |
44 } |