File tree 1 file changed +11
-6
lines changed
modules/symja-evaluator/src/main/java/com/symja/evaluator
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -38,37 +38,42 @@ public class Symja {
38
38
private final ThreadGroup threadGroup = new ThreadGroup ("CalculateThread" );
39
39
private final ExprEvaluator exprEvaluator ;
40
40
41
- public Symja () {
42
- init ();
41
+ private Symja () {
43
42
this .exprEvaluator = new ExprEvaluator ();
44
43
}
45
44
46
45
@ WorkerThread
47
46
public static Symja getInstance () {
48
47
synchronized (lock ) {
49
48
if (instance == null ) {
49
+ initSymja ();
50
50
instance = new Symja ();
51
51
}
52
52
}
53
53
return instance ;
54
54
}
55
55
56
56
@ WorkerThread
57
- public static void init () {
57
+ private static void initSymja () {
58
58
if (!systemInited .get ()) {
59
59
try {
60
+ if (DLog .DEBUG ) {
61
+ Log .d (TAG , "init called" );
62
+ }
60
63
semaphore .acquire ();
61
64
62
65
Config .DISPLAY_JSFIDDLE_BUTTON = false ;
63
66
Config .JAVA_AWT_DESKTOP_AVAILABLE = false ;
64
67
65
68
F .initSymbols ();
66
- ExprEvaluator exprEvaluator = new ExprEvaluator ();
67
- Log .d (TAG , String .valueOf (exprEvaluator .eval ("Sin(x)+Cos(x)" )));
68
69
69
70
systemInited .set (true );
71
+
72
+ if (DLog .DEBUG ) {
73
+ Log .d (TAG , "init done" );
74
+ }
70
75
} catch (Exception e ) { // Should not throw error
71
- e . printStackTrace ( );
76
+ Log . e ( TAG , e . getMessage (), e );
72
77
} finally {
73
78
semaphore .release ();
74
79
}
You can’t perform that action at this time.
0 commit comments