blob: 76d0c5928d24beb41ebcf71a30148f229dd84ab9 (
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
|
package org.zwobble.couscous.values;
import static java.util.Arrays.asList;
import lombok.Value;
import lombok.val;
@Value
public class IntegerValue implements InterpreterValue {
public static final ConcreteType<?> TYPE = ConcreteType.<IntegerValue>builder("Integer")
.staticMethod("parseInt", () -> asList(StringValue.TYPE),
(environment, arguments) -> {
val value = (StringValue)arguments.get(0);
return new IntegerValue(Integer.parseInt(value.getValue()));
})
.build();
int value;
@Override
public ConcreteType<?> getType() {
return TYPE;
}
}
|