[Mathlib-commitlog] SF.net SVN: mathlib:[697] JMathLib/trunk/src/jmathlib/toolbox
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2009-01-20 20:12:53
|
Revision: 697
http://mathlib.svn.sourceforge.net/mathlib/?rev=697&view=rev
Author: st_mueller
Date: 2009-01-20 20:12:50 +0000 (Tue, 20 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/time/date.java
JMathLib/trunk/src/jmathlib/toolbox/time/pause.java
JMathLib/trunk/src/jmathlib/toolbox/time/tic.java
JMathLib/trunk/src/jmathlib/toolbox/time/time.java
JMathLib/trunk/src/jmathlib/toolbox/time/toc.java
JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/time/date.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/time/date.java 2009-01-20 20:08:20 UTC (rev 696)
+++ JMathLib/trunk/src/jmathlib/toolbox/time/date.java 2009-01-20 20:12:50 UTC (rev 697)
@@ -1,14 +1,14 @@
package jmathlib.toolbox.time;
-/* This file is part or MATHLIB */
+/* This file is part or JMATHLIB */
import jmathlib.core.tokens.*;
import java.util.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/*
-
-Author: Stefan Mueller (st...@he...) 2002
+author: Stefan Mueller (st...@he...) 2002
*/
@@ -17,7 +17,7 @@
{
/**returns a string
* @return the current date as a string */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Calendar date = Calendar.getInstance();
Modified: JMathLib/trunk/src/jmathlib/toolbox/time/pause.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/time/pause.java 2009-01-20 20:08:20 UTC (rev 696)
+++ JMathLib/trunk/src/jmathlib/toolbox/time/pause.java 2009-01-20 20:12:50 UTC (rev 697)
@@ -5,16 +5,17 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/*
-Author: Stefan Mueller (st...@he...) 2003
+author: Stefan Mueller (st...@he...) 2003
*/
/**wait for a specified period of time*/
public class pause extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) != 1)
Modified: JMathLib/trunk/src/jmathlib/toolbox/time/tic.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/time/tic.java 2009-01-20 20:08:20 UTC (rev 696)
+++ JMathLib/trunk/src/jmathlib/toolbox/time/tic.java 2009-01-20 20:12:50 UTC (rev 697)
@@ -1,30 +1,29 @@
package jmathlib.toolbox.time;
-/* This file is part or MATHLIB */
+/* This file is part or JMathLib *
+author: Stefan Mueller (st...@he...) 2002
+*/
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.interpreter.*;
import jmathlib.core.functions.ExternalFunction;
-import jmathlib.toolbox.general.global;
import java.util.*;
-/*
-Author: Stefan Mueller (st...@he...) 2002
-*/
+
/**An external function for starting the internal stop watch */
public class tic extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Date d = new Date();
double start = (double)d.getTime();
- Variable ticVar = getGlobalVariables().createVariable("_tic");
+ Variable ticVar = globals.getGlobalVariables().createVariable("_tic");
ticVar.assign(new DoubleNumberToken(start));
return null; //DoubleNumberToken.one;
Modified: JMathLib/trunk/src/jmathlib/toolbox/time/time.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/time/time.java 2009-01-20 20:08:20 UTC (rev 696)
+++ JMathLib/trunk/src/jmathlib/toolbox/time/time.java 2009-01-20 20:12:50 UTC (rev 697)
@@ -1,23 +1,21 @@
package jmathlib.toolbox.time;
-/* This file is part or MATHLIB */
+/* This file is part or JMathLib
+author: Stefan Mueller (st...@he...) 2002
+*/
+
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.util.*;
-
-/*
-
-Author: Stefan Mueller (st...@he...) 2002
-*/
-
-
/**An external function for computing a mesh of a matrix */
public class time extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Date d = new Date();
Modified: JMathLib/trunk/src/jmathlib/toolbox/time/toc.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/time/toc.java 2009-01-20 20:08:20 UTC (rev 696)
+++ JMathLib/trunk/src/jmathlib/toolbox/time/toc.java 2009-01-20 20:12:50 UTC (rev 697)
@@ -1,34 +1,34 @@
package jmathlib.toolbox.time;
-/* This file is part or MATHLIB */
+/* This file is part or JMathLib
+author: Stefan Mueller (st...@he...) 2002
+*/
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.util.*;
-/*
-Author: Stefan Mueller (st...@he...) 2002
-*/
-
/**An external function for computing the time difference between a
call to tic() and toc() (internal stop watch) */
public class toc extends ExternalFunction
{
/**returns a time difference
* @return the time difference in seconds as a double number */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Date d = new Date();
double stop = (double)d.getTime();
- if (!getGlobalVariables().isVariable("_tic"))
+ if (!globals.getGlobalVariables().isVariable("_tic"))
throwMathLibException("toc: you must call tic before toc");
- OperandToken ticTok = getGlobalVariables().getVariable("_tic").getData();
+ OperandToken ticTok = globals.getGlobalVariables().getVariable("_tic").getData();
if (ticTok instanceof DoubleNumberToken)
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java 2009-01-20 20:08:20 UTC (rev 696)
+++ JMathLib/trunk/src/jmathlib/toolbox/toolbox_skeleton/template.java 2009-01-20 20:12:50 UTC (rev 697)
@@ -1,12 +1,13 @@
package jmathlib.toolbox.toolbox_skeleton;
/* This file is part or JMathLib
- * author: stefan 2009
+ * author: stefan (st...@he...) 2009
* */
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 */
@@ -16,7 +17,7 @@
* @param operands[0] = x values (e.g. [-2:0.2:2])
* @param operands[1] = y values (e.g. [-2:0.2:2])
* @return [X,Y] as matrices */
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// one operand (e.g. [x,y]=template([-2:0.2:2],[-2:0.2:2]) )
@@ -72,10 +73,11 @@
Returns the sign of value.
@EXAMPLES
<programlisting>
-SIGN(-10)=-1
-SIGN(10)=1
+sign(-10)=-1
+sign(10)=1
</programlisting>
@NOTES
+This functions is used as a template for developing toolbox functions.
@SEE
template
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|