org.drools.semantics.python
Class Interp

java.lang.Object
  extended byorg.drools.semantics.python.Interp
Direct Known Subclasses:
Eval, Exec

public class Interp
extends Object

Base class for Jython interpreter-based Python semantic components.

Author:
bob mcwhirter
See Also:
Eval, Exec

Constructor Summary
protected Interp(String text, Rule rule, String type)
          Construct.
 
Method Summary
protected  org.python.core.PyCode getCode()
          Retrieve the compiled code.
protected  org.python.core.PyDictionary getGlobals()
           
 org.python.core.PyDictionary getGlobals(String text)
          Parses a python script and returns the globals It is used to be able to inject imports and functions into code when being executed by Py.runCode(...)
protected  org.python.parser.ast.modType getNode()
          Retrieve the AST node.
protected  Rule getRule()
           
 String getText()
          Retrieve the text to evaluate.
protected  org.python.core.PyDictionary setUpDictionary(Tuple tuple)
          Configure a PyDictionary using a Tuple for variable bindings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Interp

protected Interp(String text,
                 Rule rule,
                 String type)
Construct.

Method Detail

getGlobals

public org.python.core.PyDictionary getGlobals(String text)
Parses a python script and returns the globals It is used to be able to inject imports and functions into code when being executed by Py.runCode(...)

Parameters:
text -
Returns:
PyDictionary globals

getText

public String getText()
Retrieve the text to evaluate.

Returns:
The text to evaluate.

getRule

protected Rule getRule()

getCode

protected org.python.core.PyCode getCode()
Retrieve the compiled code.

Returns:
The code.

getNode

protected org.python.parser.ast.modType getNode()
Retrieve the AST node.

Returns:
The node.

getGlobals

protected org.python.core.PyDictionary getGlobals()

setUpDictionary

protected org.python.core.PyDictionary setUpDictionary(Tuple tuple)
                                                throws Exception
Configure a PyDictionary using a Tuple for variable bindings.

Parameters:
tuple - Tuple containing variable bindings.
Returns:
The dictionary
Throws:
Exception


Copyright © 2001-2004 The Codehaus. All Rights Reserved.