2121 */
2222public class RLangPApplet extends PApplet {
2323
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+
2433 /**
2534 * Mode for Processing.
2635 *
@@ -35,7 +44,7 @@ private enum Mode {
3544 // definitions, which we then invoke during the run loop.
3645 private final Mode mode ;
3746
38- /** Program Code */
47+ /** Program code */
3948 private final String programText ;
4049
4150 /** Engine to interpret R code */
@@ -57,7 +66,7 @@ public void prePassCode() {
5766 if (source .getClass ().equals (ExpressionVector .class )) {
5867 ExpressionVector ev = (ExpressionVector ) source ;
5968 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());
6170 if (ev .get (i ).getClass ().equals (FunctionCall .class )) {
6271 this .renjinEngine .getTopLevelContext ().evaluate (ev .get (i ),
6372 this .renjinEngine .getTopLevelContext ().getEnvironment ());
@@ -112,7 +121,7 @@ public void setup() {
112121 try {
113122 this .renjinEngine .eval (this .programText );
114123 } catch (ScriptException e ) {
115- System . out . println ( e );
124+ log ( e . toString () );
116125 }
117126 } else if (this .mode == Mode .ACTIVE ) {
118127 Object obj = this .renjinEngine .get (Constant .SETUP_NAME );
0 commit comments