KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > mapping > ProcedureN


1 package gnu.mapping;
2
3 /**
4  * Abstract class for "N-argument" Scheme procedures, where N>4 or variable.
5  * @author Per Bothner
6  */

7
8 public abstract class ProcedureN extends Procedure
9 {
10   public ProcedureN ()
11   {
12     super();
13   }
14
15   public ProcedureN (String JavaDoc n)
16   {
17       super(n);
18   }
19
20   public static final Object JavaDoc[] noArgs = new Object JavaDoc[0];
21
22   public Object JavaDoc apply0 () throws Throwable JavaDoc
23   {
24     return applyN(noArgs);
25   }
26
27   public Object JavaDoc apply1 (Object JavaDoc arg1) throws Throwable JavaDoc
28   {
29     Object JavaDoc[] args = new Object JavaDoc[1];
30     args[0] = arg1;
31     return applyN (args);
32   }
33
34    public Object JavaDoc apply2 (Object JavaDoc arg1,Object JavaDoc arg2) throws Throwable JavaDoc
35   {
36     Object JavaDoc[] args = new Object JavaDoc[2];
37     args[0] = arg1;
38     args[1] = arg2;
39     return applyN (args);
40   }
41
42   public Object JavaDoc apply3 (Object JavaDoc arg1, Object JavaDoc arg2, Object JavaDoc arg3) throws Throwable JavaDoc
43   {
44     Object JavaDoc[] args = new Object JavaDoc[3];
45     args[0] = arg1;
46     args[1] = arg2;
47     args[2] = arg3;
48     return applyN (args);
49   }
50
51   public Object JavaDoc apply4 (Object JavaDoc arg1, Object JavaDoc arg2,
52             Object JavaDoc arg3, Object JavaDoc arg4) throws Throwable JavaDoc
53   {
54     Object JavaDoc[] args = new Object JavaDoc[4];
55     args[0] = arg1;
56     args[1] = arg2;
57     args[2] = arg3;
58     args[3] = arg4;
59     return applyN (args);
60   }
61
62   public abstract Object JavaDoc applyN (Object JavaDoc[] args) throws Throwable JavaDoc;
63 }
64
Popular Tags