summaryrefslogtreecommitdiff
path: root/base/src/bjc/dicelang/EvaluatorResult.java
diff options
context:
space:
mode:
authorstudent <student@69.161.224.78>2018-02-12 17:17:37 -0500
committerstudent <student@69.161.224.78>2018-02-12 17:17:37 -0500
commite1480c4e706d4902f9865f6119e71e30b4173153 (patch)
tree01377a2021af9409f02b7bd43dba8072b216948d /base/src/bjc/dicelang/EvaluatorResult.java
parent26b0cf727656b4d5984f04d73566661644c78fdd (diff)
Refactor EvaluatorResult
Diffstat (limited to 'base/src/bjc/dicelang/EvaluatorResult.java')
-rw-r--r--base/src/bjc/dicelang/EvaluatorResult.java223
1 files changed, 0 insertions, 223 deletions
diff --git a/base/src/bjc/dicelang/EvaluatorResult.java b/base/src/bjc/dicelang/EvaluatorResult.java
deleted file mode 100644
index 0d0706a..0000000
--- a/base/src/bjc/dicelang/EvaluatorResult.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package bjc.dicelang;
-
-import bjc.dicelang.dice.Die;
-import bjc.dicelang.dice.DiceExpression;
-import bjc.dicelang.dice.DieList;
-import bjc.dicelang.dice.ListDiceExpression;
-import bjc.dicelang.dice.ScalarDiceExpression;
-import bjc.utils.data.ITree;
-import bjc.utils.data.Tree;
-
-/*
- * @TODO 10/09/17 Ben Culkin :EvalResultReorg
- *
- * Again, split it into separate classes based off of the type.
- */
-/**
- * The result from the evaluator.
- *
- * @author EVE
- *
- */
-public class EvaluatorResult {
- /**
- * The type of the result.
- *
- * @author EVE
- *
- */
- public static enum Type {
- /**
- * The type of a failure.
- */
- FAILURE,
- /**
- * The type of an integer.
- */
- INT,
- /**
- * The type of a float.
- */
- FLOAT,
- /**
- * The type of a dice.
- */
- DICE,
- /**
- * The type of a string.
- */
- STRING
- }
-
- /**
- * The type of the result.
- */
- 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;
- /**
- * The float value of the result.
- */
- public double floatVal;
- /**
- * The dice value of the result.
- */
- public DiceExpression diceVal;
- /**
- * The string value of the result.
- */
- public String stringVal;
-
- /**
- * Original node data
- */
- public ITree<Node> origVal;
-
- /**
- * Create a new result.
- *
- * @param typ
- * The type of the result.
- */
- public EvaluatorResult(final EvaluatorResult.Type typ) {
- type = typ;
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * The type of the result.
- *
- * @param orig
- * The original value of the result.
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final ITree<Node> orig) {
- this(typ);
-
- origVal = orig;
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * The type of the result.
- *
- * @param orig
- * The original value of the result.
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final Node orig) {
- this(typ, new Tree<>(orig));
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param orig
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final EvaluatorResult orig) {
- this(typ, new Node(Node.Type.RESULT, orig));
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param iVal
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final long iVal) {
- this(typ);
-
- intVal = iVal;
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param dVal
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final double dVal) {
- this(typ);
-
- floatVal = dVal;
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param dVal
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final DiceExpression dVal) {
- this(typ);
-
- diceVal = dVal;
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param dVal
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final Die dVal) {
- this(typ);
-
- diceVal = new ScalarDiceExpression(dVal);
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param dVal
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final DieList dVal) {
- this(typ);
-
- diceVal = new ListDiceExpression(dVal);
- }
-
- /**
- * Create a new result.
- *
- * @param typ
- * @param strang
- */
- public EvaluatorResult(final EvaluatorResult.Type typ, final String strang) {
- this(typ);
-
- stringVal = strang;
- }
-
- @Override
- public String toString() {
- switch (type) {
- case INT:
- return type.toString() + "(" + intVal + ")";
-
- case FLOAT:
- return type.toString() + "(" + floatVal + ")";
-
- case DICE:
- return type.toString() + "(" + diceVal + ")";
-
- case STRING:
- return type.toString() + "(" + stringVal + ")";
-
- case FAILURE:
- return type.toString();
-
- default:
- return "Unknown result type " + type.toString();
- }
- }
-}