summaryrefslogtreecommitdiff
path: root/base/src/bjc/dicelang/Node.java
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/bjc/dicelang/Node.java')
-rw-r--r--base/src/bjc/dicelang/Node.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/base/src/bjc/dicelang/Node.java b/base/src/bjc/dicelang/Node.java
index 4238cfc..746ba34 100644
--- a/base/src/bjc/dicelang/Node.java
+++ b/base/src/bjc/dicelang/Node.java
@@ -1,5 +1,9 @@
package bjc.dicelang;
+import static bjc.dicelang.EvaluatorResult.Type.FAILURE;
+
+import bjc.utils.data.ITree;
+
/*
* @TODO 10/09/17 Ben Culkin :NodeReorg
* Same thing, different class. Split into subclasses based off of the type
@@ -102,4 +106,25 @@ public class Node {
public int hashCode() {
return super.hashCode();
}
+
+ static Node FAIL(final EvaluatorResult res) {
+ EvaluatorResult eres = new EvaluatorResult(FAILURE, new Node(Type.RESULT, res));
+ return new Node(Type.RESULT, eres);
+ }
+
+ static Node FAIL(final Node orig) {
+ return new Node(Type.RESULT, new EvaluatorResult(FAILURE, orig));
+ }
+
+ static Node FAIL(final ITree<Node> orig) {
+ return new Node(Type.RESULT, new EvaluatorResult(FAILURE, orig));
+ }
+
+ /* @TODO 10/09/17 Ben Culkin :NodeFAIL
+ * These methods should be moved to Node.
+ */
+ /* Create a failing node. */
+ static Node FAIL() {
+ return new Node(Type.RESULT, new EvaluatorResult(FAILURE));
+ }
}