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