mathlib-commitlog Mailing List for JMathLib - Octave, Matlab clone in java (Page 12)
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-06 13:17:42
|
Revision: 635
http://mathlib.svn.sourceforge.net/mathlib/?rev=635&view=rev
Author: st_mueller
Date: 2009-01-06 13:17:40 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
more directories for tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/ode/
JMathLib/trunk/src/jmathlibtests/toolbox/ode/AllTests.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/ode/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/ode/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/ode/AllTests.java 2009-01-06 13:17:40 UTC (rev 635)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.ode;
+
+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("ode 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-06 13:17:28
|
Revision: 634
http://mathlib.svn.sourceforge.net/mathlib/?rev=634&view=rev
Author: st_mueller
Date: 2009-01-06 13:17:20 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
more directories for tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/integration/
JMathLib/trunk/src/jmathlibtests/toolbox/integration/AllTests.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/integration/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/integration/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/integration/AllTests.java 2009-01-06 13:17:20 UTC (rev 634)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.integration;
+
+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("integration 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-06 13:17:04
|
Revision: 633
http://mathlib.svn.sourceforge.net/mathlib/?rev=633&view=rev
Author: st_mueller
Date: 2009-01-06 13:17:03 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
more directories for tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/ftp/
JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/ftp/AllTests.java 2009-01-06 13:17:03 UTC (rev 633)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.ftp;
+
+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("ftp 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-06 13:16:48
|
Revision: 632
http://mathlib.svn.sourceforge.net/mathlib/?rev=632&view=rev
Author: st_mueller
Date: 2009-01-06 13:16:47 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
more directories for tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/engine/
JMathLib/trunk/src/jmathlibtests/toolbox/engine/AllTests.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/engine/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/engine/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/engine/AllTests.java 2009-01-06 13:16:47 UTC (rev 632)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.engine;
+
+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("engine 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-06 13:16:25
|
Revision: 631
http://mathlib.svn.sourceforge.net/mathlib/?rev=631&view=rev
Author: st_mueller
Date: 2009-01-06 13:16:23 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
more directories for tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/splines/
JMathLib/trunk/src/jmathlibtests/toolbox/splines/AllTests.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/splines/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/splines/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/splines/AllTests.java 2009-01-06 13:16:23 UTC (rev 631)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.splines;
+
+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("splines 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-06 13:16:08
|
Revision: 630
http://mathlib.svn.sourceforge.net/mathlib/?rev=630&view=rev
Author: st_mueller
Date: 2009-01-06 13:16:07 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
more directories for tests
Added Paths:
-----------
JMathLib/trunk/src/jmathlibtests/toolbox/video/
JMathLib/trunk/src/jmathlibtests/toolbox/video/AllTests.java
Added: JMathLib/trunk/src/jmathlibtests/toolbox/video/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/video/AllTests.java (rev 0)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/video/AllTests.java 2009-01-06 13:16:07 UTC (rev 630)
@@ -0,0 +1,25 @@
+package jmathlibtests.toolbox.video;
+
+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("video 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-06 12:22:52
|
Revision: 629
http://mathlib.svn.sourceforge.net/mathlib/?rev=629&view=rev
Author: st_mueller
Date: 2009-01-06 12:22:47 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
added more directories
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java 2009-01-05 15:14:35 UTC (rev 628)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/AllTests.java 2009-01-06 12:22:47 UTC (rev 629)
@@ -20,30 +20,38 @@
suite.addTest(jmathlibtests.toolbox.crypto.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.demos.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.deprecated.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.engine.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.finance.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.ftp.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.funfun.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.general.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.image.AllTests.suite());
//suite.addTest(jmathlibtests.toolbox.GuiTools.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.io.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.integration.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.jmathlib.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.linearalgebra.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.miscellaneous.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.net.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.ode.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.optimization.AllTests.suite());
- suite.addTest(jmathlibtests.toolbox.polynomial.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.physical_constants.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.polynomial.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.quaternion.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.set.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.signal.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.sparse.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.specfun.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.specialmatrix.AllTests.suite());
+ suite.addTest(jmathlibtests.toolbox.splines.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.statistics.AllTests.suite());
suite.addTest(jmathlibtests.toolbox.string.AllTests.suite());
//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.trigonometric.AllTests.suite());
-
+ suite.addTest(jmathlibtests.toolbox.video.AllTests.suite());
+
/* include tests in this directory */
suite.addTest(jmathlibtests.toolbox.testFunctions.suite());
suite.addTest(jmathlibtests.toolbox.testStandardFunctions.suite());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:14:39
|
Revision: 628
http://mathlib.svn.sourceforge.net/mathlib/?rev=628&view=rev
Author: st_mueller
Date: 2009-01-05 15:14:35 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-01-05 15:14:25 UTC (rev 627)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-01-05 15:14:35 UTC (rev 628)
@@ -24,10 +24,10 @@
int matSizeX = matrix.getSizeX();
int matSizeY = matrix.getSizeY();
- if(operands[1] instanceof CharToken && operands[2] instanceof CharToken)
+ if((operands[1] instanceof CharToken) && (operands[2] instanceof CharToken))
{
//create a variable with the correct name
- Variable var = getVariables().createVariable(((CharToken)operands[1]).toString());
+ Variable var = createVariable(((CharToken)operands[1]).toString());
String expression = ((CharToken)operands[2]).toString();
//parse the expression
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:14:29
|
Revision: 627
http://mathlib.svn.sourceforge.net/mathlib/?rev=627&view=rev
Author: st_mueller
Date: 2009-01-05 15:14:25 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-01-05 15:14:00 UTC (rev 626)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-01-05 15:14:25 UTC (rev 627)
@@ -22,7 +22,7 @@
getInterpreter().displayText(message);
}
- Variable var = getVariables().createVariable("lastwarning");
+ Variable var = createVariable("lastwarning");
var.assign(new CharToken(message));
return new DoubleNumberToken(1);
@@ -39,7 +39,7 @@
@NOTES
This function sets the lastwarning variable
@EXAMPLES
-WARNING("Danger, danger")
+warning("Danger, danger")
Danger, danger
@SEE
error, exit
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:14:04
|
Revision: 626
http://mathlib.svn.sourceforge.net/mathlib/?rev=626&view=rev
Author: st_mueller
Date: 2009-01-05 15:14:00 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java
JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java 2009-01-05 15:13:40 UTC (rev 625)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/loadvariables.java 2009-01-05 15:14:00 UTC (rev 626)
@@ -23,7 +23,7 @@
file = ((CharToken)operands[0]).toString();
}
- getVariables().loadVariables(file);
+ getLocalVariables().loadVariables(file);
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java 2009-01-05 15:13:40 UTC (rev 625)
+++ JMathLib/trunk/src/jmathlib/toolbox/io/savevariables.java 2009-01-05 15:14:00 UTC (rev 626)
@@ -23,7 +23,7 @@
file = ((CharToken)operands[0]).toString();
}
- getVariables().saveVariables(file);
+ getLocalVariables().saveVariables(file);
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-05 15:13:44
|
Revision: 625
http://mathlib.svn.sourceforge.net/mathlib/?rev=625&view=rev
Author: st_mueller
Date: 2009-01-05 15:13:40 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
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-05 15:11:55 UTC (rev 624)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/who.java 2009-01-05 15:13:40 UTC (rev 625)
@@ -4,8 +4,8 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.interpreter.*;
import jmathlib.core.functions.ExternalFunction;
+import java.util.*;
-import java.util.*;
/**An external function for getting the stored variables*/
public class who extends ExternalFunction
{
@@ -19,7 +19,7 @@
getInterpreter().displayText("\nYour variables are:\n");
- Iterator iter = getVariables().getIterator();
+ Iterator iter = getLocalVariables().getIterator();
while(iter.hasNext())
{
Map.Entry next = ((Map.Entry)iter.next());
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/whos.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/whos.java 2009-01-05 15:11:55 UTC (rev 624)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/whos.java 2009-01-05 15:13:40 UTC (rev 625)
@@ -11,7 +11,7 @@
public OperandToken evaluate(Token[] operands)
{
- Iterator iter = getVariables().getIterator();
+ Iterator iter = getLocalVariables().getIterator();
// display header information
getInterpreter().displayText("\nYour variables are:\n");
@@ -22,21 +22,28 @@
{
if ((operands[0] instanceof CharToken))
{
- String data = ((CharToken)operands[0]).getValue().toLowerCase();
+ String data = ((CharToken)operands[0]).getValue();
if (data.equals("global"))
iter = getGlobalVariables().getIterator();
}
}
+ // iterate through the complete local variable list
while(iter.hasNext())
{
- Map.Entry next = ((Map.Entry)iter.next());
- Variable var = (Variable)next.getValue();
- OperandToken op = (OperandToken)var.getData();
- String line = "";
+ Map.Entry next = ((Map.Entry)iter.next());
+ Variable var = (Variable)next.getValue();
+ OperandToken op = (OperandToken)var.getData();
+ Boolean global = var.isGlobal();
+ String name = var.getName();
+ String line = "";
- line = var.getName()+" \t";
+ line = name + " \t";
+ // if variable is global get data from global context
+ if (global)
+ op = (OperandToken)getGlobalVariables().getVariable(name).getData();
+
// check which type of variable
if (op instanceof DataToken)
{
@@ -48,8 +55,9 @@
line += " \t unknown";
}
- if (getGlobalVariables().isVariable(var.getName()))
- line += "(global)";
+ //if (getLocalVariables().isVariable(var.getName()))
+ if (global)
+ line += "(global)";
getInterpreter().displayText(line);
}
@@ -85,11 +93,12 @@
general
@SYNTAX
whos
+whos("global")
@DOC
Returns a list of all the variables in the system.
@EXAMPLES
@NOTES
@SEE
-who
+who, clear, global
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:11:58
|
Revision: 624
http://mathlib.svn.sourceforge.net/mathlib/?rev=624&view=rev
Author: st_mueller
Date: 2009-01-05 15:11:55 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/general/global.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/global.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/global.java 2009-01-05 15:10:21 UTC (rev 623)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/global.java 2009-01-05 15:11:55 UTC (rev 624)
@@ -23,20 +23,54 @@
debugLine("global "+operands[0].toString());
- debugLine("global: local variable:"+getVariables().isVariable(var.getName()));
+ debugLine("global: local variable:"+getLocalVariables().isVariable(var.getName()));
debugLine("global: global variable:"+getGlobalVariables().isVariable(var.getName()));
+ // this is the procedure for global variables:
+ // - normally all variables a local to each workspace
+ // - the "global" workspace is a totally separate workspace
+ // - each workspace which defines a variable as global will
+ // use the "global" workspace instead of its own local workspace
+ // - in case a variable is defined as "global" in one workspace and
+ // "local" in another workspace, the local workspace will work
+ // with the "local" variable whereas the "global-one" will work
+ // with the "global" variable
+ // -> ALL indidivual workspaces which like to use the "global"
+ // version of a variable need to call "global variable-name"
+
+
// check if variable is already created in global context
if (getGlobalVariables().isVariable(name))
{
// variable is already created in global context
- // check if current context already contains variable
- if (getVariables().isVariable(name))
+ // check if local context already contains variable
+ if (getLocalVariables().isVariable(name))
{
- // remove variable from current workspace
- getVariables().remove(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);
+
+ 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" +
+ " please type: global variable\n"+
+ " before using a variable as global.");
}
+ else
+ {
+ // variable is not yet created in local context
+
+ // create empty variable and set "global" property
+ getLocalVariables().createVariable(name);
+ getLocalVariables().getVariable(name).setGlobal(true);
+
+ }
}
else
{
@@ -47,29 +81,26 @@
getGlobalVariables().getVariable(name).setGlobal(true);
// check if current context already contains variable
- if (getVariables().isVariable(name))
+ if (getLocalVariables().isVariable(name))
{
// current context already contains variable
- Variable varCurrent = getVariables().getVariable(name);
+ Variable varCurrent = getLocalVariables().getVariable(name);
getGlobalVariables().getVariable(name).assign(varCurrent.getData());
// remove variable, create new one and set variable to global
- getVariables().remove(name);
+ getLocalVariables().remove(name);
}
}
// create new variable in current context and set variable to global
- getVariables().createVariable(name);
- getVariables().getVariable(name).setGlobal(true);
+ getLocalVariables().createVariable(name);
+ getLocalVariables().getVariable(name).setGlobal(true);
debugLine("global:global var:"+name+" global="+getGlobalVariables().getVariable(name).isGlobal());
-
-
- debugLine("global:local var:"+name+" global="+getVariables().getVariable(name).isGlobal());
-
+ debugLine("global:local var:"+name+" global="+getLocalVariables().getVariable(name).isGlobal());
+
-
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-05 15:10:30
|
Revision: 623
http://mathlib.svn.sourceforge.net/mathlib/?rev=623&view=rev
Author: st_mueller
Date: 2009-01-05 15:10:21 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/general/clear.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/general/clear.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/general/clear.java 2009-01-05 15:08:24 UTC (rev 622)
+++ JMathLib/trunk/src/jmathlib/toolbox/general/clear.java 2009-01-05 15:10:21 UTC (rev 623)
@@ -19,6 +19,7 @@
if (getNArgIn(operands) != 1)
throwMathLibException("clear: number of arguments < 1");
+ // get subcommand or variable name
if (operands[0] instanceof VariableToken)
{
s = ((VariableToken)operands[0]).getName();
@@ -29,18 +30,44 @@
s = ((CharToken)operands[0]).getValue();
}
- if (!s.equals(" "))
+ // check what the user wans to clear
+ if (s.equals("variables"))
{
- // remove one variable
- getVariables().remove(s);
+ // only clear local variables
+ getLocalVariables().clear();
}
- else
+ else if (s.equals("globals"))
{
- getVariables().clear();
+ // clear global variables
getGlobalVariables().clear();
+ 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();
}
+ else if (s.equals("all"))
+ {
+ // clear everything
+ getLocalVariables().clear();
+ getGlobalVariables().clear();
+ getFunctionManager().clear();
+ }
+ else if (!s.equals(" "))
+ {
+ // remove one variable from local workspace
+ getLocalVariables().remove(s);
+ }
+ else
+ {
+ // clear without any arguments only clears the local workspace
+ getLocalVariables().clear();
+ }
+
return null;
}
}
@@ -52,6 +79,11 @@
clear(variable)
@DOC
Clears the specified variable or, if blank, clears all variables.
+clear()clears local variables
+clear("variables") clears local variables
+clear("globals") clears global variables
+clear("functions"" clear function cache
+clear("all") clear local variables, global variables and function cache
@EXAMPLE
<programlisting>
clear('x');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:08:34
|
Revision: 622
http://mathlib.svn.sourceforge.net/mathlib/?rev=622&view=rev
Author: st_mueller
Date: 2009-01-05 15:08:24 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/tokens/VariableToken.java
Modified: JMathLib/trunk/src/jmathlib/core/tokens/VariableToken.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/tokens/VariableToken.java 2009-01-05 15:06:37 UTC (rev 621)
+++ JMathLib/trunk/src/jmathlib/core/tokens/VariableToken.java 2009-01-05 15:08:24 UTC (rev 622)
@@ -151,7 +151,7 @@
return ((MathLibObject)getVariable(name).getData()).getFieldData(fieldName);
//}
}
- else if( !getVariables().isVariable(name) )
+ else if( getVariable(name) == null )
{
// variable is not yet defined (e.g. user typed sin(a) and "a" is unknown)
// or it is a function
@@ -248,7 +248,7 @@
{
ErrorLogger.debugLine("Variable data = NULL");
- /* display the result of this variable in the user console*/
+ // display the result of this variable in the user console
if (isDisplayResult())
getInterpreter().displayText(name +" = []");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:06:50
|
Revision: 621
http://mathlib.svn.sourceforge.net/mathlib/?rev=621&view=rev
Author: st_mueller
Date: 2009-01-05 15:06:37 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/tokens/ForOperatorToken.java
Modified: JMathLib/trunk/src/jmathlib/core/tokens/ForOperatorToken.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/tokens/ForOperatorToken.java 2009-01-05 15:06:26 UTC (rev 620)
+++ JMathLib/trunk/src/jmathlib/core/tokens/ForOperatorToken.java 2009-01-05 15:06:37 UTC (rev 621)
@@ -172,7 +172,7 @@
{
ErrorLogger.debugLine("vector for evaluating 1");
VariableToken variableToken = ((VariableToken)forExpression.getChild(0));
- Variable variable = getVariables().createVariable(variableToken.getName());
+ Variable variable = createVariable(variableToken.getName());
DoubleNumberToken vector = null;
Token child = forExpression.getChild(1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:06:29
|
Revision: 620
http://mathlib.svn.sourceforge.net/mathlib/?rev=620&view=rev
Author: st_mueller
Date: 2009-01-05 15:06:26 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/tokens/Expression.java
Modified: JMathLib/trunk/src/jmathlib/core/tokens/Expression.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/tokens/Expression.java 2009-01-05 15:06:17 UTC (rev 619)
+++ JMathLib/trunk/src/jmathlib/core/tokens/Expression.java 2009-01-05 15:06:26 UTC (rev 620)
@@ -59,7 +59,7 @@
children = new OperandToken[2];
children[0] = left;
children[1] = right;
- noChildren = 2;
+ noChildren = 2;
}
/**Creates an expression with three operands
@@ -314,7 +314,7 @@
if (children[i]!=null)
{
ErrorLogger.debugLine("Expression: store ans "+children[i].toString());
- Variable answervar = getVariables().createVariable("ans");
+ Variable answervar = createVariable("ans");
answervar.assign(children[i]);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:06:22
|
Revision: 619
http://mathlib.svn.sourceforge.net/mathlib/?rev=619&view=rev
Author: st_mueller
Date: 2009-01-05 15:06:17 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/tokens/AssignmentOperatorToken.java
Modified: JMathLib/trunk/src/jmathlib/core/tokens/AssignmentOperatorToken.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/tokens/AssignmentOperatorToken.java 2009-01-05 15:05:03 UTC (rev 618)
+++ JMathLib/trunk/src/jmathlib/core/tokens/AssignmentOperatorToken.java 2009-01-05 15:06:17 UTC (rev 619)
@@ -10,6 +10,9 @@
public class AssignmentOperatorToken extends BinaryOperatorToken
{
+ /**
+ *
+ */
public AssignmentOperatorToken()
{
/**call the super constructor, type defaults to ttoperator and operands to 2*/
@@ -50,13 +53,13 @@
{
// e.g. a{8}=...
ErrorLogger.debugLine("AssignmentOpTok: new cell");
- left = getVariables().createVariable(name);
+ left = createVariable(name);
left.assign(new CellArrayToken());
}
else if (!leftVarTok.isStruct())
{
// auto create a new variable
- left = getVariables().createVariable(name);
+ left = createVariable(name);
}
else if (leftVarTok.isStruct() &&
getVariable(name) == null)
@@ -65,7 +68,7 @@
ErrorLogger.debugLine("AssignmentOpTok: new struct: "+name+"."+fieldName);
MathLibObject obj = new MathLibObject();
obj.setField(fieldName, DoubleNumberToken.zero);
- Variable var = getVariables().createVariable(name );
+ Variable var = createVariable(name );
var.assign(obj);
left = ((MathLibObject)getVariable(name).getData()).getFieldVariable(fieldName);
}
@@ -181,7 +184,7 @@
ErrorLogger.debugLine("AssignmentOpTok: variable is null");
// create variable
- leftVar = getVariables().createVariable(varToken.getName() );
+ leftVar = createVariable(varToken.getName() );
}
// assign right side matrix to left side variable
@@ -222,7 +225,7 @@
ErrorLogger.debugLine("AssignmentOpTok: variable is null");
// create variable
- leftVar = getVariables().createVariable(varToken.getName() );
+ leftVar = createVariable(varToken.getName() );
}
// get number-matrix of an element on the right side
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:05:06
|
Revision: 618
http://mathlib.svn.sourceforge.net/mathlib/?rev=618&view=rev
Author: st_mueller
Date: 2009-01-05 15:05:03 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/functions/UserFunction.java
Modified: JMathLib/trunk/src/jmathlib/core/functions/UserFunction.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/functions/UserFunction.java 2009-01-05 15:02:49 UTC (rev 617)
+++ JMathLib/trunk/src/jmathlib/core/functions/UserFunction.java 2009-01-05 15:05:03 UTC (rev 618)
@@ -13,7 +13,7 @@
/** The code of the current m-function */
private OperandToken code;
- /**The names of the paramater values*/
+ /**The names of the parameter values*/
private ArrayList parameterVariables;
/**The names of the return values*/
@@ -25,9 +25,6 @@
/**Creates a user function */
public UserFunction()
{
- //VariableList localVariables = new VariableList();
- //functionContext = getContextList().createContext(localVariables);
-
parameterVariables = new ArrayList();
returnVariables = new ArrayList();
}
@@ -97,10 +94,10 @@
Errors.throwMathLibException("UserFunction: "+name+" number of parameters to large");
// set the variable NARGIN to the number of parameters of the calling function
- getVariables().createVariable("nargin").assign(new DoubleNumberToken(opLength));
+ createVariable("nargin").assign(new DoubleNumberToken(opLength));
// set the variable NARGOUT to the number of return values
- getVariables().createVariable("nargout").assign(new DoubleNumberToken(returnVariables.size()));
+ createVariable("nargout").assign(new DoubleNumberToken(returnVariables.size()));
//set the input parameters for the function
@@ -113,7 +110,7 @@
{
String parameterName = (String)parameterVariables.get(paramNo);
//System.out.println("UserFunction: "+parameterName);
- getVariables().createVariable(parameterName).assign((OperandToken)operands[paramNo]);
+ createVariable(parameterName).assign((OperandToken)operands[paramNo]);
}
}
else
@@ -127,7 +124,7 @@
{
String parameterName = (String)parameterVariables.get(paramNo);
ErrorLogger.debugLine("UserF: params: "+parameterName);
- getVariables().createVariable(parameterName).assign((OperandToken)operands[paramNo]);
+ createVariable(parameterName).assign((OperandToken)operands[paramNo]);
}
ErrorLogger.debugLine("UserF: remainingOps: "+ remainingOps);
@@ -144,13 +141,13 @@
values[i][0] = (OperandToken)operands[parameterVariables.size()-1+i];
}
CellArrayToken cell = new CellArrayToken(values);
- getVariables().createVariable("varargin").assign(cell);
+ createVariable("varargin").assign(cell);
}
else
{
// varargin is empty
CellArrayToken cell = new CellArrayToken();
- getVariables().createVariable("varargin").assign(cell);
+ createVariable("varargin").assign(cell);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:02:53
|
Revision: 617
http://mathlib.svn.sourceforge.net/mathlib/?rev=617&view=rev
Author: st_mueller
Date: 2009-01-05 15:02:49 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/ContextList.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/ContextList.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/ContextList.java 2009-01-05 15:00:55 UTC (rev 616)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/ContextList.java 2009-01-05 15:02:49 UTC (rev 617)
@@ -1,24 +1,26 @@
package jmathlib.core.interpreter;
+import jmathlib.core.tokens.OperandToken;
+
/**Stores a list of contexts. A context is a set of variables pluss some code.
When a function is called a new context is added to the list. When the function is removed, the context is destroyed. */
public class ContextList
{
// reference to the currently executing context
- private Context currentContext;
+ private Context localContext;
// reference to the global context
private Context globalContext;
/**Create an empty context to act as the global context
- * This constructor should only be called ONCE, because it also creates the
+ * This constructor must only be called ONCE, because it also creates the
* GLOBAL context
*/
public ContextList()
{
globalContext = new Context(); // global context
- currentContext = new Context(); // local context
+ localContext = new Context(); // local context
}
/**
@@ -27,11 +29,11 @@
*/
public void pushContext(Context context)
{
- context.setParent(currentContext);
- currentContext = context;
+ context.setParent(localContext);
+ localContext = context;
}
- /**Used to create a new context and put it on the stack when executing a function
+ /** Used to create a new context and put it on the stack when executing a function
* @param _variables = the variable list of the function, null if it's a script file
*/
public Context createContext(VariableList _variables)
@@ -40,14 +42,14 @@
if(_variables == null)
{
//use the calling functions variable list
- _variables = currentContext.getVariables();
+ _variables = localContext.getVariables();
}
//create a new context and make it the current context
- //currentContext = new Context(_variables, null, currentContext);
- currentContext = new Context(_variables, currentContext);
+ //localContext = new Context(_variables, null, localContext);
+ localContext = new Context(_variables, localContext);
- return currentContext;
+ return localContext;
}
/**
@@ -55,17 +57,17 @@
*/
public Context popContext()
{
- Context context = currentContext;
- currentContext = currentContext.getParent();
+ Context context = localContext;
+ localContext = localContext.getParent();
return context;
}
/**
* @return the variable list of the current context
*/
- public VariableList getVariables()
+ public VariableList getLocalVariables()
{
- return currentContext.getVariables();
+ return localContext.getVariables();
}
/**
@@ -77,14 +79,16 @@
}
/**
- *
+ * this method returns a variable from the workspace. It also checks
+ * if the variable is local or global and returns the value from
+ * the correct local or global workspace.
* @param name
* @return
*/
public Variable getVariable(String name)
{
// check if variable is marked as global in current context
- Variable var = currentContext.getVariables().getVariable(name);
+ Variable var = localContext.getVariables().getVariable(name);
if ((var!=null) && (var.isGlobal()))
{
// variable is marked global
@@ -95,24 +99,62 @@
{
// variable is local only
// return data from current context
- return currentContext.getVariables().getVariable(name);
+ return localContext.getVariables().getVariable(name);
}
}
+
+ /**
+ * create a variable in the local or global workspace
+ * @param
+ * @return
+ */
+ public Variable createVariable(String name)
+ {
+ // check if variable is already created in local or global workspace
+ Variable var = getVariable(name);
+
+ // return if variable is already created
+ if (getVariable(name)!=null)
+ return var;
+
+ // create a local variable
+ return getLocalVariables().createVariable(name);
+
+ }
/**
+ * Set a variable in the local or global workspace. In case
+ * the variable is not yet created, create it, too.
+ * @param
+ * @param
+ */
+ public void setVariable(String name, OperandToken value)
+ {
+ // try to get variable from local or global context
+ Variable var = getVariable(name);
+
+ // if variable is not yet available, create it
+ if (var==null)
+ createVariable(name);
+
+ // assign value to newly created variable
+ getVariable(name).assign(value);
+ }
+
+ /**
* @return true if the current context is the global one
*/
public boolean isGlobalContext()
{
- return (currentContext.getParent() == null);
+ return (localContext.getParent() == null);
}
/**
*
* @return
*/
- public Context getCurrentContext()
+ public Context getLocalContext()
{
- return currentContext;
+ return localContext;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:01:00
|
Revision: 616
http://mathlib.svn.sourceforge.net/mathlib/?rev=616&view=rev
Author: st_mueller
Date: 2009-01-05 15:00:55 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-05 15:00:37 UTC (rev 615)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/GlobalValues.java 2009-01-05 15:00:55 UTC (rev 616)
@@ -8,6 +8,7 @@
import java.text.NumberFormat;
import jmathlib.core.interpreter.Interpreter;
+import jmathlib.core.tokens.OperandToken;
/**This class contains the global variables, which are accessible throughout the program.
These include
@@ -70,9 +71,9 @@
}
/**@return the current variable list*/
- protected VariableList getVariables()
+ protected VariableList getLocalVariables()
{
- return contextList.getVariables();
+ return contextList.getLocalVariables();
}
/**@return the global variable list*/
@@ -81,12 +82,24 @@
return contextList.getGlobalVariables();
}
- /**@return the global variable list*/
+ /**@return the a variable from local or global workspace*/
protected Variable getVariable(String name)
{
return contextList.getVariable(name);
}
+ /** create a variable in the local or global workspace*/
+ protected Variable createVariable(String name)
+ {
+ return contextList.createVariable(name);
+ }
+
+ /** create a variable in the local or global workspace*/
+ protected void setVariable(String name, OperandToken value)
+ {
+ contextList.setVariable(name, value);
+ }
+
/**Change the current context to point to the new Variable List
@param _Variables = the new list of Variables to use*/
protected void createContext(VariableList _variables)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 15:00:51
|
Revision: 615
http://mathlib.svn.sourceforge.net/mathlib/?rev=615&view=rev
Author: st_mueller
Date: 2009-01-05 15:00:37 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
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-05 14:57:06 UTC (rev 614)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/RootObject.java 2009-01-05 15:00:37 UTC (rev 615)
@@ -43,60 +43,73 @@
}
}
- /**Set the constant values to a sub class of the GlobalValues class
- @param _runnginStandalone = true if this is an application
- @param _interpreter = the interpreter object
- @param _globals = the store of global values*/
- //protected final void setConstants(boolean _runningStandalone, Interpreter _interpreter, GlobalValues _globals)
- //{
- // if(globals == null)
- // {
- // globals = _globals;
- // }
- //}
-
- /**@return the current variable list*/
- protected final VariableList getVariables()
+ /**
+ * @return the current variable list
+ */
+ protected final VariableList getLocalVariables()
{
- return globals.getVariables();
+ return globals.getLocalVariables();
}
- /**@return the global variable list*/
+ /**
+ * @return the global variable list
+ */
protected final VariableList getGlobalVariables()
{
return globals.getGlobalVariables();
}
- /**@return the global variable list*/
+ /**
+ * @param
+ * @return the variable from local or global workspace
+ */
protected final Variable getVariable(String name)
{
return globals.getVariable(name);
}
- /**Allow access to the context list*/
+ /** 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*/
+ /**
+ * @return the interpreter object
+ */
protected final Interpreter getInterpreter()
{
return globals.getInterpreter();
}
- /**@return the function manager*/
+ /**
+ * @return the function manager
+ */
public final FunctionManager getFunctionManager()
{
return globals.getFunctionManager();
}
- /**@return the CastClassLoader*/
- //protected final MathLib.Casts.CastClassLoader getCastClassLoader()
- //{
- // return globals.getCastClassLoader();
- //}
-
/**@return handle to plugins manager*/
protected jmathlib.plugins.PluginsManager getPluginsManager()
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 14:57:10
|
Revision: 614
http://mathlib.svn.sourceforge.net/mathlib/?rev=614&view=rev
Author: st_mueller
Date: 2009-01-05 14:57:06 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java
Modified: JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java 2009-01-05 13:07:14 UTC (rev 613)
+++ JMathLib/trunk/src/jmathlib/core/interpreter/Interpreter.java 2009-01-05 14:57:06 UTC (rev 614)
@@ -121,7 +121,7 @@
ErrorLogger.debugLine(answer);
// save last error to special variable
- Variable var = getVariables().createVariable("lasterror");
+ Variable var = createVariable("lasterror");
var.assign(new CharToken(answer));
// rethrow erros if enabled
@@ -140,7 +140,7 @@
}
// save last error to special variable
- Variable var = getVariables().createVariable("lasterror");
+ Variable var = createVariable("lasterror");
var.assign(new CharToken(answer));
}
@@ -287,32 +287,39 @@
return l.getValues();
}
- /** store a scalar variable in mathlib's workspace
+ /** store a scalar variable in jmathlib's workspace
* @param name = name of the scalar
* @param valueRe = real value of the scalar
* @param valueIM = imaginary value of the scalar
*/
public void setScalar(String name, double valueRe, double valueIm)
{
- Variable answervar = getVariables().createVariable(name);
+ // Create variable. In case variable is already created it will
+ // return the current variable
+ Variable answervar = createVariable(name);
+ // assign value to variable
answervar.assign(new DoubleNumberToken(valueRe, valueIm));
}
- /** store an array variable in mathlib's workspace
- @param name = name of the array
- @param valueRe = real values of the array
- @param valueIM = imaginary values of the array
+ /** Store an array variable in jmathlib's workspace
+ * @param name = name of the array
+ * @param valueRe = real values of the array
+ * @param valueIM = imaginary values of the array
*/
public void setArray(String name, double[][] valueRe, double[][] valueIm)
{
- Variable answervar = getVariables().createVariable(name);
+ // Create variable. In case variable is already created it will
+ // return the current variable
+ Variable answervar = createVariable(name);
+ // assign value to variable
answervar.assign(new DoubleNumberToken(valueRe, valueIm));
}
- /**return the result of the last calculation
- @return a string containing the last result*/
+ /** Return the result of the last calculation
+ * @return a string containing the last result
+ */
public String getResult()
{
// get variable from variable list
@@ -325,8 +332,9 @@
return variableData.toString();
}
- /**return the result of the last calculation
- @return a string containing the last result*/
+ /** Return the result of the last calculation
+ * @return a string containing the last result
+ */
public String getString(String name)
{
// get variable from variable list
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 13:07:17
|
Revision: 613
http://mathlib.svn.sourceforge.net/mathlib/?rev=613&view=rev
Author: st_mueller
Date: 2009-01-05 13:07:14 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/matrix/testChol.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/matrix/testChol.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/matrix/testChol.java 2009-01-05 13:06:34 UTC (rev 612)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/jmathlib/matrix/testChol.java 2009-01-05 13:07:14 UTC (rev 613)
@@ -1,6 +1,7 @@
package jmathlibtests.toolbox.jmathlib.matrix;
import jmathlib.core.interpreter.Interpreter;
+import jmathlib.core.interpreter.*;
import jmathlib.tools.junit.framework.*;
import jmathlibtests.Compare;
@@ -34,11 +35,22 @@
assertTrue(ml.getScalarValueBoolean("aaa"));
}
public void testNot03() {
- double[][] a = {{1.0, 2.0, 3.0},{-1.0, 0.0, 0.0},{11.23, -1.5, 0.0}};
- boolean[][] b = {{false, false, false},{ false, true, true},{ false,false, true}};
+ ErrorLogger.debugLine("fffffaa a00= "+ml.getArrayValueRe("a")[0][0]);
+ double[][] a = {{111.0, 2.0, 3.0},{-1.0, 0.0, 0.0},{11.23, -1.5, 0.0}};
+ boolean[][] b = {{false, false, false},{ false, true, true},{ false, false, true}};
ml.setArray("a", a, null);
- ml.executeExpression("setdebug(1)");
+ ErrorLogger.debugLine("fffffaa a00= "+ml.getArrayValueRe("a")[0][0]);
+
+ //ml.executeExpression("setdebug(1)");
+ //ml.executeExpression("a");
ml.executeExpression("who, z = not(a)");
+ double[][] v = ml.getArrayValueRe("a");
+ boolean[][] vv = ml.getArrayValueBoolean("z");
+ for (int y=0; y<v.length; y++)
+ for (int x=0; x<v[0].length; x++ )
+ ErrorLogger.debugLine("v = "+y+" "+x+" "+vv[y][x]+" "+v[y][x]);
+
+ ErrorLogger.debugLine("fffffaa");
assertTrue(Compare.ArrayEquals(b, ml.getArrayValueBoolean("z")));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-05 13:06:47
|
Revision: 612
http://mathlib.svn.sourceforge.net/mathlib/?rev=612&view=rev
Author: st_mueller
Date: 2009-01-05 13:06:34 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
changed handling of global variables
Modified Paths:
--------------
JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
Modified: JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java
===================================================================
--- JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-05 13:06:15 UTC (rev 611)
+++ JMathLib/trunk/src/jmathlibtests/toolbox/general/testGlobal.java 2009-01-05 13:06:34 UTC (rev 612)
@@ -60,11 +60,12 @@
Function doit = null;
//Expected an exception here
try {
- doit = funcParser.parseFunction(b.toString());
- } catch (MathLibException ex) {
+ doit = funcParser.parseFunction(b.toString());
+ doit.evaluate(null);
+ }
+ catch (MathLibException ex) {
exCaught = true;
}
- assertNull(doit);
assertTrue(exCaught);
}
@@ -89,7 +90,43 @@
b.append("doit;\n");
ml.executeExpression(b.toString());
double val = ml.getScalarValueRe("a");
- assertTrue(4 == val);
+ assertTrue(4 == val);
}
+ public void testGlobal10() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("global asdf");
+ ml.executeExpression("asdf = 5");
+ assertTrue(5.0 == ml.getScalarValueRe("asdf"));
+ }
+
+ public void testGlobal11() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("asdf = 55");
+ ml.executeExpression("global asdf");
+ assertTrue(55.0 == ml.getScalarValueRe("asdf"));
+ }
+
+ public void testGlobal100() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("helloGlobal = 11.0");
+ ml.executeExpression("testGlobal001(8)");
+ assertTrue(11.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("testGlobal001(77)");
+ assertTrue(11.0 == ml.getScalarValueRe("helloGlobal"));
+ }
+
+ public void testGlobal101() {
+ ml.executeExpression("clear('all');");
+ ml.executeExpression("global helloGlobal;");
+ ml.executeExpression("helloGlobal = 11.0");
+ assertTrue(11.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("testGlobal001(88)");
+ assertTrue(88.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("helloGlobal = 99.0");
+ assertTrue(99.0 == ml.getScalarValueRe("helloGlobal"));
+ ml.executeExpression("testGlobal001(88)");
+ assertTrue(88.0 == ml.getScalarValueRe("helloGlobal"));
+ }
+
}
\ 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-05 13:06:25
|
Revision: 611
http://mathlib.svn.sourceforge.net/mathlib/?rev=611&view=rev
Author: st_mueller
Date: 2009-01-05 13:06:15 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
test function for "global"
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/test/testGlobal001.m
Added: JMathLib/trunk/src/jmathlib/toolbox/test/testGlobal001.m
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/test/testGlobal001.m (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/test/testGlobal001.m 2009-01-05 13:06:15 UTC (rev 611)
@@ -0,0 +1,6 @@
+function testGlobal001(val)
+
+whos()
+global helloGlobal
+helloGlobal = val;
+whos()
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|