|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fraid.Scripting
public class Scripting
This is Fraid's scripting interface. You can use it from Java, Jython, BeanShell, Groovy, etc.
This is the easyest way to use FrAid programmatically from your Java or Java scripting environment. For efficiency direct calls to the
internal functions may be better though. Use like this:
org.fraid.Scripting s = new org.fraid.Scripting();
s.exec("plot('sin(x));");
| Field Summary | |
|---|---|
protected Fraid |
mInterpreter
The local interpreter instance (you don't allocate a new one each time you need one). |
| Constructor Summary | |
|---|---|
Scripting()
|
|
| Method Summary | |
|---|---|
DefinedFunction |
def_f(java.lang.String aScript)
Define a FrAid function. |
Complex |
exec(java.lang.String aScript)
Execute a FrAid script. |
static ComplexFunction |
get_f(java.lang.String aFunctionName)
Get the function with name aFunctionName and aNumberOfArguments number of arguments. |
Fraid |
getInterpreter()
Get the interpreter. |
SymbolTable |
getSymbTable()
In case you need it directly. |
static java.util.ArrayList<java.lang.String> |
query_f(java.lang.String aFunctionNameLike)
Query the symbol table for functions whose name starts with aFunctionNameLike. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Fraid mInterpreter
| Constructor Detail |
|---|
public Scripting()
| Method Detail |
|---|
public Fraid getInterpreter()
Fraid value
public Complex exec(java.lang.String aScript)
throws ParseException
aScript - a String value
Complex value
ParseException - if an error occurs
public DefinedFunction def_f(java.lang.String aScript)
throws ParseException
org.fraid.Scripting.def_f("f(x)=sin(x)^cos(x);g(x)=f(f(x));"); will register both
f(x) and g(x) in the symbol table but will return only a reference to g(x).
aScript - a String value
DefinedFunction value
ParseException - if an error occursexec
public static ComplexFunction get_f(java.lang.String aFunctionName)
throws SymbTableException
aFunctionName - a String valueaNumberOfArguments - an int value
ComplexFunction value
SymbTableException - if an error occurs
public static java.util.ArrayList<java.lang.String> query_f(java.lang.String aFunctionNameLike)
throws SymbTableException
SymbTableExceptionget_f
public SymbolTable getSymbTable()
throws SymbTableException
SymbTable value
SymbTableException - if an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||