Thread: [Mathlib-commitlog] SF.net SVN: mathlib:[590] JMathLib/trunk/src/jmathlib/core/interpreter/ GlobalV
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2008-12-31 15:08:16
|
Revision: 590
http://mathlib.svn.sourceforge.net/mathlib/?rev=590&view=rev
Author: st_mueller
Date: 2008-12-31 15:08:12 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
removed obsolete variable
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2008-12-31 13:37:20 UTC (rev 589)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2008-12-31 15:08:12 UTC (rev 590)
@@ -37,9 +37,6 @@
/**Object to control plugins */
static transient private jmathlib.plugins.PluginsManager pluginsManager;
- /**The working directory */
- static transient private File workingDir;
-
/**sets whether to write debug lines to console and log files*/
static transient private boolean debug = true;
@@ -65,9 +62,6 @@
//set up a pointer to the interpreter object
interpreter = _interpreter;
- // set working directory to actual directory
- workingDir = new File(".");
-
// set up plugins manager
pluginsManager = new jmathlib.plugins.PluginsManager();
pluginsManager.setInterpreter(interpreter);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:01:00
|
Revision: 616
http://mathlib.svn.sourceforge.net/mathlib/?rev=616&view=rev
Author: st_mueller
Date: 2009-01-05 15:00:55 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-05 15:00:37 UTC (rev 615)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-05 15:00:55 UTC (rev 616)
@@ -8,6 +8,7 @@
import java.text.NumberFormat;
import jmathlib.core.interpreter.Interpreter;
+import jmathlib.core.tokens.OperandToken;
/**This class contains the global variables, which are accessible throughout the program.
These include
@@ -70,9 +71,9 @@
}
/**@return the current variable list*/
- protected VariableList getVariables()
+ protected VariableList getLocalVariables()
{
- return contextList.getVariables();
+ return contextList.getLocalVariables();
}
/**@return the global variable list*/
@@ -81,12 +82,24 @@
return contextList.getGlobalVariables();
}
- /**@return the global variable list*/
+ /**@return the a variable from local or global workspace*/
protected Variable getVariable(String name)
{
return contextList.getVariable(name);
}
+ /** create a variable in the local or global workspace*/
+ protected Variable createVariable(String name)
+ {
+ return contextList.createVariable(name);
+ }
+
+ /** create a variable in the local or global workspace*/
+ protected void setVariable(String name, OperandToken value)
+ {
+ contextList.setVariable(name, value);
+ }
+
/**Change the current context to point to the new Variable List
@param _Variables = the new list of Variables to use*/
protected void createContext(VariableList _variables)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 20:33:41
|
Revision: 734
http://mathlib.svn.sourceforge.net/mathlib/?rev=734&view=rev
Author: st_mueller
Date: 2009-01-23 20:33:31 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-23 20:29:16 UTC (rev 733)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-23 20:33:31 UTC (rev 734)
@@ -21,28 +21,28 @@
public class GlobalValues
{
/**A list of contexts*/
- static transient private ContextList contextList;
+ private ContextList contextList;
/**Object to control function usage*/
- static transient private jmathlib.core.functions.FunctionManager functionManager;
+ private jmathlib.core.functions.FunctionManager functionManager;
/**Class Loader for loading classes for handling casting*/
//static transient private MathLib.Casts.CastClassLoader castClassLoader;
/**A pointer to the interpreter itself*/
- static transient private Interpreter interpreter;
+ private Interpreter interpreter;
/**Object to control graphical output*/
- static transient private jmathlib.core.graphics.GraphicsManager graphicsManager;
+ private jmathlib.core.graphics.GraphicsManager graphicsManager;
/**Object to control plugins */
- static transient private jmathlib.plugins.PluginsManager pluginsManager;
+ private jmathlib.plugins.PluginsManager pluginsManager;
/**sets whether to write debug lines to console and log files*/
- static transient private boolean debug = true;
+ private boolean debug = true;
/**stores the number format for displaying the number*/
- public transient static NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
+ public /*static transient*/ NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
/**Initialises the global values
@param _interpreter = the Interpreter object
@@ -70,104 +70,120 @@
}
- /**@return the current variable list*/
- protected VariableList getLocalVariables()
+ /**
+ * @return the current variable list
+ */
+ public VariableList getLocalVariables()
{
return contextList.getLocalVariables();
}
- /**@return the global variable list*/
- protected VariableList getGlobalVariables()
+ /**
+ * @return the global variable list
+ */
+ public VariableList getGlobalVariables()
{
return contextList.getGlobalVariables();
}
- /**@return the a variable from local or global workspace*/
- protected Variable getVariable(String name)
+ /**
+ * @param
+ * @return the a variable from local or global workspace
+ */
+ public Variable getVariable(String name)
{
return contextList.getVariable(name);
}
- /** create a variable in the local or global workspace*/
- protected Variable createVariable(String name)
+ /** create a variable in the local or global workspace
+ * @param
+ * @return
+ */
+ public Variable createVariable(String name)
{
return contextList.createVariable(name);
}
- /** create a variable in the local or global workspace*/
- protected void setVariable(String name, OperandToken value)
+ /** create a variable in the local or global workspace
+ * @param
+ * @param
+ */
+ public void setVariable(String name, OperandToken value)
{
contextList.setVariable(name, value);
}
/**Change the current context to point to the new Variable List
- @param _Variables = the new list of Variables to use*/
- protected void createContext(VariableList _variables)
+ * @param _Variables = the new list of Variables to use
+ */
+ public void createContext(VariableList _variables)
{
contextList.createContext(_variables);
}
- /**Return to the previous variable list*/
- protected void popContext()
+ /**Return to the previous variable list
+ */
+ public void popContext()
{
contextList.popContext();
}
- /**Allow access to the context list*/
- protected ContextList getContextList()
+ /**Allow access to the context list
+ * @return
+ */
+ public ContextList getContextList()
{
return contextList;
}
- /**@return the interpreter object*/
- protected Interpreter getInterpreter()
+ /**@return the interpreter object
+ * @return
+ */
+ public Interpreter getInterpreter()
{
return interpreter;
}
- /**@return the function manager*/
- protected jmathlib.core.functions.FunctionManager getFunctionManager()
+ /**
+ * @return the function manager
+ */
+ public jmathlib.core.functions.FunctionManager getFunctionManager()
{
return functionManager;
}
- /**@return handle to graphics manager*/
- protected jmathlib.core.graphics.GraphicsManager getGraphicsManager()
+ /**
+ * @return handle to graphics manager
+ */
+ public jmathlib.core.graphics.GraphicsManager getGraphicsManager()
{
return graphicsManager;
}
- /**@return handle to plugins manager*/
- protected jmathlib.plugins.PluginsManager getPluginsManager()
+ /**
+ * @return handle to plugins manager
+ */
+ public jmathlib.plugins.PluginsManager getPluginsManager()
{
return pluginsManager;
}
- /** @return actual working directory */
- protected File getWorkingDirectory()
+ /**
+ * @return actual working directory
+ */
+ public File getWorkingDirectory()
{
return functionManager.getWorkingDirectory();
}
- /** @param set working directory */
- protected void setWorkingDirectory(File _workingDir)
+ /**
+ * @param set working directory
+ */
+ public void setWorkingDirectory(File _workingDir)
{
functionManager.setWorkingDirectory(_workingDir);
}
- /**@return the setting of the debug flag*/
- public boolean getDebug()
- {
- return debug;
- }
-
- /**sets the debug flag
- @param _debug = should debug information be displayed*/
- public void setDebug(boolean _debug)
- {
- debug= _debug;
- }
-
/**
* returns the number format for displaying numbers
* @return format type
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-24 19:40:57
|
Revision: 756
http://mathlib.svn.sourceforge.net/mathlib/?rev=756&view=rev
Author: st_mueller
Date: 2009-01-24 19:40:48 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-24 19:39:52 UTC (rev 755)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-24 19:40:48 UTC (rev 756)
@@ -39,7 +39,7 @@
private jmathlib.plugins.PluginsManager pluginsManager;
/**sets whether to write debug lines to console and log files*/
- private boolean debug = true;
+ //private boolean debug = true;
/**stores the number format for displaying the number*/
public /*static transient*/ NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-26 20:04:15
|
Revision: 788
http://mathlib.svn.sourceforge.net/mathlib/?rev=788&view=rev
Author: st_mueller
Date: 2009-01-26 20:04:13 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
added more comments
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-26 20:00:09 UTC (rev 787)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-26 20:04:13 UTC (rev 788)
@@ -1,3 +1,12 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2002-2009
+ */
+
package jmathlib.core.interpreter;
import java.io.*;
@@ -26,9 +35,6 @@
/**Object to control function usage*/
private jmathlib.core.functions.FunctionManager functionManager;
- /**Class Loader for loading classes for handling casting*/
- //static transient private MathLib.Casts.CastClassLoader castClassLoader;
-
/**A pointer to the interpreter itself*/
private Interpreter interpreter;
@@ -38,28 +44,24 @@
/**Object to control plugins */
private jmathlib.plugins.PluginsManager pluginsManager;
- /**sets whether to write debug lines to console and log files*/
- //private boolean debug = true;
-
/**stores the number format for displaying the number*/
- public /*static transient*/ NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
+ public NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
/**Initialises the global values
- @param _interpreter = the Interpreter object
- @param _runningStandalone = true if this was run from an application*/
+ * @param _interpreter = the Interpreter object
+ * @param _runningStandalone = true if this was run from an application
+ */
public GlobalValues(Interpreter _interpreter, boolean _runningStandalone, Applet applet)
{
+ // the list of contexts
contextList = new ContextList();
+ // the function manager for loading m-files class-files
functionManager = new jmathlib.core.functions.FunctionManager(_runningStandalone, applet);
+ // the graphics manager for plotting functions
graphicsManager = new jmathlib.core.graphics.GraphicsManager();
- //if(_runningStandalone)
- // castClassLoader = new MathLib.Casts.CastClassLoader("." + File.separator, flags);
- //else
- // castClassLoader = null;
-
//set up a pointer to the interpreter object
interpreter = _interpreter;
@@ -136,8 +138,8 @@
return contextList;
}
- /**@return the interpreter object
- * @return
+ /**returns the interpreter object
+ * @return pointer to Interpreter
*/
public Interpreter getInterpreter()
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-31 14:42:19
|
Revision: 808
http://mathlib.svn.sourceforge.net/mathlib/?rev=808&view=rev
Author: st_mueller
Date: 2009-01-31 14:42:09 +0000 (Sat, 31 Jan 2009)
Log Message:
-----------
corrections of "property loading"
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-31 14:41:39 UTC (rev 807)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-31 14:42:09 UTC (rev 808)
@@ -10,6 +10,7 @@
package jmathlib.core.interpreter;
import java.io.*;
+import java.net.URL;
import java.util.Locale;
import java.util.Properties;
import java.applet.Applet;
@@ -36,6 +37,9 @@
/**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;
@@ -46,7 +50,7 @@
private jmathlib.plugins.PluginsManager pluginsManager;
/**stores the number format for displaying the number*/
- public NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
+ private NumberFormat numFormat = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH));
/** global properties */
private static Properties props = new Properties();
@@ -55,11 +59,14 @@
* @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, Applet _applet)
{
// 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);
@@ -101,25 +108,28 @@
return contextList.getVariable(name);
}
- /** create a variable in the local or global workspace
- * @param
- * @return
+ /**
+ * Create a variable in the local or global workspace
+ * @param creates a new variable
+ * @return returns the handle to that variable
*/
public Variable createVariable(String name)
{
return contextList.createVariable(name);
}
- /** create a variable in the local or global workspace
- * @param
- * @param
+ /**
+ * Create a variable in the local or global workspace
+ * @param name of the variable
+ * @param data of the variable
*/
public void setVariable(String name, OperandToken value)
{
contextList.setVariable(name, value);
}
- /**Change the current context to point to the new Variable List
+ /**
+ * Change the current context to point to the new Variable List
* @param _Variables = the new list of Variables to use
*/
public void createContext(VariableList _variables)
@@ -127,22 +137,25 @@
contextList.createContext(_variables);
}
- /**Return to the previous variable list
+ /**
+ * Return to the previous variable list
*/
public void popContext()
{
contextList.popContext();
}
- /**Allow access to the context list
- * @return
+ /**
+ * Allow access to the context list
+ * @return the context list
*/
public ContextList getContextList()
{
return contextList;
}
- /**returns the interpreter object
+ /**
+ * Returns the interpreter object
* @return pointer to Interpreter
*/
public Interpreter getInterpreter()
@@ -151,6 +164,7 @@
}
/**
+ * Returns a handle to the function manager
* @return the function manager
*/
public jmathlib.core.functions.FunctionManager getFunctionManager()
@@ -159,6 +173,7 @@
}
/**
+ * Returns a handle to the graphics manager
* @return handle to graphics manager
*/
public jmathlib.core.graphics.GraphicsManager getGraphicsManager()
@@ -167,6 +182,7 @@
}
/**
+ * Returns a handle to the plugin manager
* @return handle to plugins manager
*/
public jmathlib.plugins.PluginsManager getPluginsManager()
@@ -175,6 +191,7 @@
}
/**
+ * Returns the working directory
* @return actual working directory
*/
public File getWorkingDirectory()
@@ -183,6 +200,7 @@
}
/**
+ * Sets the working directory
* @param set working directory
*/
public void setWorkingDirectory(File _workingDir)
@@ -209,22 +227,42 @@
}
/**
- *
- *
+ * load JMathLib properties from a file or in applet version
+ * from the web server.
*/
public void loadPropertiesFromFile()
{
-
// load global properties from disc
try
{
- props.load(new FileInputStream(new File("JMathLib.properties")));
+ // check if JMathLib is running is applet or application
+ if (applet != null)
+ {
+ // running as applet
+ //System.out.println("properties applet " + getWorkingDirectory());
+ URL url = new URL(applet.getCodeBase(), "JMathLib.properties");
+ props.load( url.openStream() );
+ }
+ else
+ {
+ // running as application
+ File f = new File("JMathLib.properties");
+
+ // check if property file exist in "working directory" or
+ // if it is not available yet, then take the original one
+ // from the bin directory
+ if (!f.exists())
+ f = new File("bin/JMathLib.properties");
+
+ // load properties
+ //System.out.println("properties file "+f.getCanonicalPath().toString());
+ props.load(new FileInputStream(f));
+ }
}
catch (Exception e)
{
System.out.println("Properties global error");
}
- //System.out.println("Properties loaded");
// display properties
//Enumeration propnames = props.propertyNames();
@@ -233,32 +271,37 @@
// String propname = (String)globalPropnames.nextElement();
// System.out.println("Property: "+propname+" = "+globalProps.getProperty(propname));
//}
-
-
}
/**
- *
+ * store properties back to a file on disc. In applet version
+ * do not store, since there is no disc
*/
public void storePropertiesToFile()
{
+ // do not try to store properties is an applet
+ if (applet!=null)
+ return;
// store properties back to file
try
{
- props.store(new FileOutputStream(new File("JMathLib.properties")),
+ File f = new File("JMathLib.properties");
+ //System.out.println("properties file "+f.getCanonicalPath().toString());
+
+ props.store(new FileOutputStream(f.getCanonicalPath()),
"JMathLib property file" );
}
catch (Exception e)
{
- System.out.println("Property: Error");
+ System.out.println("GlobalVAues: properties store error");
}
}
/**
- *
+ * Returns one of JMathLib's properties
* @param property
- * @return
+ * @return string value of the requested property
*/
public String getProperty(String property)
{
@@ -266,9 +309,9 @@
}
/**
- *
- * @param property
- * @param value
+ * Sets a property of JMathLib
+ * @param name of property
+ * @param value of property
*/
public void setProperty(String property, String value)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|