Updated RulesManager
This commit is contained in:
parent
4a53bb68b4
commit
e49bb8ff62
@ -6,7 +6,7 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.warp.picalculator.math.rules;
|
package org.warp.picalculator.math.rules;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
@ -10,7 +12,7 @@ import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
|
|||||||
* @author Andrea Cavalli
|
* @author Andrea Cavalli
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface Rule {
|
public interface Rule extends Serializable {
|
||||||
/**
|
/**
|
||||||
* Get rule name
|
* Get rule name
|
||||||
* @return
|
* @return
|
||||||
|
@ -109,21 +109,21 @@ public class RulesManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!loadedFromCache) {
|
if (!loadedFromCache) {
|
||||||
Rule r;
|
Rule r = null;
|
||||||
try {
|
try {
|
||||||
r = compileJavaRule(scriptFile);
|
r = compileJavaRule(scriptFile);
|
||||||
RulesManager.addRule(r);
|
RulesManager.addRule(r);
|
||||||
|
|
||||||
|
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(r);
|
||||||
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user