[Mathlib-commitlog] SF.net SVN: mathlib:[835] JMathLib/trunk/src/jmathlib/core/interpreter
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2009-02-08 17:04:23
|
Revision: 835
http://mathlib.svn.sourceforge.net/mathlib/?rev=835&view=rev
Author: st_mueller
Date: 2009-02-08 17:04:20 +0000 (Sun, 08 Feb 2009)
Log Message:
-----------
removed applet-parameter from Interpreter-constructor
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-02-08 16:46:13 UTC (rev 834)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-02-08 17:04:20 UTC (rev 835)
@@ -10,10 +10,8 @@
package jmathlib.core.interpreter;
import java.io.*;
-import java.net.URL;
import java.util.Locale;
import java.util.Properties;
-import java.applet.Applet;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
@@ -34,12 +32,12 @@
/**A list of contexts*/
private ContextList contextList;
+ /** flag to indicate if JMathLib is running standalone or as applet,servlet */
+ private boolean runningStandalone = false;
+
/**Object to control function usage*/
private jmathlib.core.functions.FunctionManager functionManager;
- /** global pointer to applet */
- private Applet applet = null;
-
/**A pointer to the interpreter itself*/
private Interpreter interpreter;
@@ -59,16 +57,17 @@
* @param _interpreter = the Interpreter object
* @param _runningStandalone = true if this was run from an application
*/
- public GlobalValues(Interpreter _interpreter, boolean _runningStandalone, Applet _applet)
+ public GlobalValues(Interpreter _interpreter, boolean _runningStandalone)
{
+
+ // flag for stand alone or applet,servlet,...
+ runningStandalone = _runningStandalone;
+
// the list of contexts
contextList = new ContextList();
- // pointer to applet
- applet = _applet;
-
// the function manager for loading m-files class-files
- functionManager = new jmathlib.core.functions.FunctionManager(_runningStandalone, applet);
+ functionManager = new jmathlib.core.functions.FunctionManager(_runningStandalone);
// the graphics manager for plotting functions
graphicsManager = new jmathlib.core.graphics.GraphicsManager();
@@ -235,13 +234,14 @@
// load global properties from disc
try
{
- // check if JMathLib is running is applet or application
- if (applet != null)
+ // check if JMathLib is running as applet or application
+ if (!runningStandalone)
{
// running as applet
//System.out.println("properties applet " + getWorkingDirectory());
- URL url = new URL(applet.getCodeBase(), "JMathLib.properties");
- props.load( url.openStream() );
+ //URL url = new URL(applet.getCodeBase(), "JMathLib.properties");
+ InputStream in = GlobalValues.class.getResourceAsStream("../../../JMathLib.properties");
+ props.load( in); //url.openStream() );
}
else
{
@@ -280,7 +280,7 @@
public void storePropertiesToFile()
{
// do not try to store properties is an applet
- if (applet!=null)
+ if (!runningStandalone)
return;
// store properties back to file
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java 2009-02-08 16:46:13 UTC (rev 834)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java 2009-02-08 17:04:20 UTC (rev 835)
@@ -12,7 +12,6 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.interfaces.MathLibOutput;
-import java.applet.Applet;
/**This is the main interface for the program. Any interface to the MathLib program would access
it through the functions exposed by this class.*/
@@ -30,26 +29,20 @@
/**for testing purposes additional throwing of errors can be enables */
public boolean throwErrorsB = false;
- /**Constructs the interpreter and sets the constants
- * @param _runningStandalone = true if this is being used from an application
- */
- public Interpreter(boolean _runningStandalone)
- {
- this(_runningStandalone, null);
- }
-
- /**Constructs the interpreter and sets the constants
+ /**
+ * Constructs the interpreter and sets the constants
* @param _runningStandalone = true if this is being used from an application
- * @param _applet pointer to applet structure if this is an applet and not an
- * application
*/
- public Interpreter(boolean _runningStandalone, Applet _applet)
+ public Interpreter(boolean _runningStandalone)
{
- runningStandalone = _runningStandalone;
+ // indicator if this is a stand alone application or
+ // if JMathLib is running as an applet or servlet or ... without
+ // direct access to the file system
+ runningStandalone = _runningStandalone;
// initialize global pointers, this pointer will be passed to
// all expressions for access to function manager, variable lists, contexts,...
- globals = new GlobalValues(this, runningStandalone, _applet);;
+ globals = new GlobalValues(this, runningStandalone);
// set output panel to NULL
// ?? needed? outputPanel is initialized with NULl anyway (see above)
@@ -60,7 +53,8 @@
}
- /**sets the panel to write any text to
+ /**
+ * sets the panel to write any text to
* @param _outputPanel = the panel to write to, must implement the
* MathLibOutput interface
*/
@@ -69,7 +63,8 @@
outputPanel = _outputPanel;
}
- /**returns the panel to write any text to
+ /**
+ * returns the panel to write any text to
* @return outputPanel = the panel to write to
*/
public MathLibOutput getOutputPanel()
@@ -77,7 +72,8 @@
return outputPanel;
}
- /**displays a string to the outputPanel
+ /**
+ * displays a string to the outputPanel
* @param text = the text to display
*/
public void displayText(String text)
@@ -86,7 +82,8 @@
outputPanel.displayText(text);
}
- /**saves the variable list
+ /**
+ * saves the variable list
*/
public void save()
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|