pnuts.compiler
Class DynamicRuntime

java.lang.Object
  |
  +--pnuts.lang.Runtime
        |
        +--pnuts.compiler.DynamicRuntime
All Implemented Interfaces:
PnutsParserTreeConstants

public class DynamicRuntime
extends Runtime


Fields inherited from interface pnuts.lang.PnutsParserTreeConstants
JJTADDNODE, JJTANDNODE, JJTAPPLICATIONNODE, JJTARRAYTYPE, JJTASSIGNMENT, JJTASSIGNMENTAA, JJTASSIGNMENTDA, JJTASSIGNMENTEA, JJTASSIGNMENTLA, JJTASSIGNMENTMA, JJTASSIGNMENTOA, JJTASSIGNMENTPA, JJTASSIGNMENTRA, JJTASSIGNMENTRAA, JJTASSIGNMENTSA, JJTASSIGNMENTTA, JJTBLOCK, JJTBREAK, JJTCASTEXPRESSION, JJTCATCHNODE, JJTCHARACTERNODE, JJTCLASS, JJTCONTINUE, JJTDIVIDENODE, JJTELSEIFNODE, JJTELSENODE, JJTEQUALNODE, JJTEXPRESSIONLIST, JJTFALSENODE, JJTFLOATINGNODE, JJTFOREACHSTATEMENT, JJTFORINIT, JJTFORSTATEMENT, JJTFORUPDATE, JJTFUNCTIONSTATEMENT, JJTGENODE, JJTGLOBAL, JJTGTNODE, JJTIDNODE, JJTIFSTATEMENT, JJTINDEXNODE, JJTINSTANCEOFEXPRESSION, JJTINTEGERNODE, JJTLENODE, JJTLISTELEMENTS, JJTLOCAL, JJTLOGANDNODE, JJTLOGEXORNODE, JJTLOGNOTNODE, JJTLOGORNODE, JJTLTNODE, JJTMEMBERNODE, JJTMETHODNODE, JJTMODNODE, JJTMULTNODE, JJTNEGATIVENODE, jjtNodeName, JJTNOTEQNODE, JJTNOTNODE, JJTNULLNODE, JJTORNODE, JJTPACKAGE, JJTPARAM, JJTPARAMLIST, JJTPOSTDECRNODE, JJTPOSTINCRNODE, JJTPREDECRNODE, JJTPREINCRNODE, JJTRANGENODE, JJTRETURN, JJTSHIFTARITHMETICNODE, JJTSHIFTLEFTNODE, JJTSHIFTRIGHTNODE, JJTSTART, JJTSTARTSET, JJTSTATICMEMBERNODE, JJTSTATICMETHODNODE, JJTSTRINGNODE, JJTSUBTRACTNODE, JJTSWITCHBLOCK, JJTSWITCHLABEL, JJTSWITCHSTATEMENT, JJTTRUENODE, JJTVOID, JJTWHILESTATEMENT
 
Constructor Summary
DynamicRuntime()
           
 
Method Summary
static java.lang.Object callConstructor(java.lang.Class c, java.lang.Object[] args)
          Call a constructor
static java.lang.Object callConstructor(java.lang.Class c, java.lang.Object[] args, java.lang.Class[] types)
          Call a constructor
static java.lang.Object callConstructor(java.lang.Class c, java.lang.Object[] args, java.lang.Class[] types, pnuts.compiler.CodeLoader codeLoader)
           
static java.lang.Object callConstructor(Context context, java.lang.Class c, java.lang.Object[] args, java.lang.Class[] types)
          Call a constructor
static java.lang.Object callMethod(java.lang.Class c, java.lang.String name, java.lang.Object[] args, java.lang.Class[] types, java.lang.Object target)
          Call a method
static java.lang.Object callMethod(Context context, java.lang.Class c, java.lang.String name, java.lang.Object[] args, java.lang.Class[] types, java.lang.Object target)
          call a method
static PnutsFunction makeProxy(java.lang.reflect.Constructor cons)
          This method maps a proxy object of a Constructor to a PnutsFunction.
static PnutsFunction makeProxy(java.lang.reflect.Method method)
          This method maps a proxy object of a Method to a PnutsFunction.
