/* sbt -- Simple Build Tool
 * Copyright 2008, 2009, 2010  Mark Harrah
 */
package xsbti;

/** Intended as a lightweight carrier for scala.Option. */
public abstract class Maybe<t>
{
	// private pending Scala bug #3642
	protected Maybe() {}

	public static <s> Maybe<s> just(final s v)
	{
		return new Maybe<s>() {
			public boolean isDefined() { return true; }
			public s get() { return v; }
		};
	}
	public static <s> Maybe<s> nothing()
	{
		return new Maybe<s>() {
			public boolean isDefined() { return false; }
			public s get() { throw new UnsupportedOperationException("nothing.get"); }
		};
	}

	public final boolean isEmpty() { return !isDefined(); }
	public abstract boolean isDefined();
	public abstract t get();
}
@@ -393,212 +393,898 @@
 %7D%0A%09%09
-%7D;%0A%09%7D%0A%09public static %3Cs%3E Maybe%3Cs%3E nothing()%0A%09%7B%0A%09%09return new Maybe%3Cs%3E() %7B%0A%09%09%09public boolean isDefined() %7B return false; %7D%0A%09%09%09public s get() %7B throw new UnsupportedOperationException(%22nothing.get%22); 
+%09public int hashCode() %7B return 17 + (v == null ? 0 : v.hashCode()); %7D%0A%09%09%09public String toString() %7B return %22Maybe(%22 + v + %22)%22; %7D%0A%09%09%09public boolean equals(Object o) %7B%0A%09%09%09%09if (o == null) return false;%0A%09%09%09%09if (!(o instanceof Maybe)) return false;%0A%09%09%09%09Maybe%3C?%3E other = (Maybe%3C?%3E) o;%0A%09%09%09%09if (!other.isDefined()) return false;%0A%09%09%09%09if (v == null) return other.get() == null;%0A%09%09%09%09return v.equals(other.get());%0A%09%09%09%7D%0A%09%09%7D;%0A%09%7D%0A%09public static %3Cs%3E Maybe%3Cs%3E nothing()%0A%09%7B%0A%09%09return new Maybe%3Cs%3E() %7B%0A%09%09%09public boolean isDefined() %7B return false; %7D%0A%09%09%09public s get() %7B throw new UnsupportedOperationException(%22nothing.get%22); %7D%0A%09%09%09public int hashCode() %7B return 1; %7D%0A%09%09%09public String toString() %7B return %22Nothing%22; %7D%0A%09%09%09public boolean equals(Object o) %7B%0A%09%09%09%09if (o == null) return false;%0A%09%09%09%09if (!(o instanceof Maybe)) return false;%0A%09%09%09%09Maybe%3C?%3E other = (Maybe%3C?%3E) o;%0A%09%09%09%09return !other.isDefined();%0A%09%09%09
 %7D%0A%09%09%7D;%0A
+%0A
 %09%7D%0A%0A
@@ -1405,8 +1405,9 @@
 get();%0A%7D
+%0A

Implement hashCode, equals and toString in Maybe