gnu.expr
Class PrimProcedure
java.lang.Object
|
+--gnu.mapping.Procedure
|
+--gnu.mapping.ProcedureN
|
+--gnu.expr.MethodProc
|
+--gnu.expr.PrimProcedure
- public class PrimProcedure
- extends MethodProc
- implements Inlineable
A primitive Procedure implemented by a plain Java method.
|
Method Summary |
java.lang.Object |
applyV(java.lang.Object vars)
|
void |
compile(ApplyExp exp,
Compilation comp,
Target target)
|
static void |
compileArgs(Expression[] args,
Type thisType,
Type[] argTypes,
boolean variable,
java.lang.String name,
LambdaExp source,
Compilation comp)
Compile arguments and push unto stack. |
static PrimProcedure |
getMethodFor(Procedure pproc,
Expression[] args)
Search for a matching static method in a procedure's class. |
java.lang.String |
getName()
|
Type |
getParameterType(int index)
|
Type[] |
getParameterTypes()
|
Type |
getReturnType()
|
Type |
getReturnType(Expression[] args)
|
boolean |
getStaticFlag()
|
java.lang.Object |
getVarBuffer()
Return a buffer that can contain decoded (matched) arguments. |
java.lang.String |
getVerboseName()
|
java.lang.RuntimeException |
match(java.lang.Object vars,
java.lang.Object[] args)
Match the incoming arguments. |
int |
numArgs()
Return minArgs()|(maxArgs<<12). |
int |
opcode()
|
void |
print(java.io.PrintWriter ps)
|
void |
setReturnType(Type retType)
|
boolean |
takesVarArgs()
Return true iff the last parameter is a "rest" argument. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
PrimProcedure
public PrimProcedure(Method method)
PrimProcedure
public PrimProcedure(Method method,
LambdaExp source)
PrimProcedure
public PrimProcedure(int opcode,
Type retType,
Type[] argTypes)
PrimProcedure
public PrimProcedure(int op_code,
ClassType classtype,
java.lang.String name,
Type retType,
Type[] argTypes)
PrimProcedure
public PrimProcedure(ClassType classtype,
Type[] argTypes)
- Use to compile new followed by constructor.
opcode
public final int opcode()
getReturnType
public Type getReturnType()
setReturnType
public void setReturnType(Type retType)
getReturnType
public Type getReturnType(Expression[] args)
- Specified by:
- getReturnType in interface Inlineable
takesVarArgs
public boolean takesVarArgs()
- Return true iff the last parameter is a "rest" argument.
getVarBuffer
public java.lang.Object getVarBuffer()
- Return a buffer that can contain decoded (matched) arguments.
- Overrides:
- getVarBuffer in class MethodProc
numArgs
public int numArgs()
- Description copied from class: Procedure
- Return minArgs()|(maxArgs<<12).
- Overrides:
- numArgs in class Procedure
match
public java.lang.RuntimeException match(java.lang.Object vars,
java.lang.Object[] args)
- Description copied from class: MethodProc
- Match the incoming arguments.
- Overrides:
- match in class MethodProc
- Tags copied from class: MethodProc
- Parameters:
args - the incoming argument listvars - where to save the matched result on success- Returns:
- null if the match succeeded, else an exception
applyV
public java.lang.Object applyV(java.lang.Object vars)
- Overrides:
- applyV in class MethodProc
getStaticFlag
public final boolean getStaticFlag()
getParameterTypes
public final Type[] getParameterTypes()
compileArgs
public static void compileArgs(Expression[] args,
Type thisType,
Type[] argTypes,
boolean variable,
java.lang.String name,
LambdaExp source,
Compilation comp)
- Compile arguments and push unto stack.
- Parameters:
args - arguments to evaluate and push.thisType - If we care calling a non-static function,
then args[0] is the receiver and thisType is its expected class.
If thisType==Type.void_type, ignore argType[0].
If this_type==null, no special handling of args[0] or argTypes[0].
compile
public void compile(ApplyExp exp,
Compilation comp,
Target target)
- Specified by:
- compile in interface Inlineable
getParameterType
public Type getParameterType(int index)
- Overrides:
- getParameterType in class MethodProc
getMethodFor
public static PrimProcedure getMethodFor(Procedure pproc,
Expression[] args)
- Search for a matching static method in a procedure's class.
- Returns:
- a PrimProcedure that is suitable, or null.
getName
public java.lang.String getName()
- Overrides:
- getName in class Procedure
getVerboseName
public java.lang.String getVerboseName()
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
print
public void print(java.io.PrintWriter ps)
- Overrides:
- print in class Procedure