Revision: 854
http://mathlib.svn.sourceforge.net/mathlib/?rev=854&view=rev
Author: st_mueller
Date: 2009-02-20 19:48:44 +0000 (Fri, 20 Feb 2009)
Log Message:
-----------
added new function
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/jmathlibcreateuniqueid.java
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/jmathlibcreateuniqueid.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/jmathlibcreateuniqueid.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/jmathlibcreateuniqueid.java 2009-02-20 19:48:44 UTC (rev 854)
@@ -0,0 +1,51 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import java.util.Date;
+import java.util.Random;
+
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
+
+public class jmathlibcreateuniqueid extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+
+ //throwMathLibException("jmathlibcreateuniqueid");
+
+
+ String uniqueIDS = globals.getProperty("jmathlib.id.unique");
+
+ if (uniqueIDS==null)
+ {
+
+ Date d = new Date();
+ double start = (double)d.getTime();
+ String startS = new Double(start).toString();
+
+ String randS = new Double(Math.random()).toString();
+
+ //System.out.println("RANDOM "+startS +" "+randS);
+
+ globals.setProperty("jmathlib.id.unique", startS+randS);
+ }
+
+ return null;
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+jmathlibcreateuniqueid
+@DOC
+create a unique id for jmathlib
+@NOTES
+@EXAMPLES
+@SEE
+update, checkforupdates
+*/
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|