public class SimpleHook extends Object implements InterpreterHook
This hook does nothing, only calls the next in the hook chain. Classes
implementing hooks may use the pleasant feature of this hook that it
implements empty methods for each hook method of the interface. For example
the method beforeExecute calls the method beforeExecuteEx and
then it calls on the chain. A hook extending this class instead of
implementing the interface need not implement hook methods that are empty and
need not care about not to break the chain.
| Constructor and Description |
|---|
SimpleHook() |
| Modifier and Type | Method and Description |
|---|---|
Object |
afterCallJavaFunction(Method method,
Object result)
This method is called when the interpreter was calling a Java static
method.
|
Object |
afterCallJavaFunctionEx(Method method,
Object result) |
void |
afterExecute(Command command)
This method is called after the interpreter executed a command.
|
void |
afterExecuteEx(Command command) |
void |
afterPop(Command command) |
void |
afterPopEx(Command command) |
void |
afterPush(Command command) |
void |
afterPushEx(Command command) |
void |
beforeCallJavaFunction(Method method) |
void |
beforeCallJavaFunctionEx(Method method) |
void |
beforeExecute(Command command)
This method is called before the interpreter executes a command.
|
void |
beforeExecuteEx(Command command) |
void |
beforePop() |
void |
beforePopEx() |
void |
beforePush(Command command) |
void |
beforePushEx(Command command) |
void |
beforeRegisteringJavaMethod(String alias,
Class<?> klass,
String methodName,
Class<?>[] argumentTypes)
This method is called before registering a java method into the
interpreter.
|
void |
beforeRegisteringJavaMethodEx(String alias,
Class<?> klass,
String methodName,
Class<?>[] argumentTypes) |
void |
beforeSubroutineCall(String subroutineName,
LeftValueList arguments,
RightValue[] argumentValues)
This method is called before the interpreter invokes a subroutine.
|
void |
beforeSubroutineCallEx(String subroutineName,
LeftValueList arguments,
RightValue[] argumentValues) |
protected ExtendedInterpreter |
getInterpreter() |
void |
init()
This method is called at the end of the hook registering.
|
void |
initEx() |
void |
setInterpreter(ExtendedInterpreter interpreter)
During registration the interpreter calls this method to make the
interpreter accessible for the hook objects.
|
void |
setNext(InterpreterHook next)
When a hook is registered the registering process calls this method and
passes the next element in the hook chain.
|
void |
setReturnValue(RightValue returnValue)
This method is called after a subroutine has set its return value.
|
void |
setReturnValueEx(RightValue returnValue) |
RightValue |
variableRead(String variableName,
RightValue value)
This hook is called when the interpreter accesses a variable.
|
RightValue |
variableReadEx(String variableName,
RightValue value) |
protected ExtendedInterpreter getInterpreter()
public void setInterpreter(ExtendedInterpreter interpreter)
InterpreterHooksetInterpreter in interface InterpreterHookinterpreter - the interpreter to setpublic void setNext(InterpreterHook next)
InterpreterHooksetNext in interface InterpreterHooknext - the next element in the chain.public void beforeExecute(Command command)
InterpreterHookbeforeExecute in interface InterpreterHookcommand - the command object to be executedpublic void beforeExecuteEx(Command command)
command - public void afterExecute(Command command)
InterpreterHookafterExecute in interface InterpreterHookcommand - the command just executed.public void afterExecuteEx(Command command)
command - public void beforeRegisteringJavaMethod(String alias, Class<?> klass, String methodName, Class<?>[] argumentTypes)
InterpreterHookbeforeRegisteringJavaMethod in interface InterpreterHookalias - the name of the function as it will be known to the BASIC
program.klass - the Java class where the static method is.methodName - the Java name of the methodargumentTypes - the argument types of the methods. This, together with the
name of the method and the class identifies the actual method
that will be available to the BASIC programs to be called
through the name alias.public void beforeRegisteringJavaMethodEx(String alias, Class<?> klass, String methodName, Class<?>[] argumentTypes)
alias - klass - methodName - argumentTypes - public void beforePush(Command command)
beforePush in interface InterpreterHookpublic void beforePushEx(Command command)
command - public void afterPush(Command command)
afterPush in interface InterpreterHookpublic void afterPushEx(Command command)
command - public void beforePop()
beforePop in interface InterpreterHookpublic void beforePopEx()
public void afterPop(Command command)
afterPop in interface InterpreterHookpublic void afterPopEx(Command command)
command - public void setReturnValue(RightValue returnValue)
InterpreterHookExtendedInterpreter.disableHook() and ExtendedInterpreter.enableHook().setReturnValue in interface InterpreterHookExtendedInterpreter.disableHook()public void setReturnValueEx(RightValue returnValue)
returnValue - public void beforeSubroutineCall(String subroutineName, LeftValueList arguments, RightValue[] argumentValues)
InterpreterHookbeforeSubroutineCall in interface InterpreterHooksubroutineName - the symbolic name of the subroutinearguments - the argument left valuesargumentValues - the argument evaluated values that were assigned to the local
variable table to the argumentspublic void beforeSubroutineCallEx(String subroutineName, LeftValueList arguments, RightValue[] argumentValues)
subroutineName - arguments - argumentValues - public void beforeCallJavaFunction(Method method)
beforeCallJavaFunction in interface InterpreterHookpublic void beforeCallJavaFunctionEx(Method method)
method - public Object afterCallJavaFunction(Method method, Object result)
InterpreterHookafterCallJavaFunction in interface InterpreterHookmethod - the method that was calledresult - the result that the static method returnedpublic Object afterCallJavaFunctionEx(Method method, Object result)
method - public RightValue variableRead(String variableName, RightValue value)
InterpreterHookvariableRead in interface InterpreterHookvariableName - the name of the variablevalue - the value of the variable when accessedpublic RightValue variableReadEx(String variableName, RightValue value)
variableName - value - public void init()
InterpreterHookinit in interface InterpreterHookpublic void initEx()
Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.