package conditionals;

import java.util.HashMap;
import java.util.Map;

public abstract class Bool {
	public abstract Bool not();
	
	public Bool and(Bool x)
	{
		return not().or(x.not()).not();
	}
	
	public Bool or(Bool x)
	{
		return not().and(x.not()).not();
	}

	public abstract void cond(Thunk then, Thunk els);
	
	public Bool and(boolean x)
	{
		return and(convert(x));
	}
	public Bool or(boolean x)
	{
		return or(convert(x));
	}
	

	public static Bool convert(Boolean b)
	{
		Map<Boolean, Bool> values = new HashMap<Boolean, Bool>();
		values.put(false, new False());
		values.put(true, new True());
	
		return values.get(b);
	}
	
	
	public static void main(String[] args)  {
		int a = 5, b = 6;
		
		convert(a == b).or(a+2 == b).cond(() -> System.out.println("True"), () -> System.out.println("False"));
	}
}
