1 package gnu.mapping; 2 3 8 9 public abstract class Procedure1or2 extends Procedure 10 { 11 12 public Procedure1or2 () 13 { 14 super(); 15 } 16 17 public Procedure1or2 (String n) 18 { 19 super(n); 20 } 21 22 public int numArgs() { return 0x2001; } 23 24 public Object apply0 () 25 { 26 throw new WrongArguments(this, 0); 27 } 28 29 public abstract Object apply1 (Object arg1) throws Throwable ; 30 31 public abstract Object apply2 (Object arg1,Object arg2) throws Throwable ; 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 == 1) 46 return apply1 (args[0]); 47 else if (args.length == 2) 48 return apply2 (args[0], args[1]); 49 else 50 throw new WrongArguments(this, args.length); 51 } 52 } 53 | Popular Tags |