21
21
*/
22
22
public class RLangPApplet extends PApplet {
23
23
24
+ public static boolean VERBOSE = Boolean .getBoolean ("verbose" );
25
+
26
+ private static void log (String msg ) {
27
+ if (!VERBOSE ) {
28
+ return ;
29
+ }
30
+ System .err .println (RLangPApplet .class .getSimpleName () + ": " + msg );
31
+ }
32
+
24
33
/**
25
34
* Mode for Processing.
26
35
*
@@ -35,7 +44,7 @@ private enum Mode {
35
44
// definitions, which we then invoke during the run loop.
36
45
private final Mode mode ;
37
46
38
- /** Program Code */
47
+ /** Program code */
39
48
private final String programText ;
40
49
41
50
/** Engine to interpret R code */
@@ -57,7 +66,7 @@ public void prePassCode() {
57
66
if (source .getClass ().equals (ExpressionVector .class )) {
58
67
ExpressionVector ev = (ExpressionVector ) source ;
59
68
for (int i = 0 ; i < ev .length (); ++i ) {
60
- System . out . println ( ev .get (i ).getClass ());
69
+ // LOGGER.info("The type of expression is ", ev.get(i).getClass());
61
70
if (ev .get (i ).getClass ().equals (FunctionCall .class )) {
62
71
this .renjinEngine .getTopLevelContext ().evaluate (ev .get (i ),
63
72
this .renjinEngine .getTopLevelContext ().getEnvironment ());
@@ -112,7 +121,7 @@ public void setup() {
112
121
try {
113
122
this .renjinEngine .eval (this .programText );
114
123
} catch (ScriptException e ) {
115
- System . out . println ( e );
124
+ log ( e . toString () );
116
125
}
117
126
} else if (this .mode == Mode .ACTIVE ) {
118
127
Object obj = this .renjinEngine .get (Constant .SETUP_NAME );
0 commit comments