Last active
November 16, 2017 16:38
-
-
Save miho/b0b6c4c0e082173f7a2df38965bfff91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package eu.mihosoft.vrl.user; | |
@ComponentInfo(name="MatrixInput", category="ODE") | |
public class MatrixInput implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private transient Script script; | |
@MethodInfo(name="", valueName="Matrix", valueStyle="default", valueOptions="serialization=false", hide=false) | |
public double[][] matrix( | |
@ParamInfo(name="<html><b>Matrix m</b></hmtl>", style="code", options="") String expression) { | |
GroovyShell shell = new GroovyShell(); | |
script = shell.parse("import static java.lang.Math.*;" | |
+ "import eu.mihosoft.vrl.types.*;" | |
+ "m = [];" | |
+ expression); | |
script.run() | |
return script.getProperty("m") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment