gnu.expr

Class GenericProc

Implemented Interfaces:
Named

public class GenericProc
extends MethodProc

A collection of MethodProcs; one is chosen at apply time.

Field Summary

protected MethodProc[]
methods

Fields inherited from class gnu.mapping.MethodProc

NO_MATCH, NO_MATCH_AMBIGUOUS, NO_MATCH_BAD_TYPE, NO_MATCH_TOO_FEW_ARGS, NO_MATCH_TOO_MANY_ARGS, argTypes

Fields inherited from class gnu.mapping.ProcedureN

noArgs

Constructor Summary

GenericProc()
GenericProc(String name)

Method Summary

void
add(MethodProc method)
protected void
add(MethodProc[] procs)
Object
applyN(Object[] args)
int
isApplicable(Type[] args)
Test if method is applicable to an invocation with given arguments.
static GenericProc
make(Object[] args)
Create a GenericProc from one or more methods, plus properties.
int
match0(CallContext ctx)
Pass zero arguments.
int
match1(Object arg1, CallContext ctx)
Pass one argument.
int
match2(Object arg1, Object arg2, CallContext ctx)
Pass two arguments.
int
match3(Object arg1, Object arg2, Object arg3, CallContext ctx)
Pass three arguments.
int
match4(Object arg1, Object arg2, Object arg3, Object arg4, CallContext ctx)
Pass four arguments.
int
matchN(Object[] args, CallContext ctx)
int
numArgs()
Return minArgs()|(maxArgs<<12).
void
setProperties(Object[] args)

Methods inherited from class gnu.mapping.MethodProc

applyN, getParameterType, isApplicable, matchFailAsException, mostSpecific, mostSpecific, numParameters, resolveParameterTypes

Methods inherited from class gnu.mapping.ProcedureN

apply0, apply1, apply2, apply3, apply4, applyN

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, numArgs, set0, set1, setN, setSetter, setSourceLocation, toString

Methods inherited from class gnu.mapping.PropertySet

getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol

Field Details

methods

protected MethodProc[] methods

Constructor Details

GenericProc

public GenericProc()

GenericProc

public GenericProc(String name)

Method Details

add

public void add(MethodProc method)

add

protected void add(MethodProc[] procs)

applyN

public Object applyN(Object[] args)
            throws Throwable
Overrides:
applyN in interface MethodProc

isApplicable

public int isApplicable(Type[] args)
Test if method is applicable to an invocation with given arguments. Returns -1 if no; 1 if yes; 0 if need to check at run-time.
Overrides:
isApplicable in interface MethodProc

make

public static GenericProc make(Object[] args)
Create a GenericProc from one or more methods, plus properties.

match0

public int match0(CallContext ctx)
Pass zero arguments.
Overrides:
match0 in interface Procedure
Returns:
non-negative if the match succeeded, else negative.

match1

public int match1(Object arg1,
                  CallContext ctx)
Pass one argument.
Overrides:
match1 in interface Procedure
Returns:
non-negative if the match succeeded, else negative.

match2

public int match2(Object arg1,
                  Object arg2,
                  CallContext ctx)
Pass two arguments.
Overrides:
match2 in interface Procedure
Returns:
non-negative if the match succeeded, else negative.

match3

public int match3(Object arg1,
                  Object arg2,
                  Object arg3,
                  CallContext ctx)
Pass three arguments.
Overrides:
match3 in interface Procedure
Returns:
non-negative if the match succeeded, else negative.

match4

public int match4(Object arg1,
                  Object arg2,
                  Object arg3,
                  Object arg4,
                  CallContext ctx)
Pass four arguments.
Overrides:
match4 in interface Procedure
Returns:
non-negative if the match succeeded, else negative.

matchN

public int matchN(Object[] args,
                  CallContext ctx)
Overrides:
matchN in interface Procedure

numArgs

public int numArgs()
Return minArgs()|(maxArgs<<12).
Overrides:
numArgs in interface Procedure

setProperties

public final void setProperties(Object[] args)