gnu.expr

Class ModuleMethod

public class ModuleMethod extends MethodProc

Call a specified method in in a ModuleBody. We use an extra level of indirection, but we save by having to create fewer classes than in the one-class-per-procedure scheme, without having to use (slow) reflection.
Field Summary
ModuleBodymodule
protected intnumArgs
intselector
Constructor Summary
ModuleMethod(ModuleBody module, int selector, Object name, int numArgs)
ModuleMethod(ModuleBody module, int selector, Object name, int numArgs, Object argTypes)
Method Summary
voidapply(CallContext ctx)
Objectapply0()
static Objectapply0Default(ModuleMethod method)
Objectapply1(Object arg1)
static Objectapply1Default(ModuleMethod method, Object arg1)
Objectapply2(Object arg1, Object arg2)
static Objectapply2Default(ModuleMethod method, Object arg1, Object arg2)
Objectapply3(Object arg1, Object arg2, Object arg3)
static Objectapply3Default(ModuleMethod method, Object arg1, Object arg2, Object arg3)
Objectapply4(Object arg1, Object arg2, Object arg3, Object arg4)
static Objectapply4Default(ModuleMethod method, Object arg1, Object arg2, Object arg3, Object arg4)
static voidapplyError()
Helper methods for default ModuleBody actions.
ObjectapplyN(Object[] args)
static ObjectapplyNDefault(ModuleMethod method, Object[] args)
intmatch0(CallContext ctx)
intmatch1(Object arg1, CallContext ctx)
intmatch2(Object arg1, Object arg2, CallContext ctx)
intmatch3(Object arg1, Object arg2, Object arg3, CallContext ctx)
intmatch4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
intmatchN(Object[] args, CallContext ctx)
intnumArgs()
protected voidresolveParameterTypes()
Figure out parameter types.

Field Detail

module

public ModuleBody module

numArgs

protected int numArgs

selector

public final int selector

Constructor Detail

ModuleMethod

public ModuleMethod(ModuleBody module, int selector, Object name, int numArgs)

ModuleMethod

public ModuleMethod(ModuleBody module, int selector, Object name, int numArgs, Object argTypes)

Method Detail

apply

public void apply(CallContext ctx)

apply0

public Object apply0()

apply0Default

public static Object apply0Default(ModuleMethod method)

apply1

public Object apply1(Object arg1)

apply1Default

public static Object apply1Default(ModuleMethod method, Object arg1)

apply2

public Object apply2(Object arg1, Object arg2)

apply2Default

public static Object apply2Default(ModuleMethod method, Object arg1, Object arg2)

apply3

public Object apply3(Object arg1, Object arg2, Object arg3)

apply3Default

public static Object apply3Default(ModuleMethod method, Object arg1, Object arg2, Object arg3)

apply4

public Object apply4(Object arg1, Object arg2, Object arg3, Object arg4)

apply4Default

public static Object apply4Default(ModuleMethod method, Object arg1, Object arg2, Object arg3, Object arg4)

applyError

public static void applyError()
Helper methods for default ModuleBody actions.

applyN

public Object applyN(Object[] args)

applyNDefault

public static Object applyNDefault(ModuleMethod method, Object[] args)

match0

public int match0(CallContext ctx)

match1

public int match1(Object arg1, CallContext ctx)

match2

public int match2(Object arg1, Object arg2, CallContext ctx)

match3

public int match3(Object arg1, Object arg2, Object arg3, CallContext ctx)

match4

public int match4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)

matchN

public int matchN(Object[] args, CallContext ctx)

numArgs

public int numArgs()

resolveParameterTypes

protected void resolveParameterTypes()
Figure out parameter types. Uses reflection to get method parameter types. INCOMPLETE - does not handle procedures with optional or rest args.