view Main/jungle-main/util/DefaultEither.cs @ 20:1f99e150f336

fix folder and add Object Mapper.
author Kazuma Takeda
date Thu, 15 Dec 2016 22:52:48 +0900
parents
children 56de71ae6f7e
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;
	}

}