Updated RulesManager
This commit is contained in:
parent
4a53bb68b4
commit
e49bb8ff62
@ -6,7 +6,7 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.warp.picalculator.math.Function;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
@ -10,7 +12,7 @@ import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
|
||||
* @author Andrea Cavalli
|
||||
*
|
||||
*/
|
||||
public interface Rule {
|
||||
public interface Rule extends Serializable {
|
||||
/**
|
||||
* Get rule name
|
||||
* @return
|
||||
|
@ -109,21 +109,21 @@ public class RulesManager {
|
||||
}
|
||||
}
|
||||
if (!loadedFromCache) {
|
||||
Rule r;
|
||||
Rule r = null;
|
||||
try {
|
||||
r = compileJavaRule(scriptFile);
|
||||
RulesManager.addRule(r);
|
||||
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Path p = Paths.get(compiledFile.replace("/", "_")).toAbsolutePath();
|
||||
System.out.println(p);
|
||||
p.toFile().createNewFile();
|
||||
OutputStream fout = Files.newOutputStream(p, StandardOpenOption.CREATE);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fout);
|
||||
oos.writeObject(script);
|
||||
oos.writeObject(r);
|
||||
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user