diff options
Diffstat (limited to 'base/src/bjc/dicelang/eval/EvaluatorResult.java')
| -rw-r--r-- | base/src/bjc/dicelang/eval/EvaluatorResult.java | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/base/src/bjc/dicelang/eval/EvaluatorResult.java b/base/src/bjc/dicelang/eval/EvaluatorResult.java new file mode 100644 index 0000000..3ac0202 --- /dev/null +++ b/base/src/bjc/dicelang/eval/EvaluatorResult.java @@ -0,0 +1,82 @@ +package bjc.dicelang.eval; + +/* + * @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; + + /** + * Create a new result. + * + * @param typ + * 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); + + intVal = iVal; + } + + @Override + public String toString() { + return type.toString(); + } +} |
