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)
InterpreterHook
setInterpreter
in interface InterpreterHook
interpreter
- the interpreter to setpublic void setNext(InterpreterHook next)
InterpreterHook
setNext
in interface InterpreterHook
next
- the next element in the chain.public void beforeExecute(Command command)
InterpreterHook
beforeExecute
in interface InterpreterHook
command
- the command object to be executedpublic void beforeExecuteEx(Command command)
command
- public void afterExecute(Command command)
InterpreterHook
afterExecute
in interface InterpreterHook
command
- the command just executed.public void afterExecuteEx(Command command)
command
- public void beforeRegisteringJavaMethod(String alias, Class<?> klass, String methodName, Class<?>[] argumentTypes)
InterpreterHook
beforeRegisteringJavaMethod
in interface InterpreterHook
alias
- 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 InterpreterHook
public void beforePushEx(Command command)
command
- public void afterPush(Command command)
afterPush
in interface InterpreterHook
public void afterPushEx(Command command)
command
- public void beforePop()
beforePop
in interface InterpreterHook
public void beforePopEx()
public void afterPop(Command command)
afterPop
in interface InterpreterHook
public void afterPopEx(Command command)
command
- public void setReturnValue(RightValue returnValue)
InterpreterHook
ExtendedInterpreter.disableHook()
and ExtendedInterpreter.enableHook()
.setReturnValue
in interface InterpreterHook
ExtendedInterpreter.disableHook()
public void setReturnValueEx(RightValue returnValue)
returnValue
- public void beforeSubroutineCall(String subroutineName, LeftValueList arguments, RightValue[] argumentValues)
InterpreterHook
beforeSubroutineCall
in interface InterpreterHook
subroutineName
- 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 InterpreterHook
public void beforeCallJavaFunctionEx(Method method)
method
- public Object afterCallJavaFunction(Method method, Object result)
InterpreterHook
afterCallJavaFunction
in interface InterpreterHook
method
- 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)
InterpreterHook
variableRead
in interface InterpreterHook
variableName
- the name of the variablevalue
- the value of the variable when accessedpublic RightValue variableReadEx(String variableName, RightValue value)
variableName
- value
- public void init()
InterpreterHook
init
in interface InterpreterHook
public void initEx()
Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.