nl.tudelft.simulation.dsol.interpreter
Class Interpreter

java.lang.Object
  extended by nl.tudelft.simulation.dsol.interpreter.Interpreter

public final class Interpreter
extends Object

The Java interpreter.

(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:12 $
Author:
Peter Jacobs

Field Summary
static FactoryInterface INTERPRETER_FACTORY
          the interpreter factory class name
 
Method Summary
static Frame aThrow(Operation operation, Frame frame, Stack frameStack)
          throws an exception
static Frame createFrame(Object object, AccessibleObject method, Object[] arguments)
          creates a frame for a method
static Object interpret(Stack frameStack)
          interprets the frameStack
static Object invoke(Object object, AccessibleObject method, Object[] arguments)
          interpretes the invocation of a method on an object
static Object invoke(Object object, String methodName, Object[] arguments, Class[] argumentTypes)
          interpretes the invocation of a method on an object
static void setFactory(FactoryInterface factory)
          sets the Interpreter factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERPRETER_FACTORY

public static FactoryInterface INTERPRETER_FACTORY
the interpreter factory class name

Method Detail

setFactory

public static void setFactory(FactoryInterface factory)
sets the Interpreter factory.

Parameters:
factory - the factory to use

createFrame

public static Frame createFrame(Object object,
                                AccessibleObject method,
                                Object[] arguments)
                         throws ClassNotFoundException,
                                IOException
creates a frame for a method

Parameters:
object - the object on which the method must be invoked
method - the method or constructor
arguments - the arguments
Returns:
Frame the result
Throws:
ClassNotFoundException - whenever the classpath is incomplete
IOException - on IOException

aThrow

public static Frame aThrow(Operation operation,
                           Frame frame,
                           Stack frameStack)
throws an exception

Parameters:
operation - the aThrow operation to invoke
frame - the frame to start with
frameStack - the framestack
Returns:
the frame and operationIndex to continue with...

interpret

public static Object interpret(Stack frameStack)
                        throws InterpreterException
interprets the frameStack

Parameters:
frameStack - the frameStack of the interpreter
Returns:
Object the return value of the invoked method
Throws:
InterpreterException - on failure

invoke

public static Object invoke(Object object,
                            String methodName,
                            Object[] arguments,
                            Class[] argumentTypes)
interpretes the invocation of a method on an object

Parameters:
object - the object on which the method must be invoked
methodName - the methodName
arguments - the arguments
argumentTypes - the classes of the arguments
Returns:
Object the result

invoke

public static Object invoke(Object object,
                            AccessibleObject method,
                            Object[] arguments)
                     throws InterpreterException
interpretes the invocation of a method on an object

Parameters:
object - the object on which the method must be invoked
method - the method
arguments - the arguments
Returns:
Object the result
Throws:
InterpreterException - on failure


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.