blob: bb979d19d04e7155b56d9036b0e8d728e60c4295 (
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
|
package bjc.dicelang.v1.ast.nodes;
import bjc.dicelang.v1.IDiceExpression;
/**
* Represents a literal backed by a dice expression
*
* @author ben
*
*/
public class DiceLiteralNode implements ILiteralDiceNode {
private IDiceExpression expression;
/**
* Create a new literal from an expression
*
* @param exp
* The expression to attempt to create a literal from
*/
public DiceLiteralNode(IDiceExpression exp) {
expression = exp;
}
@Override
public boolean canOptimize() {
return expression.canOptimize();
}
@Override
public DiceLiteralType getLiteralType() {
return DiceLiteralType.DICE;
}
/**
* Return the expression being represented
*
* @return The expression being represented
*/
public IDiceExpression getValue() {
return expression;
}
@Override
public int optimize() {
return expression.optimize();
}
@Override
public String toString() {
return expression.toString();
}
}
|