blob: 3ac0202756826180304969016b8b939362445b83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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();
}
}
|