|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfable.python.jep.FableJep
public class FableJep
Wrapper for Java embedded Python (Jep) to create and return a Jep interpreter.
Constructor Summary | |
---|---|
FableJep()
|
|
FableJep(boolean requireErrorMessage)
|
Method Summary | |
---|---|
void |
close()
Close Jep. |
boolean |
eval(java.lang.String str)
|
void |
flushStdout()
Flush sys.stdout |
java.lang.Boolean |
getBooleanValue(java.lang.String str)
Return the value as a Boolean using Jep. |
static FableJep |
getFableJep()
Call this if you want to have this instance only |
java.lang.Float |
getFloatValue(java.lang.String str)
Cast a variable in Python to float and return the value as a Float using Jep. |
java.lang.Integer |
getIntegerValue(java.lang.String str)
Cast a variable in python to int and return the value as an Integer using Jep. |
jep.Jep |
getJep()
|
static java.lang.String |
getPythonPath()
|
java.lang.String |
getStringValue(java.lang.String str)
Return the value as a String using Jep. |
float[] |
getValue_floatarray(java.lang.String str)
Return a float array from Python using Jep. |
java.lang.Object |
getValue(java.lang.String str)
Return a python variable as a Java Object type using Jep. |
boolean |
isRequireErrorMessage()
|
static void |
jepImportModules(jep.Jep _jep,
java.lang.String _modules)
|
static void |
jepImportModules(jep.Jep _jep,
java.lang.String _modules,
boolean requireErrorMessage)
Import a module for the jep instance. |
static void |
jepImportSpecificDefinition(jep.Jep _jep,
java.lang.String _from,
java.lang.String _import)
|
static void |
jepImportSpecificDefinition(jep.Jep _jep,
java.lang.String _from,
java.lang.String _import,
boolean requireMessage)
Import a specific definition into the current namespace, ie "from ImageD11 import peaksearcher" and add the module path to sys.path. |
static void |
jepSetPythonPath(jep.Jep jep)
Prepend the pythonPath to sys.path. |
void |
outputConsole(FableMessageConsole console)
|
static void |
record(boolean b)
|
void |
redirectStderr(java.lang.String filename)
Redirect stdout in a python program to a file. |
void |
redirectStdout(java.lang.String filename)
Redirect stdout in a python program to a file. |
static java.lang.String |
replaceEscapeSequences(java.lang.String input)
Replaces escape sequences in the given string with a \ plus the escape sequence character. |
void |
set(java.lang.String str1,
double dbl)
|
void |
set(java.lang.String str,
float f1)
|
void |
set(java.lang.String str1,
int str2)
|
void |
set(java.lang.String str1,
java.lang.String str2)
|
static void |
setPythonPath(java.lang.String pythonPath)
|
void |
setRequireErrorMessage(boolean requireErrorMessage)
|
static void |
setScriptFileName(java.lang.String name)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FableJep() throws java.lang.Throwable
jep.JepException
java.lang.Throwable
public FableJep(boolean requireErrorMessage) throws java.lang.Throwable
jep.JepException
java.lang.Throwable
Method Detail |
---|
public jep.Jep getJep()
public static FableJep getFableJep() throws java.lang.Throwable
jep.JepException
java.lang.Throwable
public static void jepSetPythonPath(jep.Jep jep) throws jep.JepException
jep.JepException
public static void jepImportModules(jep.Jep _jep, java.lang.String _modules) throws jep.JepException
jep.JepException
public static void jepImportModules(jep.Jep _jep, java.lang.String _modules, boolean requireErrorMessage) throws jep.JepException
_jep
- _modules
-
jep.JepException
jep.JepException
public static void jepImportSpecificDefinition(jep.Jep _jep, java.lang.String _from, java.lang.String _import) throws jep.JepException
jep.JepException
public static void jepImportSpecificDefinition(jep.Jep _jep, java.lang.String _from, java.lang.String _import, boolean requireMessage) throws jep.JepException
_jep
- The jep instance._from
- The module to import._import
- The specific definition to import.
jep.JepException
public boolean eval(java.lang.String str) throws jep.JepException
jep.JepException
public void set(java.lang.String str1, java.lang.String str2) throws jep.JepException
jep.JepException
public void set(java.lang.String str1, double dbl) throws jep.JepException
jep.JepException
public void set(java.lang.String str1, int str2) throws jep.JepException
jep.JepException
public void set(java.lang.String str, float f1) throws jep.JepException
jep.JepException
public java.lang.Object getValue(java.lang.String str) throws jep.JepException
Be careful this methods returns any of the following Java types e.g. Float, Integer or String, depending on the Python variable. This can cause problems at run time.
str
- The name of python variable e.g. "a".
jep.JepException
public java.lang.Boolean getBooleanValue(java.lang.String str)
str
- The name of the Python variable e.g. "a".
jep.JepException
public java.lang.Integer getIntegerValue(java.lang.String str)
str
- The name of the Python variable e.g. "a".
public java.lang.Float getFloatValue(java.lang.String str)
str
- The name of the Python variable e.g. "a".
jep.JepException
public java.lang.String getStringValue(java.lang.String str)
str
- The name of the Python variable e.g. "a".
jep.JepException
public float[] getValue_floatarray(java.lang.String str) throws jep.JepException
str
- The name of the Python float array.
jep.JepException
public void redirectStdout(java.lang.String filename) throws jep.JepException
jep.JepException
public void redirectStderr(java.lang.String filename) throws jep.JepException
jep.JepException
public void flushStdout() throws jep.JepException
jep.JepException
public void outputConsole(FableMessageConsole console)
public static void record(boolean b)
public static void setScriptFileName(java.lang.String name)
public void close()
public static java.lang.String getPythonPath()
public static void setPythonPath(java.lang.String pythonPath)
pythonpath
- the pythonpath to setpublic static java.lang.String replaceEscapeSequences(java.lang.String input)
input
-
public boolean isRequireErrorMessage()
public void setRequireErrorMessage(boolean requireErrorMessage)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |