2004-11-14 | Paul Boddie | raw annotate files changeset graph | Adjusted the dispatcher method code, adding comments, where the only real changes are the removal of pop_top at the end of the code for testing each method (since it had been assumed that the iterator was still on the stack, but it was probably something else) and the moving of setup_loop upwards before the preparation of the argument-to-type mapping. |
1 public class Value { 2 protected int value; 3 4 public Value(int value) { 5 this.value = value; 6 } 7 8 public int getValue() { 9 return this.value; 10 } 11 12 public void setValue(int value) { 13 this.value = value; 14 } 15 16 public boolean isPositive() { 17 return this.value > 0; 18 } 19 20 public int compare(int value) { 21 if (value < this.value) { 22 return -1; 23 } else if (value == this.value) { 24 return 0; 25 } else { 26 return 1; 27 } 28 } 29 30 public int add(int value) { 31 return this.value + value; 32 } 33 34 public Value newValue() { 35 return new Value(this.getValue()); 36 } 37 } 38 39 // vim: tabstop=4 expandtab shiftwidth=4