01: package gnu.mapping;
02:
03: /** The "setter" of procedure that can be used in the LHS of an assignment. */
04:
05: public class Setter extends ProcedureN {
06: Procedure getter;
07:
08: public Setter(Procedure getter) {
09: this .getter = getter;
10: String name = getter.getName();
11: if (name != null)
12: setName("(setter " + name + ")");
13: }
14:
15: public int numArgs() {
16: int get_args = getter.numArgs();
17: if (get_args < 0)
18: return get_args + 1;
19: else
20: return get_args + 0x1001;
21: }
22:
23: public Object applyN(Object[] args) throws Throwable {
24: getter.setN(args);
25: return Values.empty;
26: }
27: }
|