From 806cba069576e48477d4660a019a49c405cb0195 Mon Sep 17 00:00:00 2001 From: student Date: Mon, 5 Mar 2018 16:48:38 -0500 Subject: Update --- .../bjc/dicelang/eval/FailureEvaluatorResult.java | 46 ++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'base/src/bjc/dicelang/eval/FailureEvaluatorResult.java') diff --git a/base/src/bjc/dicelang/eval/FailureEvaluatorResult.java b/base/src/bjc/dicelang/eval/FailureEvaluatorResult.java index d3b2cbe..6e46a61 100644 --- a/base/src/bjc/dicelang/eval/FailureEvaluatorResult.java +++ b/base/src/bjc/dicelang/eval/FailureEvaluatorResult.java @@ -4,26 +4,53 @@ import bjc.dicelang.Node; import bjc.utils.data.ITree; import bjc.utils.data.Tree; +/** + * Represents an evaluation ending in failure. + * + * @author student + * + */ public class FailureEvaluatorResult extends EvaluatorResult { /** * Original node data */ public ITree origVal; + /** + * Create a new generic failure. + */ public FailureEvaluatorResult() { super(Type.FAILURE); } + /** + * Create a new failure result + * + * @param orig + * The tree that caused the failure. + */ public FailureEvaluatorResult(final ITree orig) { super(Type.FAILURE); origVal = orig; } + /** + * Create a new failure result + * + * @param orig + * The node that caused the failure. + */ public FailureEvaluatorResult(final Node orig) { this(new Tree<>(orig)); } - + + /** + * Create a new failure result + * + * @param right + * The result that caused the failure. + */ public FailureEvaluatorResult(EvaluatorResult right) { this(new Node(Node.Type.RESULT, right)); } @@ -38,13 +65,18 @@ public class FailureEvaluatorResult extends EvaluatorResult { @Override public boolean equals(Object obj) { - if(this == obj) return true; - if(obj == null) return false; - if(getClass() != obj.getClass()) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; FailureEvaluatorResult other = (FailureEvaluatorResult) obj; - if(origVal == null) { - if(other.origVal != null) return false; - } else if(!origVal.equals(other.origVal)) return false; + if (origVal == null) { + if (other.origVal != null) + return false; + } else if (!origVal.equals(other.origVal)) + return false; return true; } } -- cgit v1.2.3