static java.lang.Object newInstance(Context context, java.lang.Class clazz, java.lang.Object[] args, java.lang.Class[] casts)
          This method is called by the syntax "clazz(args...)"
 
Methods inherited from class pnuts.lang.Runtime
arrayType, assignRange, binary, call, callFunction, callMethod, cast, catchException, checkException, checkException, compareTo, escape, exec, execute, fileToURL, format, getBeginLine, getBottomType, getCompiledScript, getEndLine, getField, getFunction, getFunction, getFunctions, getIndex, getRuntime, getScriptSource, getScriptURL, getStaticField, isArray, jump, matchType, namespaceRefreshed, parseChar, parseFloat, parseInt, parseString, primitive, printError, putField, putStaticField, quantity, range, readSymbolTable, setLine, setLine, setPackage, transform, unary, writeSymbolTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicRuntime

public DynamicRuntime()
Method Detail

callMethod

public static java.lang.Object callMethod(Context context,
                                          java.lang.Class c,
                                          java.lang.String name,
                                          java.lang.Object[] args,
                                          java.lang.Class[] types,
                                          java.lang.Object target)
call a method
Following copied from class: pnuts.lang.Runtime
Parameters:
context - the context in which the method is called
c - the class of method
name - the method name
args - the paramters
types - the types of the paramters
target - the target object
Returns:
the return value of the call

callMethod

public static java.lang.Object callMethod(java.lang.Class c,
                                          java.lang.String name,
                                          java.lang.Object[] args,
                                          java.lang.Class[] types,
                                          java.lang.Object target)
                                   throws java.lang.IllegalAccessException,
                                          java.lang.IllegalArgumentException,
                                          java.lang.reflect.InvocationTargetException
Description copied from class: Runtime
Call a method
Following copied from class: pnuts.lang.Runtime
Parameters:
c - the class of method
name - the method name
args - the paramters
types - the types of the formal arguments
target - the target object
Returns:
the return value

newInstance

public static java.lang.Object newInstance(Context context,
                                           java.lang.Class clazz,
                                           java.lang.Object[] args,
                                           java.lang.Class[] casts)
Description copied from class: Runtime
This method is called by the syntax "clazz(args...)"

callConstructor

public static java.lang.Object callConstructor(Context context,
                                               java.lang.Class c,
                                               java.lang.Object[] args,
                                               java.lang.Class[] types)
Description copied from class: Runtime
Call a constructor
Following copied from class: pnuts.lang.Runtime
Parameters:
context - the context in which the constructor is called
c - the class of method
args - the paramters
types - the types of the formal arguments
Returns:
the created instance

callConstructor

public static java.lang.Object callConstructor(java.lang.Class c,
                                               java.lang.Object[] args)
                                        throws java.lang.IllegalAccessException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.reflect.InvocationTargetException,
                                               java.lang.InstantiationException
Call a constructor
Parameters:
c - the class of constructor
args - the paramters
Returns:
the created instance

callConstructor

public static java.lang.Object callConstructor(java.lang.Class c,
                                               java.lang.Object[] args,
                                               java.lang.Class[] types)
                                        throws java.lang.IllegalAccessException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.reflect.InvocationTargetException,
                                               java.lang.InstantiationException
Call a constructor
Parameters:
c - the class of constructor
args - the paramters
types - the types of the formal arguments
Returns:
the created instance

callConstructor

public static java.lang.Object callConstructor(java.lang.Class c,
                                               java.lang.Object[] args,
                                               java.lang.Class[] types,
                                               pnuts.compiler.CodeLoader codeLoader)
                                        throws java.lang.IllegalAccessException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.reflect.InvocationTargetException,
                                               java.lang.InstantiationException

makeProxy

public static PnutsFunction makeProxy(java.lang.reflect.Constructor cons)
This method maps a proxy object of a Constructor to a PnutsFunction. Call of the resulting function is faster than reflection API calls.
Parameters:
cons - a constructor
Returns:
an instance the constructor creates.

makeProxy

public static PnutsFunction makeProxy(java.lang.reflect.Method method)
This method maps a proxy object of a Method to a PnutsFunction. Call of the resulting function is expected to be faster than reflection API calls.
Parameters:
method - a method
Returns:
the result of the 'method' call.