KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > mapping > Procedure2


1 package gnu.mapping;
2
3 /**
4  * Abstract class for 2-argument Scheme procedures.
5  * Extensions must provide apply2.
6  * @author Per Bothner
7  */

8
9 public abstract class Procedure2 extends Procedure
10 {
11
12   public Procedure2(java.lang.String JavaDoc n)
13   {
14     super(n);
15   }
16   public Procedure2()
17   {
18     super();
19   }
20
21   public int numArgs() { return 0x2002; }
22
23   public Object JavaDoc apply0 () throws Throwable JavaDoc
24   {
25     throw new WrongArguments(this.getName(), 2, "(?)");
26   }
27
28   public Object JavaDoc apply1 (Object JavaDoc arg1) throws Throwable JavaDoc
29   {
30     throw new WrongArguments(this, 1);
31   }
32
33   public abstract Object JavaDoc apply2 (Object JavaDoc arg1,Object JavaDoc arg2) throws Throwable JavaDoc;
34
35   public Object JavaDoc apply3 (Object JavaDoc arg1, Object JavaDoc arg2, Object JavaDoc arg3)
36   {
37     throw new WrongArguments(this, 3);
38   }
39
40   public Object JavaDoc apply4 (Object JavaDoc arg1, Object JavaDoc arg2, Object JavaDoc arg3, Object JavaDoc arg4)
41      throws Throwable JavaDoc
42   {
43     throw new WrongArguments(this, 4);
44   }
45
46   public Object JavaDoc applyN (Object JavaDoc[] args) throws Throwable JavaDoc
47   {
48     if (args.length != 2)
49       throw new WrongArguments(this, args.length);
50     return apply2 (args[0], args[1]);
51   }
52 }
53
Popular Tags