Thread: [Mathlib-commitlog] SF.net SVN: mathlib:[579] JMathLib/trunk/src/jmathlib/core/functions/ WebFuncti
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2008-12-29 20:58:15
|
Revision: 579
http://mathlib.svn.sourceforge.net/mathlib/?rev=579&view=rev
Author: st_mueller
Date: 2008-12-29 20:58:12 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
new structure/file for loading m-files/class-files from an applet
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java
Modified: JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java 2008-12-29 20:51:39 UTC (rev 578)
+++ JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java 2008-12-29 20:58:12 UTC (rev 579)
@@ -16,7 +16,7 @@
boolean pFileCachingEnabledB = false;
private URL codeBase;
private String directory;
- private Vector pathV = new Vector(30); // paths to external function for applet usage
+ private Vector functionListV = new Vector(30); // paths to external function for applet usage
/**Default constructor*/
@@ -36,7 +36,7 @@
while ((line = br.readLine()) != null) {
System.out.println("read =" + line);
if (!line.startsWith("#")) {
- pathV.addElement(line);
+ functionListV.addElement(line);
//functionLoaders.add(new MFileWebLoader(applet.getCodeBase(), line));
}
}
@@ -77,11 +77,11 @@
String functionPath = null;
// Search filelist for wanted function
- for (int i=0; i<pathV.size(); i++)
+ for (int i=0; i<functionListV.size(); i++)
{
// The searchstring is set to "/foo.class" to avoid matches
// of substring of some other function like "barfoo.class"
- functionPath = ((String)pathV.elementAt(i));
+ functionPath = ((String)functionListV.elementAt(i));
// !! Remark: the command toLowerCase() is necessary, because some filenames have upper case letters (e.g. Disp.class)
if ( functionPath.toLowerCase().endsWith("/"+functionName+".class") )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-01 12:37:17
|
Revision: 812
http://mathlib.svn.sourceforge.net/mathlib/?rev=812&view=rev
Author: st_mueller
Date: 2009-02-01 12:37:09 +0000 (Sun, 01 Feb 2009)
Log Message:
-----------
changed location of webfunctionslist.dat
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java
Modified: JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java 2009-01-31 20:09:04 UTC (rev 811)
+++ JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java 2009-02-01 12:37:09 UTC (rev 812)
@@ -6,63 +6,75 @@
import java.util.*;
-/**Class for storing and managing the m- and p-functions
- */
+/**Class for storing and managing the m- and p-functions */
public class WebFunctionLoader extends FunctionLoader
{
boolean pFileCachingEnabledB = false;
private URL codeBase;
private String directory;
- private Vector functionListV = new Vector(30); // paths to external function for applet usage
+
+ // paths to external function for applet usage
+ private Vector functionListV = new Vector(30);
/**Default constructor*/
public WebFunctionLoader(URL _codeBase, String _directory)
{
- codeBase = _codeBase;
+ codeBase = _codeBase;
directory = _directory;
- try {
+ try
+ {
System.out.println("WebFunctionLoader: new url"+ codeBase.toString());
- URL url = new URL(codeBase, "jmathlib/webFunctionsList.dat");
+ URL url = new URL(codeBase, "webFunctionsList.dat");
InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
// read each line of the functions list
String line = null;
- while ((line = br.readLine()) != null) {
+ while ((line = br.readLine()) != null)
+ {
System.out.println("read =" + line);
- if (!line.startsWith("#")) {
+ if (!line.startsWith("#"))
functionListV.addElement(line);
- //functionLoaders.add(new MFileWebLoader(applet.getCodeBase(), line));
- }
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex) {
//ErrorLogger.debugLine("FunctionManager: applet error");
ex.printStackTrace();
}
}
- public URL getCodeBase() {
- return codeBase;
+ /**
+ *
+ * @return
+ */
+ public URL getCodeBase()
+ {
+ return codeBase;
}
- public String getDirectory() {
- return directory;
+ /**
+ *
+ * @return
+ */
+ public String getDirectory()
+ {
+ return directory;
}
- /**loads an .m-file via the web
- @param directory = the directory containing the file
- @param mFileName = the name of the m file
- @return the result of the file as a FunktionToken*/
+ /**
+ * loads an .m-file via the web
+ * @param directory = the directory containing the file
+ * @param mFileName = the name of the m file
+ * @return the result of the file as a FunktionToken
+ */
public Function findFunction(String functionName)
{
//JMH TBD find functions on the classpath
-
-
String code = "";
UserFunction function = (UserFunction)getCachedFunction(functionName);
if (function != null)
@@ -178,8 +190,8 @@
}
- /** set caching of p-file to on of off
- *
+ /**
+ * set caching of p-file to on of off
* @param pFileCaching true= caching of p-files on; false: caching of p-files off
*/
public void setPFileCaching(boolean pFileCaching)
@@ -187,8 +199,8 @@
pFileCachingEnabledB = pFileCaching;
}
- /** return whether of not caching of p-files is enabled of not
- *
+ /**
+ * return whether of not caching of p-files is enabled of not
* @return status of caching p-files
*/
public boolean getPFileCaching()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-08 17:48:07
|
Revision: 837
http://mathlib.svn.sourceforge.net/mathlib/?rev=837&view=rev
Author: st_mueller
Date: 2009-02-08 17:47:57 +0000 (Sun, 08 Feb 2009)
Log Message:
-----------
removed applet-parameter from Interpreter-constructor
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java
Modified: JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java
===================================================================
--- JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java 2009-02-08 17:11:10 UTC (rev 836)
+++ JMathLib/trunk/src/jmathlib/core/functions/WebFunctionLoader.java 2009-02-08 17:47:57 UTC (rev 837)
@@ -11,24 +11,25 @@
{
boolean pFileCachingEnabledB = false;
- private URL codeBase;
+
private String directory;
// paths to external function for applet usage
private Vector functionListV = new Vector(30);
-
/**Default constructor*/
- public WebFunctionLoader(URL _codeBase, String _directory)
+ public WebFunctionLoader()
{
- codeBase = _codeBase;
- directory = _directory;
try
{
- System.out.println("WebFunctionLoader: new url"+ codeBase.toString());
- URL url = new URL(codeBase, "webFunctionsList.dat");
- InputStream in = url.openStream();
+ //if (codeBase!=null)
+ // System.out.println("WebFunctionLoader: new url"+ codeBase.toString());
+ //URL url = new URL(codeBase, "webFunctionsList.dat");
+ //InputStream in = url.openStream();
+
+ // load list relative to the path of THIS class.
+ InputStream in = WebFunctionLoader.class.getResourceAsStream("../../../webFunctionsList.dat");
BufferedReader br = new BufferedReader(new InputStreamReader(in));
// read each line of the functions list
@@ -51,10 +52,10 @@
*
* @return
*/
- public URL getCodeBase()
- {
- return codeBase;
- }
+ //public URL getCodeBase()
+ //{
+ // return codeBase;
+ //}
/**
*
@@ -146,12 +147,16 @@
// open file and read m-file line by line
try
{
- ErrorLogger.debugLine("WebFunctionLoader: "+codeBase+" "+directory+"/"+functionName+".m");
+ ErrorLogger.debugLine("WebFunctionLoader: "+directory+"/"+functionName+".m");
+ //ErrorLogger.debugLine("WebFunctionLoader: "+codeBase+" "+directory+"/"+functionName+".m");
//URL url = new URL(codeBase, directory+"/"+functionName+".m");
- URL url = new URL(codeBase, functionPath);
+ //URL url = new URL(codeBase, functionPath);
+ //InputStream in = url.openStream();
- InputStream in = url.openStream();
+ // load class or resource relative to the path of THIS class.
+ InputStream in = WebFunctionLoader.class.getResourceAsStream("../../../"+functionPath);
BufferedReader inReader = new BufferedReader(new InputStreamReader(in));
+
String line;
while ((line = inReader.readLine()) != null)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|