1 24 package info.monitorenter.gui.chart.io; 25 26 import info.monitorenter.gui.chart.ITrace2D; 27 import info.monitorenter.gui.chart.TracePoint2D; 28 29 30 43 public class RandomDataCollectorOffset extends ADataCollector { 44 45 46 private long m_starttime = System.currentTimeMillis(); 47 48 49 private double m_y = 0.0; 50 51 62 public RandomDataCollectorOffset(final ITrace2D trace, final int latency) { 63 super(trace, latency); 64 } 65 66 69 public TracePoint2D collectData() { 70 double rand = Math.random(); 71 boolean add = (rand >= 0.5) ? true : false; 72 this.m_y = (add) ? this.m_y + Math.random() : this.m_y - Math.random(); 73 return new TracePoint2D(((double) System.currentTimeMillis() - this.m_starttime), this.m_y); 74 } 75 } 76 | Popular Tags |