mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 13:21:07 +01:00
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
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);
|
|
}
|
|
}
|
|
}
|