blob: ff86447bdec50fc6edce0a05bdc07a2719c9c3b0 (
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
83
84
85
|
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;
/**
* Create a new result.
*
* @param typ
* The type of the result.
*/
protected EvaluatorResult(final EvaluatorResult.Type typ) {
type = typ;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EvaluatorResult other = (EvaluatorResult) obj;
if (type != other.type)
return false;
return true;
}
@Override
public String toString() {
return "EvaluatorResult [type=" + type + "]";
}
}
|