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