diff options
| author | student <student@69.161.224.78> | 2018-02-12 17:17:37 -0500 |
|---|---|---|
| committer | student <student@69.161.224.78> | 2018-02-12 17:17:37 -0500 |
| commit | e1480c4e706d4902f9865f6119e71e30b4173153 (patch) | |
| tree | 01377a2021af9409f02b7bd43dba8072b216948d /base/src/bjc/dicelang/eval/EvaluatorResult.java | |
| parent | 26b0cf727656b4d5984f04d73566661644c78fdd (diff) | |
Refactor EvaluatorResult
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(); + } +} |
