blob: aef912bb1406deac752dcb5990159936567630a6 (
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
|
package bjc.dicelang.neodice.statements;
import static bjc.dicelang.neodice.statements.StatementValue.Type.*;
import java.util.*;
/**
* Represents the boolean type for diebox.
* @author Ben Culkin
*
*/
public class BooleanStatementValue extends StatementValue {
private boolean value;
/** The true boolean instance. */
public static final BooleanStatementValue TRUE_INST = new BooleanStatementValue(true);
/** The false boolean instance. */
public static final BooleanStatementValue FALSE_INST = new BooleanStatementValue(false);
private BooleanStatementValue(boolean value) {
super(BOOLEAN);
this.value = value;
}
@Override
public String toString() {
return value ? "(true)" : "(false)";
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
BooleanStatementValue other = (BooleanStatementValue) obj;
return value == other.value;
}
}
|