gnu.expr
Class GenericProc

java.lang.Object
  extended by gnu.mapping.Procedure
      extended by gnu.mapping.ProcedureN
          extended by gnu.mapping.MethodProc
              extended by gnu.expr.GenericProc
All 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
argTypes, NO_MATCH, NO_MATCH_AMBIGUOUS, NO_MATCH_BAD_TYPE, NO_MATCH_TOO_FEW_ARGS, NO_MATCH_TOO_MANY_ARGS
 
Fields inherited from class gnu.mapping.ProcedureN
noArgs
 
Constructor Summary
GenericProc()
           
GenericProc(java.lang.String name)
           
 
Method Summary
 void add(MethodProc method)
           
protected  void add(MethodProc[] procs)
           
 java.lang.Object applyN(java.lang.Object[] args)
           
 int isApplicable(Type[] args)
          Test if method is applicable to an invocation with given arguments.
static GenericProc make(java.lang.Object[] args)
          Create a GenericProc from one or more methods, plus properties.
 int match0(CallContext ctx)
          Pass zero arguments.
 int match1(java.lang.Object arg1, CallContext ctx)
          Pass one argument.
 int match2(java.lang.Object arg1, java.lang.Object arg2, CallContext ctx)
          Pass two arguments.
 int match3(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, CallContext ctx)
          Pass three arguments.
 int match4(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, CallContext ctx)
          Pass four arguments.
 int matchN(java.lang.Object[] args, CallContext ctx)
           
 int numArgs()
          Return minArgs()|(maxArgs<<12).
 void setProperties(java.lang.Object[] args)
           
 
Methods inherited from class gnu.mapping.MethodProc
getParameterType, matchFailAsException, mostSpecific, mostSpecific, numParameters, resolveParameterTypes
 
Methods inherited from class gnu.mapping.ProcedureN
apply0, apply1, apply2, apply3, apply4
 
Methods inherited from class gnu.mapping.Procedure
apply, apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getName, getProperty, getSetter, getSymbol, maxArgs, minArgs, name, removeProperty, set0, set1, setN, setName, setProperty, setProperty, setSetter, setSymbol, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

methods

protected MethodProc[] methods
Constructor Detail

GenericProc

public GenericProc(java.lang.String name)

GenericProc

public GenericProc()
Method Detail

numArgs

public int numArgs()
Description copied from class: Procedure
Return minArgs()|(maxArgs<<12).

Overrides:
numArgs in class Procedure

add

protected void add(MethodProc[] procs)

add

public void add(MethodProc method)

applyN

public java.lang.Object applyN(java.lang.Object[] args)
                        throws java.lang.Throwable
Overrides:
applyN in class MethodProc
Throws:
java.lang.Throwable

isApplicable

public int isApplicable(Type[] args)
Description copied from class: MethodProc
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 class MethodProc

match0

public int match0(CallContext ctx)
Description copied from class: Procedure
Pass zero arguments.

Overrides:
match0 in class Procedure
Returns:
non-negative if the match succeeded, else negative.

match1

public int match1(java.lang.Object arg1,
                  CallContext ctx)
Description copied from class: Procedure
Pass one argument.

Overrides:
match1 in class Procedure
Returns:
non-negative if the match succeeded, else negative.

match2

public int match2(java.lang.Object arg1,
                  java.lang.Object arg2,
                  CallContext ctx)
Description copied from class: Procedure
Pass two arguments.

Overrides:
match2 in class Procedure
Returns:
non-negative if the match succeeded, else negative.

match3

public int match3(java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.Object arg3,
                  CallContext ctx)
Description copied from class: Procedure
Pass three arguments.

Overrides:
match3 in class Procedure
Returns:
non-negative if the match succeeded, else negative.

match4

public int match4(java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.Object arg3,
                  java.lang.Object arg4,
                  CallContext ctx)
Description copied from class: Procedure
Pass four arguments.

Overrides:
match4 in class Procedure
Returns:
non-negative if the match succeeded, else negative.

matchN

public int matchN(java.lang.Object[] args,
                  CallContext ctx)
Overrides:
matchN in class Procedure

setProperties

public final void setProperties(java.lang.Object[] args)

make

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