Package gnu.expr
Class GenericProc
- java.lang.Object
-
- gnu.mapping.PropertySet
-
- gnu.mapping.Procedure
-
- gnu.mapping.ProcedureN
-
- gnu.mapping.MethodProc
-
- gnu.expr.GenericProc
-
- All Implemented Interfaces:
Named
public class GenericProc extends MethodProc
A collection of MethodProcs; one is chosen at apply time.
-
-
Field Summary
Fields Modifier and Type Field Description static MethodHandle
applyToConsumerGP
protected MethodProc[]
methods
-
Fields inherited from class gnu.mapping.MethodProc
applyToConsumerDefaultMP, argTypes, NO_MATCH, NO_MATCH_AMBIGUOUS, NO_MATCH_BAD_TYPE, NO_MATCH_GUARD_FALSE, NO_MATCH_TOO_FEW_ARGS, NO_MATCH_TOO_MANY_ARGS, NO_MATCH_UNUSED_KEYWORD, THROW_ON_EXCEPTION
-
Fields inherited from class gnu.mapping.ProcedureN
applyToObject, noArgs
-
Fields inherited from class gnu.mapping.Procedure
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
-
Fields inherited from class gnu.mapping.PropertySet
nameKey
-
-
Constructor Summary
Constructors Constructor Description GenericProc()
GenericProc(String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(MethodProc method)
protected void
addAll(MethodProc[] procs)
void
addAtEnd(MethodProc method)
static Object
applyToConsumerGP(Procedure proc, CallContext ctx)
MethodProc
getMethod(int i)
int
getMethodCount()
int
isApplicable(Type[] args, Type restType)
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.static GenericProc
makeWithoutSorting(Object... args)
int
numArgs()
ReturnminArgs()|(maxArgs<<12)
.void
setProperties(Object[] args)
void
setProperty(Keyword key, Object value)
-
Methods inherited from class gnu.mapping.MethodProc
applyToConsumerDefaultMP, getParameterType, matchFailAsException, mostSpecific, numParameters, overrideEquivalent, resolveParameterTypes
-
Methods inherited from class gnu.mapping.ProcedureN
applyToObject
-
Methods inherited from class gnu.mapping.Procedure
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation, toString
-
Methods inherited from class gnu.mapping.PropertySet
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
-
-
-
-
Field Detail
-
methods
protected MethodProc[] methods
-
applyToConsumerGP
public static final MethodHandle applyToConsumerGP
-
-
Constructor Detail
-
GenericProc
public GenericProc(String name)
-
GenericProc
public GenericProc()
-
-
Method Detail
-
getMethodCount
public int getMethodCount()
-
getMethod
public MethodProc getMethod(int i)
-
numArgs
public int numArgs()
Description copied from class:Procedure
ReturnminArgs()|(maxArgs<<12)
. We use a single virtual function to reduce the number of methods in the system, as well as the number of virtual method table entries. We shift by 12 so the number can normally be represented using a sipush instruction, without requiring a constant pool entry.
-
addAll
protected void addAll(MethodProc[] procs)
-
addAtEnd
public void addAtEnd(MethodProc method)
-
add
public void add(MethodProc method)
-
isApplicable
public int isApplicable(Type[] args, Type restType)
Description copied from class:MethodProc
Test if method is applicable to an invocation with given arguments.- Overrides:
isApplicable
in classMethodProc
- Parameters:
args
- array of known "single" arguments.restType
- If null, the arguments are fully specified by argTypes. If non-null, there may be an unknown number of extra arguments of the given restType. This is used for splices, where we usually don't know at compile-time how many argument values we have.- Returns:
- -1 if no; 1 if yes; 0 if need to check at run-time.
-
applyToConsumerGP
public static Object applyToConsumerGP(Procedure proc, CallContext ctx) throws Throwable
- Throws:
Throwable
-
setProperties
public final void setProperties(Object[] args)
-
make
public static GenericProc make(Object[] args)
Create a GenericProc from one or more methods, plus properties.
-
makeWithoutSorting
public static GenericProc makeWithoutSorting(Object... args)
-
-