view 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 source


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;
	}

}