1 18 19 package org.objectweb.jac.samples.calcul; 20 21 import java.util.List ; 22 import java.util.Vector ; 23 24 public class Calcul 25 { 26 27 protected float value = 0; 28 29 34 public void add(int toadd) { 35 value+=toadd; 36 addOp(new Op("add",""+toadd)); 37 } 38 39 44 public void sub(float tosub) { 45 value-=tosub; 46 addOp(new Op("sub",""+tosub)); 47 } 48 49 54 public float getValue() { 55 return value; 56 } 57 58 63 public void setValue( float value ) { 64 this.value=value; 65 } 66 67 72 public void bench(int i) { 73 for (; i>0; i--) { 74 add(1); 75 } 76 } 77 78 List ops=new Vector (); 79 80 84 public List getOps() { 85 return ops; 86 } 87 88 92 public void setOps(List v) { 93 this.ops = v; 94 } 95 96 public void addOp(Op op) { 97 ops.add(op); 98 } 99 100 public void removeOp(Op op) { 101 ops.remove(op); 102 } 103 104 public void clearOps() { 105 ops.clear(); 106 } 107 108 } 109 110 114 | Popular Tags |