-
-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathbug1390.expected
More file actions
57 lines (45 loc) · 1.39 KB
/
bug1390.expected
File metadata and controls
57 lines (45 loc) · 1.39 KB
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
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import java.lang.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
public class bug1390 extends PApplet {
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;
public 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);
}
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "bug1390" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}