KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > mapping > Setter


1 package gnu.mapping;
2
3 /** The "setter" of procedure that can be used in the LHS of an assignment. */
4
5 public class Setter extends ProcedureN
6 {
7   protected Procedure getter;
8
9   public Setter(Procedure getter)
10   {
11     this.getter = getter;
12     String JavaDoc name = getter.getName();
13     if (name != null)
14       setName("(setter "+name+")");
15   }
16
17   public int numArgs()
18   {
19     int get_args = getter.numArgs();
20     if (get_args < 0) return get_args+1;
21     else return get_args + 0x1001;
22   }
23
24   public Object JavaDoc applyN(Object JavaDoc[] args) throws Throwable JavaDoc
25   { getter.setN(args); return Values.empty; }
26 }
27
Popular Tags