view src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/DefaultEither.java @ 22:9fd57b7c6adb

added Either
author Shoshi TAMAKI
date Mon, 07 Jan 2013 23:22:36 +0900
parents
children 3ef2a66a8c5d
line wrap: on
line source

package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util;

public class DefaultEither<A,B> implements Either<A,B>
{
	private final A theA;
	private final B theB;
	
	public DefaultEither(A _theA)
	{
		theA = _theA;
		theB = null;
	}

	@Override
	public A a()
	{
		return theA;
	}

	@Override
	public boolean isA()
	{
		return (theA == null) ? true : false;
	}

	@Override
	public B b()
	{
		return theB;
	}

	@Override
	public boolean isB()
	{
		return (theB == null) ? true : false;
	}
}