From 43524b0742f195304829e5bd4dd12492f8ad1aa1 Mon Sep 17 00:00:00 2001 From: student Date: Wed, 4 Apr 2018 16:26:53 -0400 Subject: More Evaluator work --- base/src/bjc/dicelang/eval/EvaluatorResult.java | 39 +++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'base/src/bjc/dicelang/eval/EvaluatorResult.java') diff --git a/base/src/bjc/dicelang/eval/EvaluatorResult.java b/base/src/bjc/dicelang/eval/EvaluatorResult.java index 1a783ad..ff86447 100644 --- a/base/src/bjc/dicelang/eval/EvaluatorResult.java +++ b/base/src/bjc/dicelang/eval/EvaluatorResult.java @@ -46,37 +46,40 @@ public class EvaluatorResult { */ public final EvaluatorResult.Type type; - // These may or may not have values based - // off of the result type - /** - * The integer value of the result. - */ - public long intVal; - /** * Create a new result. * * @param typ - * The type of the result. + * The type of the result. */ protected EvaluatorResult(final EvaluatorResult.Type typ) { type = typ; } - /** - * Create a new result. - * - * @param typ - * @param iVal - */ - public EvaluatorResult(final EvaluatorResult.Type typ, final long iVal) { - this(typ); + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } - intVal = iVal; + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EvaluatorResult other = (EvaluatorResult) obj; + if (type != other.type) + return false; + return true; } @Override public String toString() { - return type.toString(); + return "EvaluatorResult [type=" + type + "]"; } } -- cgit v1.2.3