[Mathlib-commitlog] SF.net SVN: mathlib:[718] JMathLib/trunk/src/jmathlib/toolbox/general
Status: Beta
Brought to you by:
st_mueller
|
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.
|