Mercurial > hg > Database > jungle-sharp
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs Mon Nov 07 01:05:24 2016 +0900 @@ -0,0 +1,44 @@ + +public class DefaultEither<A,B> : Either<A,B> { + private A theA; + private B theB; + + private DefaultEither(A _theA, B _theB){ + theA = _theA; + theB = _theB; + } + + public static DefaultEither<A,B> newA(A _theA) + { + return new DefaultEither<A,B>(_theA,default(B)); + } + + public static DefaultEither<A,B> newB(B _theB) + { + return new DefaultEither<A,B>(default(A),_theB); + } + + public A a() + { + return theA; + } + + + public bool isA() + { + return theA != null; + } + + + public B b() + { + return theB; + } + + + public bool isB() + { + return theB != null; + } + +}