-
-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathbug1390.pde
More file actions
29 lines (23 loc) · 773 Bytes
/
bug1390.pde
File metadata and controls
29 lines (23 loc) · 773 Bytes
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
import java.lang.*;
enum Operation {
@Deprecated ADD_10(10) { protected int apply(int x) { return x + y; } },
MULT_5(5) { protected int apply(int x) { return x * y; } },
@SuppressWarnings("serial") DIV_10(10) { protected int apply(int x) { return x / y; } },
SUB_8(8) { protected int apply(int x) { return x - y; } };
final int y;
Operation(int y) {
this.y = y;
}
protected abstract int apply(int x);
}
Operation operation = Operation.ADD_10;
void setup() {
int x = 10;
println("Original:", x);
for (Operation op : Operation.values()) {
x = op.apply(x);
println(op.toString(), x);
}
x = operation.apply(x);
println(operation.toString(), x);
}