diff src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-main/util/DefaultEither.cs @ 10:abe0c247f5a5

Add Network module. but, unComplete NetworkDefaultJungleTreeEditor.cs
author Kazuma Takeda <kazuma-arashi@hotmail.co.jp>
date Sun, 23 Oct 2016 07:40:50 +0900
parents
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	Sun Oct 23 07:40:50 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;
+	}
+
+}