diff options
| author | student <student@localhost> | 2018-02-12 11:30:54 -0500 |
|---|---|---|
| committer | student <student@localhost> | 2018-02-12 11:30:54 -0500 |
| commit | d7af27dab45dd6f82c27519e6b4fd2faa162f884 (patch) | |
| tree | 1907cc51f97f841b1fff2238b54096a20386a704 /base/src/bjc/dicelang/Node.java | |
| parent | 5b827a1bdba27f763c035553f7bdb8da4f9cf71a (diff) | |
Refactor SCL token into seperate class
Diffstat (limited to 'base/src/bjc/dicelang/Node.java')
| -rw-r--r-- | base/src/bjc/dicelang/Node.java | 25 |
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)); + } } |
