01: package gnu.mapping;
02:
03: /**
04: * Abstract class for 1-argument Scheme procedures.
05: * @author Per Bothner
06: */
07:
08: public abstract class Procedure1 extends Procedure {
09: public Procedure1() {
10: super ();
11: }
12:
13: public Procedure1(java.lang.String n) {
14: super (n);
15: }
16:
17: public int numArgs() {
18: return 0x1001;
19: }
20:
21: public Object apply0() throws Throwable {
22: throw new WrongArguments(this , 0);
23: }
24:
25: public abstract Object apply1(Object arg1) throws Throwable;
26:
27: public Object apply2(Object arg1, Object arg2) throws Throwable {
28: throw new WrongArguments(this , 2);
29: }
30:
31: public Object apply3(Object arg1, Object arg2, Object arg3)
32: throws Throwable {
33: throw new WrongArguments(this , 3);
34: }
35:
36: public Object apply4(Object arg1, Object arg2, Object arg3,
37: Object arg4) throws Throwable {
38: throw new WrongArguments(this , 4);
39: }
40:
41: public Object applyN(Object[] args) throws Throwable {
42: if (args.length != 1)
43: throw new WrongArguments(this , args.length);
44: return apply1(args[0]);
45: }
46: }
|