mathlib-commitlog Mailing List for JMathLib - Octave, Matlab clone in java (Page 8)
Status: Beta
Brought to you by:
st_mueller
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(4) |
Aug
(150) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(233) |
Feb
(86) |
Mar
(32) |
Apr
(26) |
May
(73) |
Jun
(45) |
Jul
(23) |
Aug
(23) |
Sep
(5) |
Oct
(80) |
Nov
(11) |
Dec
(11) |
| 2008 |
Jan
|
Feb
|
Mar
(13) |
Apr
(3) |
May
(7) |
Jun
(30) |
Jul
(12) |
Aug
(12) |
Sep
|
Oct
|
Nov
(78) |
Dec
(78) |
| 2009 |
Jan
(214) |
Feb
(79) |
Mar
(20) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <st_...@us...> - 2009-01-24 08:54:52
|
Revision: 735
http://mathlib.svn.sourceforge.net/mathlib/?rev=735&view=rev
Author: st_mueller
Date: 2009-01-24 08:54:41 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
added more tests
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java
JMathLib/trunk/src/jmathlibtests/toolbox/funfun/AllTests.java
JMathLib/trunk/src/jmathlibtests/toolbox/funfun/testFeval.java
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/help/
JMathLib/trunk/src/jmathlibtests/toolbox/help/AllTests.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java 2009-01-23 20:33:31 UTC (rev 734)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java 2009-01-24 08:54:41 UTC (rev 735)
@@ -1,3 +1,12 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2007, 2008, 2009
+ */
+
package jmathlibtests.toolbox.ftp;
import jmathlib.tools.junit.framework.*;
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/funfun/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/funfun/AllTests.java 2009-01-23 20:33:31 UTC (rev 734)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/funfun/AllTests.java 2009-01-24 08:54:41 UTC (rev 735)
@@ -1,3 +1,12 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2007, 2008, 2009
+ */
+
package jmathlibtests.toolbox.funfun;
import jmathlib.tools.junit.framework.*;
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/funfun/testFeval.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/funfun/testFeval.java 2009-01-23 20:33:31 UTC (rev 734)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/funfun/testFeval.java 2009-01-24 08:54:41 UTC (rev 735)
@@ -1,3 +1,12 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2007, 2008, 2009
+ */
+
package jmathlibtests.toolbox.funfun;
import jmathlib.core.interpreter.Interpreter;
Added: JMathLib/trunk/src/jmathlibtests/toolbox/help/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/help/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/help/AllTests.java 2009-01-24 08:54:41 UTC (rev 735)
@@ -0,0 +1,34 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2007, 2008, 2009
+ */
+
+package jmathlibtests.toolbox.help;
+
+import jmathlib.tools.junit.framework.*;
+
+/**
+ * TestSuite that runs all the tests
+ *
+ */
+public class AllTests {
+
+ public static void main (String[] args) {
+ jmathlib.tools.junit.textui.TestRunner.run (suite());
+ }
+ public static Test suite ( ) {
+ TestSuite suite= new TestSuite("help functions");
+
+ /* include subdirectories here */
+ // none
+
+ /* include tests in this directory here */
+ // none yet
+
+ return suite;
+ }
+}
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-23 20:29:25
|
Revision: 733
http://mathlib.svn.sourceforge.net/mathlib/?rev=733&view=rev
Author: st_mueller
Date: 2009-01-23 20:29:16 +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/RootObject.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/RootObject.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/RootObject.java 2009-01-23 20:23:41 UTC (rev 732)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/RootObject.java 2009-01-23 20:29:16 UTC (rev 733)
@@ -1,143 +1,43 @@
package jmathlib.core.interpreter;
import java.io.*;
-import java.text.NumberFormat;
-import java.applet.Applet;
-import jmathlib.core.interpreter.Interpreter;
import jmathlib.core.tokens.OperandToken;
-import jmathlib.core.functions.FunctionManager;
-/**This universal the base class for all class define by MathLib.
+/**This universal the base class for all class define by JMathLib.
It defines Global values as class variables and also defines functions for creating and accessing the working environment.*/
-abstract public class RootObject implements java.io.Serializable,
- java.lang.Cloneable,
- jmathlib.core.constants.ErrorCodes,
- jmathlib.core.constants.TokenConstants
+public class RootObject implements java.io.Serializable,
+ java.lang.Cloneable,
+ jmathlib.core.constants.ErrorCodes,
+ jmathlib.core.constants.TokenConstants
{
- /**store all the global values*/
- static transient private GlobalValues globals = null;
-
- /**Convert the object into a string*/
+ /**
+ *
+ */
+ public RootObject()
+ {
+ }
+
+ /**Convert the object into a string
+ * @param
+ */
public String toString()
{
return "";
}
/**Converts the object to a string based on the operand list
- @param operands = operands for the expression*/
+ * @param operands = operands for the expression
+ */
public String toString(OperandToken[] operands)
{
return "root object";
}
- /**Set the constant values
- @param _runnginStandalone = true if this is an application
- @param _interpreter = the interpreter object
- */
- protected final void setConstants(boolean _runningStandalone, Interpreter _interpreter, Applet applet)
- {
- if(globals == null)
- {
- globals = new GlobalValues(_interpreter, _runningStandalone, applet);
- }
- }
- /**
- * @return the current variable list
- */
- protected final VariableList getLocalVariables()
- {
- return globals.getLocalVariables();
- }
-
- /**
- * @return the global variable list
- */
- protected final VariableList getGlobalVariables()
- {
- return globals.getGlobalVariables();
- }
-
- /**
- * @param
- * @return the variable from local or global workspace
- */
- protected final Variable getVariable(String name)
- {
- return globals.getVariable(name);
- }
-
- /** create a variable in the local or global workspace
- * @param
- * @return
- */
- protected final Variable createVariable(String name)
- {
- return globals.createVariable(name);
- }
-
- /** set a variable in the local workspace
- * @param
- * @param
- */
- protected final void setVariable(String name, OperandToken value)
- {
- globals.setVariable(name, value);
- }
-
- /** Allow access to the context list
- * @return
- */
- protected final ContextList getContextList()
- {
- return globals.getContextList();
- }
-
- /**
- * @return the interpreter object
- */
- protected final Interpreter getInterpreter()
- {
- return globals.getInterpreter();
- }
-
- /**
- * @return the function manager
- */
- public final FunctionManager getFunctionManager()
- {
- return globals.getFunctionManager();
- }
-
- /**@return handle to plugins manager*/
- protected jmathlib.plugins.PluginsManager getPluginsManager()
- {
- return globals.getPluginsManager();
- }
-
- /** @return actual working directory */
- protected File getWorkingDirectory()
- {
- return globals.getWorkingDirectory();
- }
-
- /** Sets the base directory used for all file operations
- @param _workingDir = the working directory to use*/
- protected void setWorkingDirectory(File _workingDir)
- {
- globals.setWorkingDirectory( _workingDir);
- }
-
- /**@return handle to graphics manager*/
- protected jmathlib.core.graphics.GraphicsManager getGraphicsManager()
- {
- return globals.getGraphicsManager();
- }
-
-
/**Duplicates the object by serialising it to a piped stream then reading it back into
- the new object*/
+ * the new object
+ */
public Object clone()
{
@@ -174,47 +74,17 @@
}
catch(java.io.IOException except)
{
- ErrorLogger.debugLine("IO exception");
+ ErrorLogger.debugLine("RootObject: IO exception");
ErrorLogger.debugLine(except.getMessage());
//except.printStackTrace();
}
catch(java.lang.ClassNotFoundException except)
{
- ErrorLogger.debugLine("Class not found exception");
+ ErrorLogger.debugLine("RootObject: Class not found exception");
}
return copy;
}
- /**@return the setting of the debug flag*/
- static public final boolean getDebug()
- {
- return globals.getDebug();
- }
-
- /**sets the debug flag
- @param _debug = should debug information be displayed*/
- static public final void setDebug(boolean _debug)
- {
- globals.setDebug(_debug);
- }
- /**
- * returns the number format for displaying numbers
- * @return format type
- */
- public NumberFormat getNumberFormat()
- {
- return globals.getNumberFormat();
- }
-
- /**
- * sets the number format for displaying numbers
- * @param _numFormat format type
- */
- public void setNumberFormat(NumberFormat numFormat)
- {
- globals.setNumberFormat(numFormat);
- }
-
}
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:23:44
|
Revision: 732
http://mathlib.svn.sourceforge.net/mathlib/?rev=732&view=rev
Author: st_mueller
Date: 2009-01-23 20:23:41 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
check upper and lower case of function names: e.g. sin is unequal to SIN
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
Modified: JMathLib/trunk/src/jmathlib/ui/awt/GUI.java
===================================================================
--- JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-01-23 20:11:12 UTC (rev 731)
+++ JMathLib/trunk/src/jmathlib/ui/awt/GUI.java 2009-01-23 20:23:41 UTC (rev 732)
@@ -80,7 +80,7 @@
}
else if (o == checkForUpdatesMenuItem)
{
- String answerString = interpreter.executeExpression("checkForUpdates()");
+ String answerString = interpreter.executeExpression("checkforupdates()");
answer.displayText(answerString);
answer.displayPrompt();
}
@@ -233,7 +233,7 @@
answer.displayPrompt();
// silent check for updates
- interpreter.executeExpression("checkForUpdates('-silent')");
+ interpreter.executeExpression("checkforupdates('-silent')");
this.setTitle(TITLE + " - Console Window");
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:11:18
|
Revision: 731
http://mathlib.svn.sourceforge.net/mathlib/?rev=731&view=rev
Author: st_mueller
Date: 2009-01-23 20:11:12 +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/functions/ExternalElementWiseFunction.java
Modified: JMathLib/trunk/src/jmathlib/core/functions/ExternalElementWiseFunction.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/functions/ExternalElementWiseFunction.java 2009-01-23 20:09:07 UTC (rev 730)
+++ JMathLib/trunk/src/jmathlib/core/functions/ExternalElementWiseFunction.java 2009-01-23 20:11:12 UTC (rev 731)
@@ -1,5 +1,15 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2008, 2009
+ */
+
package jmathlib.core.functions;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.Token;
@@ -11,9 +21,10 @@
/**
* standard function for evaluation of general external functions
* @param operands
+ * @param pointer to the global values (interpreter, function manager, graphics,...)
* @return
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// function works for one argument only
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:09:11
|
Revision: 730
http://mathlib.svn.sourceforge.net/mathlib/?rev=730&view=rev
Author: st_mueller
Date: 2009-01-23 20:09:07 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
added more tests
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/
JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/AllTests.java
JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/testTemplate.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java 2009-01-23 19:42:11 UTC (rev 729)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java 2009-01-23 20:09:07 UTC (rev 730)
@@ -49,6 +49,7 @@
//suite.addTest(jmathlibtests.toolbox.symbolic.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.test.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.time.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.toolbox_skeleton.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.trigonometric.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.video.AllTests.suite());
Added: JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/AllTests.java 2009-01-23 20:09:07 UTC (rev 730)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.toolbox_skeleton;
+
+import jmathlib.tools.junit.framework.*;
+
+/**
+ * TestSuite that runs all the tests
+ *
+ */
+public class AllTests {
+
+ public static void main (String[] args) {
+ jmathlib.tools.junit.textui.TestRunner.run (suite());
+ }
+ public static Test suite ( ) {
+ TestSuite suite= new TestSuite("time functions");
+
+ /* include subdirectories here */
+ // none
+
+ /* include tests in this directory here */
+ suite.addTest(jmathlibtests.toolbox.toolbox_skeleton.testTemplate.suite());
+
+ return suite;
+ }
+}
Added: JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/testTemplate.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/testTemplate.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/toolbox_skeleton/testTemplate.java 2009-01-23 20:09:07 UTC (rev 730)
@@ -0,0 +1,32 @@
+package jmathlibtests.toolbox.toolbox_skeleton;
+
+import jmathlib.core.interpreter.Interpreter;
+import jmathlib.tools.junit.framework.*;
+
+public class testTemplate extends JMathLibTestCase {
+ protected Interpreter ml;
+
+ public testTemplate(String name) {
+ super(name);
+ }
+ public static void main (String[] args) {
+ jmathlib.tools.junit.textui.TestRunner.run (suite());
+ }
+
+ public static Test suite() {
+ return new TestSuite(testTemplate.class);
+ }
+
+ public void testTemplate01() {
+ assertEvalScalarEquals("a=abs(8)", "a", 8);
+ }
+ public void testTemplate02() {
+ assertEvalScalarEquals("A=abs(88)", "A", 88);
+ }
+ public void testTemplate03() {
+ assertEvalScalarEquals("b=55", "b", 55);
+ }
+
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 19:42:21
|
Revision: 729
http://mathlib.svn.sourceforge.net/mathlib/?rev=729&view=rev
Author: st_mueller
Date: 2009-01-23 19:42:11 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
added some comments
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java 2009-01-23 15:27:04 UTC (rev 728)
+++ JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java 2009-01-23 19:42:11 UTC (rev 729)
@@ -1,9 +1,14 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: Stefan Mueller (st...@he...)
+ * (c) 2009
+ */
+
package jmathlib.toolbox.toolbox_skeleton;
-/* This file is part or JMathLib
- * author: stefan (st...@he...) 2009
- * */
-
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 15:27:06
|
Revision: 728
http://mathlib.svn.sourceforge.net/mathlib/?rev=728&view=rev
Author: st_mueller
Date: 2009-01-23 15:27:04 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
rearranched code
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/ErrorLogger.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/ErrorLogger.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/ErrorLogger.java 2009-01-23 13:53:13 UTC (rev 727)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/ErrorLogger.java 2009-01-23 15:27:04 UTC (rev 728)
@@ -8,16 +8,31 @@
/**stores the size of indent for the next line*/
private static int indentSize = 0;
-
/**flags wether text should be indented*/
private static boolean displayIndent = false;
+ /**flag for logging mode of JMathLib*/
+ private static boolean debugB = false;
+
+ /**@return the setting of the debug flag*/
+ public static boolean getDebug()
+ {
+ return debugB;
+ }
+
+ /**sets the debug flag
+ @param _debug = should debug information be displayed*/
+ public static void setDebug(boolean _debug)
+ {
+ debugB = _debug;
+ }
+
/**display a debug line to the standard output and the file MathLib.log
@param text = the text to display*/
public static void debugLine(String text)
{
- if(getDebug())
+ if(debugB)
{
//if(displayIndent)
// text = text + ";" + indentSize;
@@ -33,9 +48,11 @@
}
catch(IOException error)
{
+ System.out.println("ERROR LOGGER: IOException");
}
catch(SecurityException error)
{
+ System.out.println("ERROR LOGGER: SecurityException");
}
System.out.println(text);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:53:17
|
Revision: 727
http://mathlib.svn.sourceforge.net/mathlib/?rev=727&view=rev
Author: st_mueller
Date: 2009-01-23 13:53:13 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
added more tests
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/tools/junit/framework/JMathLibTestCase.java
Modified: JMathLib/trunk/src/jmathlib/tools/junit/framework/JMathLibTestCase.java
===================================================================
--- JMathLib/trunk/src/jmathlib/tools/junit/framework/JMathLibTestCase.java 2009-01-23 13:52:22 UTC (rev 726)
+++ JMathLib/trunk/src/jmathlib/tools/junit/framework/JMathLibTestCase.java 2009-01-23 13:53:13 UTC (rev 727)
@@ -41,6 +41,12 @@
}
+ public void assertEvalScalarEquals(String func, String var, boolean b)
+ {
+ ml.executeExpression(func);
+ boolean ansRe = ml.getScalarValueBoolean(var);
+ assertEquals(ansRe, b);
+ }
public void assertScalarEquals(String var, double varRe )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:52:26
|
Revision: 726
http://mathlib.svn.sourceforge.net/mathlib/?rev=726&view=rev
Author: st_mueller
Date: 2009-01-23 13:52:22 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
added more tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testGetDebug.java
JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testSetDebug.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testGetDebug.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testGetDebug.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testGetDebug.java 2009-01-23 13:52:22 UTC (rev 726)
@@ -0,0 +1,29 @@
+package jmathlibtests.toolbox.jmathlib.system;
+
+import jmathlib.tools.junit.framework.*;
+
+public class testGetDebug extends JMathLibTestCase {
+
+ public testGetDebug(String name) {
+ super(name);
+ }
+ public static void main (String[] args) {
+ jmathlib.tools.junit.textui.TestRunner.run (suite());
+ }
+
+ public static Test suite() {
+ return new TestSuite(testGetDebug.class);
+ }
+
+ public void testGetDebug01() {
+ assertEvalScalarEquals("setdebug(1); a=getdebug()","a", true);
+ }
+
+ public void testGetDebug02() {
+ assertEvalScalarEquals("setdebug(0); a=getdebug()","a", false);
+ }
+
+
+
+
+}
Added: JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testSetDebug.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testSetDebug.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/testSetDebug.java 2009-01-23 13:52:22 UTC (rev 726)
@@ -0,0 +1,29 @@
+package jmathlibtests.toolbox.jmathlib.system;
+
+import jmathlib.tools.junit.framework.*;
+
+public class testSetDebug extends JMathLibTestCase {
+
+ public testSetDebug(String name) {
+ super(name);
+ }
+ public static void main (String[] args) {
+ jmathlib.tools.junit.textui.TestRunner.run (suite());
+ }
+
+ public static Test suite() {
+ return new TestSuite(testSetDebug.class);
+ }
+
+ public void testSetDebug01() {
+ assertEvalScalarEquals("setdebug(1); a=getdebug()","a", true);
+ }
+
+ public void testSetDebug02() {
+ assertEvalScalarEquals("setdebug(0); a=getdebug()","a", false);
+ }
+
+
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:51:34
|
Revision: 725
http://mathlib.svn.sourceforge.net/mathlib/?rev=725&view=rev
Author: st_mueller
Date: 2009-01-23 13:51:31 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
added more tests
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/AllTests.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/AllTests.java 2009-01-23 13:37:36 UTC (rev 724)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/system/AllTests.java 2009-01-23 13:51:31 UTC (rev 725)
@@ -18,7 +18,9 @@
// none
/* include tests in this directory here */
- suite.addTest(jmathlibtests.toolbox.jmathlib.system.testUsage.suite());
+ suite.addTest(jmathlibtests.toolbox.jmathlib.system.testGetDebug.suite());
+ suite.addTest(jmathlibtests.toolbox.jmathlib.system.testSetDebug.suite());
+ suite.addTest(jmathlibtests.toolbox.jmathlib.system.testUsage.suite());
return suite;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:37:38
|
Revision: 724
http://mathlib.svn.sourceforge.net/mathlib/?rev=724&view=rev
Author: st_mueller
Date: 2009-01-23 13:37:36 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
getdebug() and setdebug()
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java 2009-01-23 13:37:36 UTC (rev 724)
@@ -0,0 +1,35 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.tokens.*;
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.ErrorLogger;
+import jmathlib.core.interpreter.GlobalValues;
+
+/**External function for controlling the debug setting for the system*/
+public class getdebug extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+ if (getNArgIn(operands) !=0)
+ throwMathLibException("getdebug: number of arguments !=0");
+
+ return new LogicalToken(ErrorLogger.getDebug());
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+getdebug()
+@DOC
+returns state of debug logging
+@NOTES
+@EXAMPLES
+getdebug()
+@SEE
+setdebug
+*/
+
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-23 13:34:27 UTC (rev 723)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-23 13:37:36 UTC (rev 724)
@@ -48,5 +48,6 @@
setdebug(1) turns debug output on
setdebug(0) turns debug output off
@SEE
+getdebug
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:34:36
|
Revision: 723
http://mathlib.svn.sourceforge.net/mathlib/?rev=723&view=rev
Author: st_mueller
Date: 2009-01-23 13:34:27 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
moved setdebug() to ErrorLogger
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-23 12:58:57 UTC (rev 722)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-23 13:34:27 UTC (rev 723)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.ErrorLogger;
import jmathlib.core.interpreter.GlobalValues;
/**External function for controlling the debug setting for the system*/
@@ -22,9 +23,9 @@
int debug = ((DoubleNumberToken)operands[0]).getIntValue(0,0);
if(debug == 0)
- setDebug(false);
+ ErrorLogger.setDebug(false);
else
- setDebug(true);
+ ErrorLogger.setDebug(true);
return new DoubleNumberToken(1);
}
@@ -39,13 +40,13 @@
@GROUP
system
@SYNTAX
-SETDEBUG(value)
+setdebug(value)
@DOC
Switches debug output on or off
@NOTES
@EXAMPLES
-SETDEBUG(1) turns debug output on
-SETDEBUG(0) turns debug output off
+setdebug(1) turns debug output on
+setdebug(0) turns debug output off
@SEE
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:22:33
|
Revision: 716
http://mathlib.svn.sourceforge.net/mathlib/?rev=716&view=rev
Author: st_mueller
Date: 2009-01-23 12:24:35 +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/toolbox/general/kbhit.java
JMathLib/trunk/src/jmathlib/toolbox/general/length.java
JMathLib/trunk/src/jmathlib/toolbox/general/linspace.java
JMathLib/trunk/src/jmathlib/toolbox/general/logical.java
JMathLib/trunk/src/jmathlib/toolbox/general/ndims.java
JMathLib/trunk/src/jmathlib/toolbox/general/performfunction.java
JMathLib/trunk/src/jmathlib/toolbox/general/permutations.java
JMathLib/trunk/src/jmathlib/toolbox/general/primes.java
JMathLib/trunk/src/jmathlib/toolbox/general/rand.java
JMathLib/trunk/src/jmathlib/toolbox/general/real.java
JMathLib/trunk/src/jmathlib/toolbox/general/setpfilecaching.java
JMathLib/trunk/src/jmathlib/toolbox/general/size.java
JMathLib/trunk/src/jmathlib/toolbox/general/str2func.java
JMathLib/trunk/src/jmathlib/toolbox/general/struct.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/kbhit.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/kbhit.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/kbhit.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -3,6 +3,8 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.awt.event.*;
import jmathlib.ui.common.*;
@@ -13,12 +15,12 @@
boolean lock = false;
/** waits until a key is hit on the keyboard*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
lock = true;
- ((Console)(getInterpreter().getOutputPanel())).addKeyListener(this); // this = null?
- ((Console)getInterpreter().getOutputPanel()).displayText("asdfasdf");
+ ((Console)(globals.getInterpreter().getOutputPanel())).addKeyListener(this); // this = null?
+ ((Console)globals.getInterpreter().getOutputPanel()).displayText("asdfasdf");
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/length.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/length.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/length.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -6,11 +6,12 @@
import jmathlib.core.tokens.DataToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for getting the size of matrices*/
public class length extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// at least one operand
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/linspace.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/linspace.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/linspace.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -4,11 +4,12 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for creating equaly spaced vectors*/
public class linspace extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 3)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/logical.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/logical.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/logical.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -5,11 +5,12 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.LogicalToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class logical extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1 )
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/ndims.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/ndims.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/ndims.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -7,6 +7,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class ndims extends ExternalFunction
@@ -14,7 +15,7 @@
/**returns the dimensions of an array 1,2,3,4-dimensional
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/performfunction.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/performfunction.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/performfunction.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -5,13 +5,14 @@
import jmathlib.core.tokens.FunctionToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for performing functions*/
public class performfunction extends ExternalFunction
{
/**Perform the named function on the operands
@param operand[0] = the name of the function*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
FunctionToken function = null;
@@ -38,7 +39,7 @@
function.setOperands(op);
- return function.evaluate(null);
+ return function.evaluate(null, globals);
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/permutations.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/permutations.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/permutations.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to calculate the number of permutations
when k objects are taken from a set of k*/
@@ -14,7 +15,7 @@
@param operand[1] = The total number of objects
@return the number of permutations
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = new DoubleNumberToken(0);
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/primes.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/primes.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/primes.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -5,13 +5,14 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to create a vector of primes*/
public class primes extends ExternalFunction
{
/**@param operands[0] = the maximum number
@return a vector containing the prime values*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/rand.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/rand.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/rand.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -4,11 +4,12 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for creating random numbers*/
public class rand extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
//if ( (getNArgIn(operands) < 0) ||
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/real.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/real.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/real.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -4,10 +4,11 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class real extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1 )
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/setpfilecaching.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/setpfilecaching.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/setpfilecaching.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -5,6 +5,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for enabling/disabling of caching of p-files */
public class setpfilecaching extends ExternalFunction
@@ -12,7 +13,7 @@
/**enable or disable caching of p-files
* @param operands[0] 1, 0 , 'on', 'off'
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand (e.g. setPFileCaching(1)
// one operand (e.g. setPFileCaching('on')
@@ -23,16 +24,16 @@
if (operands[0] instanceof DoubleNumberToken)
{
if ( ((DoubleNumberToken)operands[0]).getValueRe()==0)
- getFunctionManager().setPFileCaching(false);
+ globals.getFunctionManager().setPFileCaching(false);
else
- getFunctionManager().setPFileCaching(true);
+ globals.getFunctionManager().setPFileCaching(true);
}
else if (operands[0] instanceof CharToken)
{
if ( ((CharToken)operands[0]).getValue().equals("on"))
- getFunctionManager().setPFileCaching(true);
+ globals.getFunctionManager().setPFileCaching(true);
else
- getFunctionManager().setPFileCaching(false);
+ globals.getFunctionManager().setPFileCaching(false);
}
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/size.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/size.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/size.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -5,11 +5,12 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for getting the size of matrices*/
public class size extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// at least one operand
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/str2func.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/str2func.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/str2func.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -5,13 +5,14 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.FunctionHandleToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function */
public class str2func extends ExternalFunction
{
/**@param operands[0] = a matrix of numbers
@return a matrix the same size with 1 if the number is a prime*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
throwMathLibException("str2func: number of arguments != 1");
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/struct.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/struct.java 2009-01-21 19:38:33 UTC (rev 715)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/struct.java 2009-01-23 12:24:35 UTC (rev 716)
@@ -12,7 +12,7 @@
/**create a structure
@param operands[n] = name of field
@param operands[n+1] = field value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
MathLibObject obj;
int length = operands.length;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:22:10
|
Revision: 717
http://mathlib.svn.sourceforge.net/mathlib/?rev=717&view=rev
Author: st_mueller
Date: 2009-01-23 12:26:46 +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/toolbox/general/bitand.java
JMathLib/trunk/src/jmathlib/toolbox/general/bitor.java
JMathLib/trunk/src/jmathlib/toolbox/general/bitshift.java
JMathLib/trunk/src/jmathlib/toolbox/general/bitxor.java
JMathLib/trunk/src/jmathlib/toolbox/general/cell.java
JMathLib/trunk/src/jmathlib/toolbox/general/clear.java
JMathLib/trunk/src/jmathlib/toolbox/general/clock.java
JMathLib/trunk/src/jmathlib/toolbox/general/combinations.java
JMathLib/trunk/src/jmathlib/toolbox/general/complex.java
JMathLib/trunk/src/jmathlib/toolbox/general/conj.java
JMathLib/trunk/src/jmathlib/toolbox/general/factor.java
JMathLib/trunk/src/jmathlib/toolbox/general/fft.java
JMathLib/trunk/src/jmathlib/toolbox/general/fibonacci.java
JMathLib/trunk/src/jmathlib/toolbox/general/fix.java
JMathLib/trunk/src/jmathlib/toolbox/general/func2str.java
JMathLib/trunk/src/jmathlib/toolbox/general/getpfilecaching.java
JMathLib/trunk/src/jmathlib/toolbox/general/global.java
JMathLib/trunk/src/jmathlib/toolbox/general/harmonic.java
JMathLib/trunk/src/jmathlib/toolbox/general/imag.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/bitand.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/bitand.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/bitand.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.functions.*;
/**An external function to compute the binary and of two numbers*/
@@ -13,7 +14,7 @@
@param operands[0] - The first number
@param operands[1] - The second number
@return the result of the function as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = DoubleNumberToken.zero;
if (getNArgIn(operands) != 2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/bitor.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/bitor.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/bitor.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.functions.*;
/**An external function to compute the binary inclusive or of two numbers*/
@@ -13,7 +14,7 @@
@param operands[0] - The first number
@param operands[1] - The second number
@return the result of the function as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = DoubleNumberToken.zero;
if (getNArgIn(operands) != 2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/bitshift.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/bitshift.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/bitshift.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.functions.*;
/**An external function to shift the bit pattern of a number*/
@@ -13,7 +14,7 @@
@param operands[0] - The number to shift
@param operands[1] - The number of binary places to shift
@return the result of the function as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = DoubleNumberToken.zero;
if (getNArgIn(operands) != 2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/bitxor.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/bitxor.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/bitxor.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.functions.*;
/**An external function to compute the binary exclusive or of two numbers*/
@@ -13,7 +14,7 @@
@param operands[0] - The first number
@param operands[1] - The second number
@return the result of the function as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = DoubleNumberToken.zero;
if (getNArgIn(operands) != 2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/cell.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/cell.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/cell.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -3,6 +3,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for creating matrices that consist of zeros *
* everywhere except in the diagonal. The diagonal consists of ones. *
@@ -13,7 +14,7 @@
/**returns a cell array
@param operands[0] = number of rows
@param operands[1] = number of columns */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// at least one operands (e.g. cell(n) )
if (getNArgIn(operands) < 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/clear.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/clear.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/clear.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -10,7 +10,7 @@
/**An external function for clearing stored variables*/
public class clear extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Variable var;
@@ -34,38 +34,38 @@
if (s.equals("variables"))
{
// only clear local variables
- getLocalVariables().clear();
+ globals.getLocalVariables().clear();
}
else if (s.equals("globals"))
{
// clear global variables
- getGlobalVariables().clear();
- getLocalVariables().clear();
+ globals.getGlobalVariables().clear();
+ globals.getLocalVariables().clear();
//TODO: when removing global variables also remove
// pointers from local to global varaibles in "getLocalVariables"
}
else if (s.equals("functions"))
{
// clear cache for m-files, class-files, script-files
- getFunctionManager().clear();
+ globals.getFunctionManager().clear();
}
else if (s.equals("all"))
{
// clear everything
- getLocalVariables().clear();
- getGlobalVariables().clear();
- getFunctionManager().clear();
+ globals.getLocalVariables().clear();
+ globals.getGlobalVariables().clear();
+ globals.getFunctionManager().clear();
}
else if (!s.equals(" "))
{
// remove one variable from local workspace
- getLocalVariables().remove(s);
+ globals.getLocalVariables().remove(s);
}
else
{
// clear without any arguments only clears the local workspace
- getLocalVariables().clear();
+ globals.getLocalVariables().clear();
}
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/clock.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/clock.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/clock.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,8 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.util.Date;
import java.util.Calendar;
@@ -12,7 +14,7 @@
{
/**@return the current date and time as a 6 by 1 vector containing
[year month day hours minutes seconds]*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Date now = new Date();
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/combinations.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/combinations.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/combinations.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to calculate the number of combinations
when k objects are taken from a set of k*/
@@ -14,7 +15,7 @@
@param operand[1] = The total number of objects
@return the number of combinations
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = new DoubleNumberToken(0);
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/complex.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/complex.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/complex.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**Display the debug information of an expression*/
public class complex extends ExternalFunction
@@ -12,7 +13,7 @@
@param operand[0] = real part
@param operand[2] = imaginary part
@return the complex number*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
if (getNArgIn(operands) != 2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/conj.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/conj.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/conj.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,10 +4,11 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class conj extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1 )
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/factor.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/factor.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/factor.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to create a vector of the prime
factors of a number*/
@@ -11,7 +12,7 @@
{
/**@param operands[0] = the number
@return a vector containing the prime factors*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/fft.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/fft.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/fft.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,11 +4,12 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is a struct*/
public class fft extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/fibonacci.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/fibonacci.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/fibonacci.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to calculate the nth fibonacci number*/
public class fibonacci extends ExternalFunction
@@ -12,7 +13,7 @@
@param operand[0] = The index of the Fibonacci number
@return the Fibonacci number
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
throwMathLibException("fibonacci: number of arguments != 1");
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/fix.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/fix.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/fix.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class fix extends ExternalFunction
@@ -11,7 +12,7 @@
/**rounds the element to the nearest element towards zero.
@param operands[0] = value to round
@return a matrix of the same size as the operands*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// exactly one operand
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/func2str.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/func2str.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/func2str.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -5,13 +5,14 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.FunctionHandleToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function */
public class func2str extends ExternalFunction
{
/**@param operands[0] = a matrix of numbers
@return a matrix the same size with 1 if the number is a prime*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
throwMathLibException("func2str: number of arguments != 1");
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/getpfilecaching.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/getpfilecaching.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/getpfilecaching.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -5,6 +5,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for enabling/disabling of caching of p-files */
public class getpfilecaching extends ExternalFunction
@@ -12,12 +13,12 @@
/**status of caching of p-files
* @return whether or not caching of p-files is enabled/disabled
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=0)
throwMathLibException("getPFileCaching: number of input arguments != 0");
- boolean cachingEnabled = getFunctionManager().getPFileCaching();
+ boolean cachingEnabled = globals.getFunctionManager().getPFileCaching();
if (cachingEnabled)
return new DoubleNumberToken(1);
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/global.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/global.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/global.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -3,13 +3,14 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.VariableToken;
import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.interpreter.Variable;
import jmathlib.core.functions.ExternalFunction;
/**An external function which checks if the argument is numeric*/
public class global extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -23,8 +24,8 @@
debugLine("global "+operands[0].toString());
- debugLine("global: local variable:"+getLocalVariables().isVariable(var.getName()));
- debugLine("global: global variable:"+getGlobalVariables().isVariable(var.getName()));
+ debugLine("global: local variable:"+globals.getLocalVariables().isVariable(var.getName()));
+ debugLine("global: global variable:"+globals.getGlobalVariables().isVariable(var.getName()));
// this is the procedure for global variables:
// - normally all variables a local to each workspace
@@ -40,22 +41,22 @@
// check if variable is already created in global context
- if (getGlobalVariables().isVariable(name))
+ if (globals.getGlobalVariables().isVariable(name))
{
// variable is already created in global context
// check if local context already contains variable
- if (getLocalVariables().isVariable(name))
+ if (globals.getLocalVariables().isVariable(name))
{
// variable is already created in local context
// remove variable from current workspace (may delete current value)
// create empty variable and set pointer to "global" property
- getLocalVariables().remove(name);
- getLocalVariables().createVariable(name);
- getLocalVariables().getVariable(name).setGlobal(true);
+ globals.getLocalVariables().remove(name);
+ globals.getLocalVariables().createVariable(name);
+ globals.getLocalVariables().getVariable(name).setGlobal(true);
- getInterpreter().displayText("WARNING global: variable "+name+
+ globals.getInterpreter().displayText("WARNING global: variable "+name+
" already existed in the local workspace. \n"+
" It has been overwritten with the value from"+
" the global workspace.\n" +
@@ -67,8 +68,8 @@
// variable is not yet created in local context
// create empty variable and set "global" property
- getLocalVariables().createVariable(name);
- getLocalVariables().getVariable(name).setGlobal(true);
+ globals.getLocalVariables().createVariable(name);
+ globals.getLocalVariables().getVariable(name).setGlobal(true);
}
}
@@ -77,28 +78,28 @@
// variable not yet created in global context
// create variable in global context (data only in global context)
- getGlobalVariables().createVariable(name);
- getGlobalVariables().getVariable(name).setGlobal(true);
+ globals.getGlobalVariables().createVariable(name);
+ globals.getGlobalVariables().getVariable(name).setGlobal(true);
// check if current context already contains variable
- if (getLocalVariables().isVariable(name))
+ if (globals.getLocalVariables().isVariable(name))
{
// current context already contains variable
- Variable varCurrent = getLocalVariables().getVariable(name);
- getGlobalVariables().getVariable(name).assign(varCurrent.getData());
+ Variable varCurrent = globals.getLocalVariables().getVariable(name);
+ globals.getGlobalVariables().getVariable(name).assign(varCurrent.getData());
// remove variable, create new one and set variable to global
- getLocalVariables().remove(name);
+ globals.getLocalVariables().remove(name);
}
}
// create new variable in current context and set variable to global
- getLocalVariables().createVariable(name);
- getLocalVariables().getVariable(name).setGlobal(true);
+ globals.getLocalVariables().createVariable(name);
+ globals.getLocalVariables().getVariable(name).setGlobal(true);
- debugLine("global:global var:"+name+" global="+getGlobalVariables().getVariable(name).isGlobal());
- debugLine("global:local var:"+name+" global="+getLocalVariables().getVariable(name).isGlobal());
+ debugLine("global:global var:"+name+" global="+globals.getGlobalVariables().getVariable(name).isGlobal());
+ debugLine("global:local var:"+name+" global="+globals.getLocalVariables().getVariable(name).isGlobal());
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/harmonic.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/harmonic.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/harmonic.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to calculate the nth harmonic number*/
public class harmonic extends ExternalFunction
@@ -12,7 +13,7 @@
@param operand[0] = The index of the harmonic number
@return the harmonic number
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = new DoubleNumberToken(0);
if(operands.length >= 1 && operands[0] instanceof DoubleNumberToken)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/imag.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/imag.java 2009-01-23 12:24:35 UTC (rev 716)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/imag.java 2009-01-23 12:26:46 UTC (rev 717)
@@ -3,10 +3,11 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class imag extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1 )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 12:59:06
|
Revision: 722
http://mathlib.svn.sourceforge.net/mathlib/?rev=722&view=rev
Author: st_mueller
Date: 2009-01-23 12:58:57 +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/toolbox/io/cd.java
JMathLib/trunk/src/jmathlib/toolbox/io/createnewfile.java
JMathLib/trunk/src/jmathlib/toolbox/io/csvread.java
JMathLib/trunk/src/jmathlib/toolbox/io/csvwrite.java
JMathLib/trunk/src/jmathlib/toolbox/io/delete.java
JMathLib/trunk/src/jmathlib/toolbox/io/dir.java
JMathLib/trunk/src/jmathlib/toolbox/io/exist.java
JMathLib/trunk/src/jmathlib/toolbox/io/isdirectory.java
JMathLib/trunk/src/jmathlib/toolbox/io/isfile.java
JMathLib/trunk/src/jmathlib/toolbox/io/ishidden.java
JMathLib/trunk/src/jmathlib/toolbox/io/lastmodified.java
JMathLib/trunk/src/jmathlib/toolbox/io/load.java
JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java
JMathLib/trunk/src/jmathlib/toolbox/io/mkdir.java
JMathLib/trunk/src/jmathlib/toolbox/io/pwd.java
JMathLib/trunk/src/jmathlib/toolbox/io/rmdir.java
JMathLib/trunk/src/jmathlib/toolbox/io/runfile.java
JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java
JMathLib/trunk/src/jmathlib/toolbox/io/systemcommand.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/cd.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/cd.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/cd.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,6 +3,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.*;
+
import java.io.*;
/**An external function for changing to another directory */
@@ -12,7 +13,7 @@
/* @param operands[0] string which specifies the directory *
* to change to (optional). *
* If invoked with now paramenter the current directory is returned. */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String path=".";
@@ -34,18 +35,18 @@
try
{
- File dir = new File(getWorkingDirectory(), path);
+ File dir = new File(globals.getWorkingDirectory(), path);
//getInterpreter().displayText("canonical path = "+dir.getCanonicalPath());
if (dir.isDirectory())
{
- setWorkingDirectory(dir);
+ globals.setWorkingDirectory(dir);
if (getNoOfLeftHandArguments()==1)
return new CharToken(dir.getCanonicalPath());
else
- getInterpreter().displayText(dir.getCanonicalPath());
+ globals.getInterpreter().displayText(dir.getCanonicalPath());
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/createnewfile.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/createnewfile.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/createnewfile.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,11 +2,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class createnewfile extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -21,7 +23,7 @@
try
{
- file = new File(getWorkingDirectory(),name);
+ file = new File(globals.getWorkingDirectory(),name);
if(!file.createNewFile())
throwMathLibException("create new file: did not work");
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/csvread.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/csvread.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/csvread.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -7,6 +7,8 @@
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.ErrorLogger;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
import java.util.Stack;
@@ -20,7 +22,7 @@
@param operands[2] = the start column (optional)
@param operands[3] = range(optional, not implemented)
@return the matrix as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
DoubleNumberToken result = null;
@@ -32,7 +34,7 @@
{
String fileName = ((CharToken)operands[0]).toString();
- File CSVFile = new File(getWorkingDirectory(), fileName);
+ File CSVFile = new File(globals.getWorkingDirectory(), fileName);
if(!CSVFile.exists()) return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/csvwrite.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/csvwrite.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/csvwrite.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -7,6 +7,8 @@
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.ErrorLogger;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function for loading a matrix from a csv file*/
@@ -18,7 +20,7 @@
@param operands[1] = the matrix to save
@param operands[2] = the start row (optional)
@param operands[3] = the start column (optional)*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// at least one operand
if (getNArgIn(operands) != 2)
@@ -31,7 +33,7 @@
double[][] values = ((DoubleNumberToken)operands[1]).getReValues();
String fileName = ((CharToken)operands[0]).toString();
- File CSVFile = new File(getWorkingDirectory(), fileName);
+ File CSVFile = new File(globals.getWorkingDirectory(), fileName);
ErrorLogger.debugLine("Writing CSV>"+fileName+"<");
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/delete.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/delete.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/delete.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,11 +2,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class delete extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -21,7 +23,7 @@
try
{
- file = new File(getWorkingDirectory(),name);
+ file = new File(globals.getWorkingDirectory(),name);
}
catch (Exception e)
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/dir.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/dir.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/dir.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,12 +2,14 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function for getting a directory listing */
public class dir extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 0)
@@ -15,7 +17,7 @@
String path=".";
- File dir = new File(getWorkingDirectory(), path);
+ File dir = new File(globals.getWorkingDirectory(), path);
String[] files = dir.list();
@@ -25,9 +27,9 @@
String name = files[i];
File f = new File(name);
if (f.isDirectory())
- getInterpreter().displayText(files[i]+"/");
+ globals.getInterpreter().displayText(files[i]+"/");
else
- getInterpreter().displayText(files[i]);
+ globals.getInterpreter().displayText(files[i]);
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/exist.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/exist.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/exist.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -4,6 +4,8 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function used to check if a file exists*/
@@ -12,7 +14,7 @@
/**Check if file exists
@param 0 = filename
@return 1 if the file exists*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// at least one operand
@@ -26,7 +28,7 @@
testFile = new File(fileName);
else
{
- File path = getWorkingDirectory();
+ File path = globals.getWorkingDirectory();
testFile = new File(path, fileName);
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/isdirectory.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/isdirectory.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/isdirectory.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,11 +3,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class isdirectory extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -20,7 +22,7 @@
try
{
- File dir = new File(getWorkingDirectory(),name);
+ File dir = new File(globals.getWorkingDirectory(),name);
if (dir.isDirectory())
return new DoubleNumberToken(1);
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/isfile.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/isfile.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/isfile.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,12 +3,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import java.io.*;
public class isfile extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -21,7 +22,7 @@
try
{
- File file = new File(getWorkingDirectory(), name);
+ File file = new File(globals.getWorkingDirectory(), name);
if (file.isFile())
return new DoubleNumberToken(1);
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/ishidden.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/ishidden.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/ishidden.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,11 +3,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class ishidden extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -20,7 +22,7 @@
try
{
- File file = new File(getWorkingDirectory(), name);
+ File file = new File(globals.getWorkingDirectory(), name);
if (!file.exists())
throwMathLibException("ishidden: file does not exist");
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/lastmodified.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/lastmodified.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/lastmodified.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,11 +3,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class lastmodified extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -20,7 +22,7 @@
try
{
- File file = new File(getWorkingDirectory(), name);
+ File file = new File(globals.getWorkingDirectory(), name);
// check if file exists in current workspace
if (!file.exists())
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/load.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/load.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/load.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -5,6 +5,8 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.ErrorLogger;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function for loading a matrix from a csv file*/
@@ -68,7 +70,7 @@
@param operands[2] = the start column (optional)
@param operands[3] = range(optional, not implemented)
@return the matrix as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -80,8 +82,8 @@
// fileName = ((StringToken)operands[0]).toString();
//}
- System.out.println("load dir "+getWorkingDirectory() );
- File fileHandle = new File(getWorkingDirectory(), fileName);
+ System.out.println("load dir "+globals.getWorkingDirectory() );
+ File fileHandle = new File(globals.getWorkingDirectory(), fileName);
if(!fileHandle.exists())
throwMathLibException("load file does not exist");
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,11 +2,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class loadvariables extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) > 1)
@@ -23,7 +25,7 @@
file = ((CharToken)operands[0]).toString();
}
- getLocalVariables().loadVariables(file);
+ globals.getLocalVariables().loadVariables(file);
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/mkdir.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/mkdir.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/mkdir.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,11 +2,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class mkdir extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -20,7 +22,7 @@
File file=null;
try
{
- file = new File(getWorkingDirectory(),name);
+ file = new File(globals.getWorkingDirectory(),name);
}
catch (Exception e)
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/pwd.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/pwd.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/pwd.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,14 +3,16 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class pwd extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
- File f = getWorkingDirectory();
+ File f = globals.getWorkingDirectory();
return new CharToken(f.getAbsolutePath());
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/rmdir.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/rmdir.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/rmdir.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,12 +2,14 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function for changing to another directory */
public class rmdir extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -22,7 +24,7 @@
try
{
- file = new File(getWorkingDirectory(),name);
+ file = new File(globals.getWorkingDirectory(),name);
}
catch (Exception e)
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/runfile.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/runfile.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/runfile.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -5,6 +5,8 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.ErrorLogger;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function for loading and running m-files (script-files) *
@@ -14,7 +16,7 @@
/** Check that the operand is a string then open the file *
* referenced. *
* @param operands[0] string which specifies the function to load */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String answerString="";
@@ -36,7 +38,7 @@
if(fileName.indexOf(".m") == -1) fileName += ".m";
- File scriptFile = new File(getWorkingDirectory(), fileName);
+ File scriptFile = new File(globals.getWorkingDirectory(), fileName);
if(!scriptFile.exists()) return null;
@@ -54,7 +56,7 @@
inReader.close();
//execute the file and store the answer
- answerString = getInterpreter().executeExpression(lineFile);
+ answerString = globals.getInterpreter().executeExpression(lineFile);
}
catch (Exception e)
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -2,11 +2,13 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
public class savevariables extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) > 1)
@@ -23,7 +25,7 @@
file = ((CharToken)operands[0]).toString();
}
- getLocalVariables().saveVariables(file);
+ globals.getLocalVariables().saveVariables(file);
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/systemcommand.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/systemcommand.java 2009-01-23 12:50:35 UTC (rev 721)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/systemcommand.java 2009-01-23 12:58:57 UTC (rev 722)
@@ -3,6 +3,8 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.io.*;
/**An external function used to execute an external program
@@ -13,7 +15,7 @@
@param operands[0] = filename
@param operands[n] = arguments
@return 1*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String[] cmdarray = new String[operands.length];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 12:50:43
|
Revision: 721
http://mathlib.svn.sourceforge.net/mathlib/?rev=721&view=rev
Author: st_mueller
Date: 2009-01-23 12:50:35 +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/toolbox/string/_char.java
JMathLib/trunk/src/jmathlib/toolbox/string/_double.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/_char.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/_char.java 2009-01-23 12:40:35 UTC (rev 720)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/_char.java 2009-01-23 12:50:35 UTC (rev 721)
@@ -4,12 +4,13 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for changing numbers into strings*/
public class _char extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand
@@ -37,7 +38,7 @@
}
catch (Exception e)
{
- throwMathLibException("_char: exceptiion");
+ throwMathLibException("_char: exception");
}
return new CharToken(data);
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/_double.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/_double.java 2009-01-23 12:40:35 UTC (rev 720)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/_double.java 2009-01-23 12:50:35 UTC (rev 721)
@@ -7,6 +7,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for changing strings into numbers */
@@ -15,14 +16,14 @@
/**returns a matrix of numbers
* @param operands[0] = string (e.g. ["hello"])
* @return a matrix of numbers */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand
if (getNArgIn(operands)!=1)
throwMathLibException("_double: number of input arguments != 1");
- if ( (operands[0] instanceof CharToken))
+ if (operands[0] instanceof CharToken)
{
// get data from arguments
String stringValue = ((CharToken)operands[0]).getValue();
@@ -40,7 +41,7 @@
return new DoubleNumberToken( X );
}
- else if ( (operands[0] instanceof Int8NumberToken))
+ else if (operands[0] instanceof Int8NumberToken)
{
Int8NumberToken tok = (Int8NumberToken)operands[0];
@@ -54,7 +55,7 @@
return d;
}
- else if ( (operands[0] instanceof UInt8NumberToken))
+ else if (operands[0] instanceof UInt8NumberToken)
{
UInt8NumberToken tok = (UInt8NumberToken)operands[0];
@@ -68,7 +69,7 @@
return d;
}
- else if ( (operands[0] instanceof DoubleNumberToken))
+ else if (operands[0] instanceof DoubleNumberToken)
{
return (DoubleNumberToken)operands[0];
}
@@ -97,5 +98,5 @@
@NOTES
@SEE
-num2str
+num2str, char
*/
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 12:42:39
|
Revision: 718
http://mathlib.svn.sourceforge.net/mathlib/?rev=718&view=rev
Author: st_mueller
Date: 2009-01-23 12:28:36 +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/toolbox/general/isa.java
JMathLib/trunk/src/jmathlib/toolbox/general/iscell.java
JMathLib/trunk/src/jmathlib/toolbox/general/ischar.java
JMathLib/trunk/src/jmathlib/toolbox/general/isfunctionhandle.java
JMathLib/trunk/src/jmathlib/toolbox/general/isglobal.java
JMathLib/trunk/src/jmathlib/toolbox/general/islogical.java
JMathLib/trunk/src/jmathlib/toolbox/general/isnumeric.java
JMathLib/trunk/src/jmathlib/toolbox/general/isprime.java
JMathLib/trunk/src/jmathlib/toolbox/general/isstruct.java
JMathLib/trunk/src/jmathlib/toolbox/general/isstudent.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isa.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isa.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isa.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -2,12 +2,12 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class isa extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/iscell.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/iscell.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/iscell.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -2,13 +2,13 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is numeric*/
public class iscell extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/ischar.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/ischar.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/ischar.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -2,13 +2,13 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is a char*/
public class ischar extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isfunctionhandle.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isfunctionhandle.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isfunctionhandle.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -5,13 +5,14 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.FunctionHandleToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to check if an argument is of type function hanlde*/
public class isfunctionhandle extends ExternalFunction
{
/**@param operands[0] = a matrix of numbers
@return a matrix the same size with 1 if the number is a prime*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
throwMathLibException("isfunctionhandle: number of arguments != 1");
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isglobal.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isglobal.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isglobal.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -2,13 +2,13 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is numeric*/
public class isglobal extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
@@ -18,8 +18,9 @@
throwMathLibException("isglobal: only works on variables");
VariableToken var = (VariableToken)operands[0];
-
- if (var.getVariable().isGlobal())
+ String name = var.getName();
+
+ if (globals.getVariable(name).isGlobal())
return new DoubleNumberToken(1.0);
else
return new DoubleNumberToken(0.0);
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/islogical.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/islogical.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/islogical.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -5,11 +5,12 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.LogicalToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is a char*/
public class islogical extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isnumeric.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isnumeric.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isnumeric.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -4,11 +4,12 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is numeric*/
public class isnumeric extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isprime.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isprime.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isprime.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -4,13 +4,14 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**External function to check if a number is a prime*/
public class isprime extends ExternalFunction
{
/**@param operands[0] = a matrix of numbers
@return a matrix the same size with 1 if the number is a prime*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
throwMathLibException("isPrime: number of arguments != 1");
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isstruct.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isstruct.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isstruct.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -5,11 +5,12 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.MathLibObject;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function which checks if the argument is a struct*/
public class isstruct extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/isstudent.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/isstudent.java 2009-01-23 12:26:46 UTC (rev 717)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/isstudent.java 2009-01-23 12:28:36 UTC (rev 718)
@@ -4,13 +4,14 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/** */
public class isstudent extends ExternalFunction
{
/**@param operands[0] = a matrix of numbers
@return a matrix the same size with 1 if the number is a prime*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 0)
throwMathLibException("isstudent: number of arguments != 0");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 12:42:29
|
Revision: 719
http://mathlib.svn.sourceforge.net/mathlib/?rev=719&view=rev
Author: st_mueller
Date: 2009-01-23 12:39:30 +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/toolbox/general/who.java
JMathLib/trunk/src/jmathlib/toolbox/general/whos.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/who.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/who.java 2009-01-23 12:28:36 UTC (rev 718)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/who.java 2009-01-23 12:39:30 UTC (rev 719)
@@ -9,7 +9,7 @@
/**An external function for getting the stored variables*/
public class who extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
//if (operands != null)
@@ -17,14 +17,14 @@
Variable var;
- getInterpreter().displayText("\nYour variables are:\n");
+ globals.getInterpreter().displayText("\nYour variables are:\n");
- Iterator iter = getLocalVariables().getIterator();
+ Iterator iter = globals.getLocalVariables().getIterator();
while(iter.hasNext())
{
Map.Entry next = ((Map.Entry)iter.next());
var = ((Variable)next.getValue());
- getInterpreter().displayText(var.getName());
+ globals.getInterpreter().displayText(var.getName());
}
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/whos.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/whos.java 2009-01-23 12:28:36 UTC (rev 718)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/whos.java 2009-01-23 12:39:30 UTC (rev 719)
@@ -8,14 +8,14 @@
/**An external function for getting the stored variables*/
public class whos extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
- Iterator iter = getLocalVariables().getIterator();
+ Iterator iter = globals.getLocalVariables().getIterator();
// display header information
- getInterpreter().displayText("\nYour variables are:\n");
- getInterpreter().displayText("\nName: \t size: \t type \n");
+ globals.getInterpreter().displayText("\nYour variables are:\n");
+ globals.getInterpreter().displayText("\nName: \t size: \t type \n");
// check if global context is requested
if (getNArgIn(operands) == 1)
@@ -24,7 +24,7 @@
{
String data = ((CharToken)operands[0]).getValue();
if (data.equals("global"))
- iter = getGlobalVariables().getIterator();
+ iter = globals.getGlobalVariables().getIterator();
}
}
@@ -42,7 +42,7 @@
// if variable is global get data from global context
if (global)
- op = (OperandToken)getGlobalVariables().getVariable(name).getData();
+ op = (OperandToken)globals.getGlobalVariables().getVariable(name).getData();
// check which type of variable
if (op instanceof DataToken)
@@ -59,7 +59,7 @@
if (global)
line += "(global)";
- getInterpreter().displayText(line);
+ globals.getInterpreter().displayText(line);
}
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 12:42:27
|
Revision: 720
http://mathlib.svn.sourceforge.net/mathlib/?rev=720&view=rev
Author: st_mueller
Date: 2009-01-23 12:40:35 +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/toolbox/funfun/euler.java
JMathLib/trunk/src/jmathlib/toolbox/funfun/feval.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/funfun/euler.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/funfun/euler.java 2009-01-23 12:39:30 UTC (rev 719)
+++ JMathLib/trunk/src/jmathlib/toolbox/funfun/euler.java 2009-01-23 12:40:35 UTC (rev 720)
@@ -7,6 +7,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for computing a mesh of a matrix */
@@ -15,7 +16,7 @@
/**integrates a "function" using the euler forward integration method
* [t,y] = euler (function, [t0 tf], y0, dt)
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// [t,y] = euler (function, [t0 tf], y0, dt)
@@ -96,7 +97,7 @@
function.setOperands(op);
//evaluate function
- OperandToken result = function.evaluate(null);
+ OperandToken result = function.evaluate(null, globals);
// retrieve output vector of integration
if ( !(result instanceof DoubleNumberToken) )
Modified: JMathLib/trunk/src/jmathlib/toolbox/funfun/feval.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/funfun/feval.java 2009-01-23 12:39:30 UTC (rev 719)
+++ JMathLib/trunk/src/jmathlib/toolbox/funfun/feval.java 2009-01-23 12:40:35 UTC (rev 720)
@@ -3,6 +3,7 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.FunctionToken;
import jmathlib.core.tokens.CharToken;
@@ -11,7 +12,7 @@
{
/**Perform the named function on the operands
@param operand[0] = the name of the function*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
FunctionToken function = null;
@@ -39,7 +40,7 @@
function.setOperands(op);
- return function.evaluate(null);
+ return function.evaluate(null, globals);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:38:36
|
Revision: 715
http://mathlib.svn.sourceforge.net/mathlib/?rev=715&view=rev
Author: st_mueller
Date: 2009-01-21 19:38:33 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -4,6 +4,7 @@
import jmathlib.core.functions.FileFunctionLoader;
import jmathlib.core.functions.FunctionLoader;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -15,7 +16,7 @@
{
/**adds an item to the search path
@param operands[0] = item to add*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=1)
throwMathLibException("addpath: number of arguments != 1");
@@ -44,8 +45,8 @@
{
FunctionLoader loader = new FileFunctionLoader(new File(path), true);
if (!prepend)
- getFunctionManager().addFunctionLoader(loader);
- else getFunctionManager().addFunctionLoaderAt(0, loader);
+ globals.getFunctionManager().addFunctionLoader(loader);
+ else globals.getFunctionManager().addFunctionLoaderAt(0, loader);
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -2,6 +2,8 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.net.*;
import java.util.*;
@@ -11,15 +13,19 @@
/**An external function for checking for updates over the network*/
public class checkforupdates extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ GlobalValues globals = null;
+
+ public OperandToken evaluate(Token[] operands, GlobalValues _globals)
{
+
+ globals = _globals;
String s = "";
String lineFile = "";
String updateSiteS = "http://www.jmathlib.de/checkForUpdates/";
boolean silentB = false;
- s = getInterpreter().prefs.getLocalProperty("update.site.primary");
+ s = globals.getInterpreter().prefs.getLocalProperty("update.site.primary");
if (s != null)
updateSiteS = s;
@@ -37,22 +43,22 @@
else
{
updateSiteS = s;
- getInterpreter().displayText("Update Site "+updateSiteS);
+ globals.getInterpreter().displayText("Update Site "+updateSiteS);
}
}
}
if (!silentB)
- getInterpreter().displayText("Checking for Updates at "+updateSiteS);
+ globals.getInterpreter().displayText("Checking for Updates at "+updateSiteS);
- String[] lastUpdateS = getInterpreter().prefs.getLocalProperty("update.date.last").split("/");
+ String[] lastUpdateS = globals.getInterpreter().prefs.getLocalProperty("update.date.last").split("/");
int year = Integer.parseInt(lastUpdateS[0]);
int month = Integer.parseInt(lastUpdateS[1])-1;
int day = Integer.parseInt(lastUpdateS[2]);
//getInterpreter().displayText("check:"+year+"/"+month+"/"+day);
- int intervall = Integer.parseInt(getInterpreter().prefs.getLocalProperty("update.intervall"));
+ int intervall = Integer.parseInt(globals.getInterpreter().prefs.getLocalProperty("update.intervall"));
GregorianCalendar calFile = new GregorianCalendar(year,month,day);
GregorianCalendar calCur = new GregorianCalendar();
@@ -136,7 +142,7 @@
System.out.println("checkForUpdates: Properties error");
}
- String[] localVersionS = getInterpreter().prefs.getLocalProperty("jmathlib.version").replace("/",".").split("\\.");
+ String[] localVersionS = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version").replace("/",".").split("\\.");
String[] webVersionS = props.getProperty("jmathlib.version").replace("/",".").split("\\.");
// build version number of local version
@@ -166,42 +172,42 @@
{
// set marker for next startup
- getInterpreter().prefs.setLocalProperty("update.newversionavailable","yes");
+ globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable","yes");
s = props.getProperty("update.newversionavailable.message01");
if (s!=null)
{
- getInterpreter().prefs.setLocalProperty("update.newversionavailable.message01", s);
- getInterpreter().displayText(s);
+ globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable.message01", s);
+ globals.getInterpreter().displayText(s);
}
else
- getInterpreter().displayText("There is a new version of JMathLib available");
+ globals.getInterpreter().displayText("There is a new version of JMathLib available");
s = props.getProperty("update.newversionavailable.message02");
if (s!=null)
{
- getInterpreter().prefs.setLocalProperty("update.newversionavailable.message02", s);
- getInterpreter().displayText(s);
+ globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable.message02", s);
+ globals.getInterpreter().displayText(s);
}
}
else if (webVersion < localVersion)
{
- getInterpreter().displayText("Funny! The version of JMathLib on the web is older than your local version");
+ globals.getInterpreter().displayText("Funny! The version of JMathLib on the web is older than your local version");
}
else
{
if (!silentB)
{
- getInterpreter().displayText("The local version of JMathLib is up to date");
+ globals.getInterpreter().displayText("The local version of JMathLib is up to date");
s=props.getProperty("update.uptodate.message01");
if (s!=null)
- getInterpreter().displayText(s);
+ globals.getInterpreter().displayText(s);
s=props.getProperty("update.uptodate.message02");
if (s!=null)
- getInterpreter().displayText(s);
+ globals.getInterpreter().displayText(s);
}
}
@@ -213,23 +219,23 @@
String checkedDate = Integer.toString(cal.get(Calendar.YEAR)) + "/"
+ Integer.toString(cal.get(Calendar.MONTH)+1) + "/"
+ Integer.toString(cal.get(Calendar.DAY_OF_MONTH));
- getInterpreter().prefs.setLocalProperty("update.date.last", checkedDate);
+ globals.getInterpreter().prefs.setLocalProperty("update.date.last", checkedDate);
// update link to primary update-site
s= props.getProperty("update.site.primary");
if (s!=null)
- getInterpreter().prefs.setLocalProperty("update.site.primary",s);
+ globals.getInterpreter().prefs.setLocalProperty("update.site.primary",s);
// update link to backup update-site
s= props.getProperty("update.site.backup");
if (s!=null)
- getInterpreter().prefs.setLocalProperty("update.site.backup",s);
+ globals.getInterpreter().prefs.setLocalProperty("update.site.backup",s);
// update message of the day
s= props.getProperty("message.of.the.day");
if (s!=null)
- getInterpreter().prefs.setLocalProperty("message.of.the.day",s);
+ globals.getInterpreter().prefs.setLocalProperty("message.of.the.day",s);
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -23,16 +23,16 @@
public class createFunctionsList extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Vector pathVector = new Vector();
// get all search paths from all file loaders
- for (int i=0;i<getFunctionManager().getFunctionLoaderCount();i++)
+ for (int i=0;i<globals.getFunctionManager().getFunctionLoaderCount();i++)
{
- FunctionLoader loader = getFunctionManager().getFunctionLoader(i);
+ FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
if (loader instanceof FileFunctionLoader)
{
@@ -52,13 +52,13 @@
String path = "";
String line = "";
- ErrorLogger.debugLine("working directory: "+getWorkingDirectory().getAbsolutePath());
+ ErrorLogger.debugLine("working directory: "+globals.getWorkingDirectory().getAbsolutePath());
try
{
// create file to store all class-, m-files and images
- File funcFile = new File(getWorkingDirectory().getAbsoluteFile() +
+ File funcFile = new File(globals.getWorkingDirectory().getAbsoluteFile() +
File.separator + "bin" +
File.separator + "jmathlib" +
File.separator + "webFunctionsList.dat");
@@ -101,7 +101,7 @@
!line.contains(".svn") )
{
// remove preceding absolute path
- line = line.substring((getWorkingDirectory().getAbsolutePath()+"/bin/").length());
+ line = line.substring((globals.getWorkingDirectory().getAbsolutePath()+"/bin/").length());
ErrorLogger.debugLine("path = "+ line);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -12,7 +12,7 @@
/**Executes an expression, displaying the parse tree.
@param operand[0] = the string containing the expression
@return the result of the expression*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String answer = "";
if(operands[0] instanceof CharToken)
@@ -26,7 +26,7 @@
// open a tree to show the expression-tree for a parsed command
jmathlib.tools.treeanalyser.TreeAnalyser treeAnalyser = new jmathlib.tools.treeanalyser.TreeAnalyser(expressionTree);
- OperandToken answerToken = expressionTree.evaluate(null);
+ OperandToken answerToken = expressionTree.evaluate(null, globals);
//while(answerToken != null)
//{
if(answerToken != null)
@@ -36,7 +36,7 @@
//if(answerToken.display)
// answer += answerToken.toString() + "\n";
- answerToken = expressionTree.evaluate(null);
+ answerToken = expressionTree.evaluate(null, globals);
}
//}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -3,17 +3,18 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for writing to the main display*/
public class disp extends ExternalFunction
{
/**write operand to main display
@param operand[n] = items to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
for(int index = 0; index < operands.length; index++)
{
- getInterpreter().displayText(operands[index].toString());
+ globals.getInterpreter().displayText(operands[index].toString());
}
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -5,6 +5,7 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for displaying error messages
aborts the current function being processed*/
@@ -12,7 +13,7 @@
{
/**write operand to main display then abort processing
@param operand[n] = error messages to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if(operands[0] instanceof CharToken)
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -13,7 +13,7 @@
@param operand[1] = a string containing the variable name
@param operand[2] = a string containing the expression
@return 0 if there were any errors, otherwise it returns 1*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
int result = 0;
//check that the first operand is a matrix
@@ -27,7 +27,7 @@
if((operands[1] instanceof CharToken) && (operands[2] instanceof CharToken))
{
//create a variable with the correct name
- Variable var = createVariable(((CharToken)operands[1]).toString());
+ Variable var = globals.createVariable(((CharToken)operands[1]).toString());
String expression = ((CharToken)operands[2]).toString();
//parse the expression
@@ -44,7 +44,7 @@
OperandToken exp = ((OperandToken)expressionTree.clone());
- exp.evaluate(null);
+ exp.evaluate(null, globals);
}
}
result = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:37:19
|
Revision: 714
http://mathlib.svn.sourceforge.net/mathlib/?rev=714&view=rev
Author: st_mueller
Date: 2009-01-21 19:37:16 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -6,6 +6,7 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for checking the number of arguments*/
public class nargchk extends ExternalFunction
@@ -17,7 +18,7 @@
@return an error string if the number of arguments is
not between the lowest and highest values
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -6,6 +6,7 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for checking the number of arguments*/
public class nargoutchk extends ExternalFunction
@@ -17,7 +18,7 @@
@return an error string if the number of arguments is
not between the lowest and highest values
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -4,13 +4,14 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for writing to the main display*/
public class newline extends ExternalFunction
{
/**write operand to main display
@param operand[n] = items to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
double count = 1;
@@ -21,7 +22,7 @@
for(int index = 0; index < count; index++)
{
- getInterpreter().displayText("");
+ globals.getInterpreter().displayText("");
}
return new DoubleNumberToken(1);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -3,6 +3,7 @@
import jmathlib.core.functions.FunctionLoader;
import jmathlib.core.functions.FileFunctionLoader;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -13,14 +14,14 @@
public class path extends ExternalFunction
{
/**return the search path as a string token*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
StringBuffer pathString = new StringBuffer();
- for (int i=0; i<getFunctionManager().getFunctionLoaderCount(); i++)
+ for (int i=0; i<globals.getFunctionManager().getFunctionLoaderCount(); i++)
{
// get one of the function loaders
- FunctionLoader loader = getFunctionManager().getFunctionLoader(i);
+ FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
// check if loader is loading files
if (loader instanceof FileFunctionLoader)
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -3,10 +3,11 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class print_usage extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
throwMathLibException("print_usage");
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for displaying error messages
aborts the current function being processed*/
@@ -11,7 +12,7 @@
{
/**write operand to main display then abort processing
@param operand[n] = error messages to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String val = "";
if(operands[0] instanceof CharToken)
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -2,10 +2,11 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class quit extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if ((getNArgIn(operands) == 1) &&
@@ -20,7 +21,7 @@
}
// run finish script and save local properties
- getInterpreter().save();
+ globals.getInterpreter().save();
// exit JMathLib
System.exit(0);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -2,13 +2,14 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class rehash extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
- getFunctionManager().checkAndRehashTimeStamps();
+ globals.getFunctionManager().checkAndRehashTimeStamps();
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -3,6 +3,7 @@
import jmathlib.core.functions.FunctionLoader;
import jmathlib.core.functions.FileFunctionLoader;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -14,7 +15,7 @@
{
/**removes an item from the search path
@param operands[0] = item to remove*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=1)
throwMathLibException("rmpath: number of arguments != 1");
@@ -24,9 +25,9 @@
File path = new File(((CharToken)operands[0]).toString());
- for (int i=0;i<getFunctionManager().getFunctionLoaderCount();i++)
+ for (int i=0;i<globals.getFunctionManager().getFunctionLoaderCount();i++)
{
- FunctionLoader loader = getFunctionManager().getFunctionLoader(i);
+ FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
if (loader instanceof FileFunctionLoader)
{
@@ -34,7 +35,7 @@
if (ffl.getBaseDirectory().compareTo(path) == 0)
{
- getFunctionManager().removeFunctionLoader(loader);
+ globals.getFunctionManager().removeFunctionLoader(loader);
break;
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**External function for controlling the debug setting for the system*/
public class setdebug extends ExternalFunction
@@ -11,7 +12,7 @@
/**Sets the debug flag
@param operands[0] = 1, show debug info
0, to turn debug info off*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) !=1)
throwMathLibException("setdebug: number of arguments !=1");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:34:36
|
Revision: 713
http://mathlib.svn.sourceforge.net/mathlib/?rev=713&view=rev
Author: st_mueller
Date: 2009-01-21 19:34:32 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String name = operands[0].toString();
String prop = operands[1].toString();
- getInterpreter().prefs.setGlobalProperty(name, prop);
+ globals.getInterpreter().prefs.setGlobalProperty(name, prop);
return result;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String name = operands[0].toString();
String prop = operands[1].toString();
- getInterpreter().prefs.setLocalProperty(name, prop);
+ globals.getInterpreter().prefs.setLocalProperty(name, prop);
return result;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -6,30 +6,31 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for updating JMathLib*/
public class update extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String lineFile = "";
boolean successB = true;
- getInterpreter().displayText("UPDATING JMathLib\n");
+ globals.getInterpreter().displayText("UPDATING JMathLib\n");
// get update site of jmathlib
- String updateSiteS = getInterpreter().prefs.getLocalProperty("update.site.primary");
- getInterpreter().displayText("update site: "+updateSiteS);
+ String updateSiteS = globals.getInterpreter().prefs.getLocalProperty("update.site.primary");
+ globals.getInterpreter().displayText("update site: "+updateSiteS);
// get local version of jmathlib
- String localVersionS = getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ String localVersionS = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
localVersionS = localVersionS.replaceAll("/", ".");
- getInterpreter().displayText("current version: "+localVersionS);
+ globals.getInterpreter().displayText("current version: "+localVersionS);
// first check to which version an update is possible
- getInterpreter().displayText("Checking to which version an update is possible");
+ globals.getInterpreter().displayText("Checking to which version an update is possible");
// url of the update site including the request for the version
@@ -63,20 +64,20 @@
String updateVersionS = props.getProperty("update.toversion");
if (updateVersionS.equals("no_update_available"))
{
- getInterpreter().displayText("No update available right now.");
+ globals.getInterpreter().displayText("No update available right now.");
return null;
}
if (updateVersionS.equals("full_download_required"))
{
- getInterpreter().displayText("\n");
- getInterpreter().displayText("Full download required in order to update!");
- getInterpreter().displayText("Please visit www.jmathlib.de for details.");
- getInterpreter().displayText("\n");
+ globals.getInterpreter().displayText("\n");
+ globals.getInterpreter().displayText("Full download required in order to update!");
+ globals.getInterpreter().displayText("Please visit www.jmathlib.de for details.");
+ globals.getInterpreter().displayText("\n");
return null;
}
- getInterpreter().displayText("updating to version >"+updateVersionS+"< \n");
+ globals.getInterpreter().displayText("updating to version >"+updateVersionS+"< \n");
// download new files from server
@@ -106,7 +107,7 @@
{
// read a file from the server and place it on the local disc
String fileS = s.substring(5).trim();
- getInterpreter().displayText("new file: >"+fileS+"<");
+ globals.getInterpreter().displayText("new file: >"+fileS+"<");
// open URL to file on update server
try
@@ -115,7 +116,7 @@
InputStream in = fileURL.openStream();
// open file on local disc
- File file = new File(getWorkingDirectory(),fileS);
+ File file = new File(globals.getWorkingDirectory(),fileS);
OutputStream out = new FileOutputStream(file);
byte[] cbuf = new byte[4096];
@@ -131,7 +132,7 @@
catch (Exception e)
{
successB = false;
- getInterpreter().displayText("update: problem downloading "+fileS);
+ globals.getInterpreter().displayText("update: problem downloading "+fileS);
}
}
@@ -139,16 +140,16 @@
{
// create a directory on the local disc
String dirS = s.substring(4).trim();
- getInterpreter().displayText("new directory: >"+dirS+"<");
+ globals.getInterpreter().displayText("new directory: >"+dirS+"<");
try
{
- File file = new File(getWorkingDirectory(),dirS);
+ File file = new File(globals.getWorkingDirectory(),dirS);
file.mkdir();
}
catch (Exception e)
{
successB = false;
- getInterpreter().displayText("update: problem creating directory "+dirS);
+ globals.getInterpreter().displayText("update: problem creating directory "+dirS);
}
}
@@ -156,25 +157,25 @@
{
// delete a file/directory on the local disc
String delS = s.substring(4).trim();
- getInterpreter().displayText("delete file/dir: >"+delS+"<");
+ globals.getInterpreter().displayText("delete file/dir: >"+delS+"<");
try
{
- File file = new File(getWorkingDirectory(),delS);
+ File file = new File(globals.getWorkingDirectory(),delS);
file.delete();
}
catch (Exception e)
{
successB = false;
- getInterpreter().displayText("update: problem deleting "+delS);
+ globals.getInterpreter().displayText("update: problem deleting "+delS);
}
}
else if (s.startsWith("prop"))
{
// delete a file/directory on the local disc
String propS = s.substring(5).trim();
- getInterpreter().displayText("new property: >"+propS+"<");
+ globals.getInterpreter().displayText("new property: >"+propS+"<");
String[] p = propS.split("=");
- getInterpreter().prefs.setLocalProperty(p[0],p[1]);
+ globals.getInterpreter().prefs.setLocalProperty(p[0],p[1]);
}
else
{
@@ -196,7 +197,7 @@
// notifiy user
if (!successB)
- getInterpreter().displayText("\n Update was not successful. Repeat again later on or inform the admin.");
+ globals.getInterpreter().displayText("\n Update was not successful. Repeat again later on or inform the admin.");
return null;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for displaying error messages
aborts the current function being processed*/
@@ -11,7 +12,7 @@
{
/**write operand to main display then abort processing
@param operand[0] = error messages to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Errors.throwUsageException(operands[0].toString());
//Errors.throwMathLibException(ERR_USER_ERROR, new Object[] {operands[0]});
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -2,31 +2,32 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for returning versionn information*/
public class ver extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String s = "";
- getInterpreter().displayText("Version information for JMathLib");
+ globals.getInterpreter().displayText("Version information for JMathLib");
- s = getInterpreter().prefs.getLocalProperty("jmathlib.version");
- getInterpreter().displayText("version: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ globals.getInterpreter().displayText("version: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
- getInterpreter().displayText("release date: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
+ globals.getInterpreter().displayText("release date: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
- getInterpreter().displayText("release name: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
+ globals.getInterpreter().displayText("release name: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
- getInterpreter().displayText("release description: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
+ globals.getInterpreter().displayText("release description: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
- getInterpreter().displayText(s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
+ globals.getInterpreter().displayText(s);
return null;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -2,31 +2,32 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for returning versionn information*/
public class version extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String s = "";
- getInterpreter().displayText("Version information for JMathLib");
+ globals.getInterpreter().displayText("Version information for JMathLib");
- s = getInterpreter().prefs.getLocalProperty("jmathlib.version");
- getInterpreter().displayText("version: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ globals.getInterpreter().displayText("version: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
- getInterpreter().displayText("release date: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
+ globals.getInterpreter().displayText("release date: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
- getInterpreter().displayText("release name: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
+ globals.getInterpreter().displayText("release name: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
- getInterpreter().displayText("release description: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
+ globals.getInterpreter().displayText("release description: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
- getInterpreter().displayText(s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
+ globals.getInterpreter().displayText(s);
return null;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -5,6 +5,7 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.interpreter.Variable;
/**An external function for writing to the main display
@@ -13,16 +14,16 @@
{
/**write operand to main display
@param operand[n] = items to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String message = "";
for(int index = 0; index < operands.length; index++)
{
message = operands[index].toString();
- getInterpreter().displayText(message);
+ globals.getInterpreter().displayText(message);
}
- Variable var = createVariable("lastwarning");
+ Variable var = globals.createVariable("lastwarning");
var.assign(new CharToken(message));
return new DoubleNumberToken(1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:32:49
|
Revision: 712
http://mathlib.svn.sourceforge.net/mathlib/?rev=712&view=rev
Author: st_mueller
Date: 2009-01-21 19:32:46 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -14,7 +15,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -34,23 +35,23 @@
//setNumberFormat(DecimalFormat.getInstance(Locale.ENGLISH));
if (type.equals("short"))
- setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long"))
- setNumberFormat(new DecimalFormat("0.000000000000000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("short e"))
- setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long e"))
- setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("short g"))
- setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long g"))
- setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("short eng"))
- setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long eng"))
- setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else
- setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
return result;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -13,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String defaultVal = "";
- String property = getInterpreter().prefs.getGlobalProperty(name);
+ String property = globals.getInterpreter().prefs.getGlobalProperty(name);
result = new CharToken(property);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String defaultVal = "";
- String property = getInterpreter().prefs.getLocalProperty(name);
+ String property = globals.getInterpreter().prefs.getLocalProperty(name);
result = new CharToken(property);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.plugins.dynjava.JavaPlugin;
/**An example of an external function - it returns the first parameter*/
@@ -12,13 +13,13 @@
/**Executes the function - returning the first parameter
@param operands - the array of parameters
@return the result of the function as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// load java plugin
- getPluginsManager().addPlugin("JavaPlugin");
+ globals.getPluginsManager().addPlugin("JavaPlugin");
- String result = ((JavaPlugin)getPluginsManager().getPlugin("JavaPlugin")).executeJavaExpression(operands[0].toString());
+ String result = ((JavaPlugin)globals.getPluginsManager().getPlugin("JavaPlugin")).executeJavaExpression(operands[0].toString());
return new CharToken(result);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:31:21
|
Revision: 711
http://mathlib.svn.sourceforge.net/mathlib/?rev=711&view=rev
Author: st_mueller
Date: 2009-01-21 19:31:17 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/string/blanks.java
JMathLib/trunk/src/jmathlib/toolbox/string/findstr.java
JMathLib/trunk/src/jmathlib/toolbox/string/isspace.java
JMathLib/trunk/src/jmathlib/toolbox/string/lower.java
JMathLib/trunk/src/jmathlib/toolbox/string/num2str.java
JMathLib/trunk/src/jmathlib/toolbox/string/sprintf.java
JMathLib/trunk/src/jmathlib/toolbox/string/str2num.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/blanks.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/blanks.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/blanks.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -4,12 +4,13 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for changing numbers into strings*/
public class blanks extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/findstr.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/findstr.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/findstr.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for finding a string within another*/
@@ -12,7 +13,7 @@
/**finds shorter string within a longer one
@param operands[0] = first string
@param operands[1] = second string*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
if (getNArgIn(operands) !=2)
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/isspace.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/isspace.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/isspace.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -4,12 +4,13 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for checking on whitespaces */
public class isspace extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=1)
throwMathLibException("isspace: number of input arguments != 1");
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/lower.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/lower.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/lower.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -3,12 +3,13 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for creating random numbers*/
public class lower extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/num2str.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/num2str.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/num2str.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -4,12 +4,13 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for changing numbers into strings*/
public class num2str extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand
if (getNArgIn(operands)!=1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/sprintf.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/sprintf.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/sprintf.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -30,7 +30,7 @@
/**returns a matrix of numbers
* @param operands[0] = string (e.g. ["hello"])
* @return a matrix of numbers */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand
Modified: JMathLib/trunk/src/jmathlib/toolbox/string/str2num.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/string/str2num.java 2009-01-21 19:30:34 UTC (rev 710)
+++ JMathLib/trunk/src/jmathlib/toolbox/string/str2num.java 2009-01-21 19:31:17 UTC (rev 711)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.CharToken;
/**An external function for changing strings into numbers */
@@ -12,7 +13,7 @@
/**returns a matrix of numbers
* @param operands[0] = string (e.g. ["hello"])
* @return a matrix of numbers */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|