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 39 public class RandomDataCollectorTimeStamped extends ADataCollector { 40 41 42 private double m_y = 0.0; 43 44 55 public RandomDataCollectorTimeStamped(final ITrace2D trace, final int latency) { 56 super(trace, latency); 57 } 58 59 62 public TracePoint2D collectData() { 63 double rand = Math.random(); 64 boolean add = (rand >= 0.5) ? true : false; 65 this.m_y = (add) ? this.m_y + Math.random() : this.m_y - Math.random(); 66 return new TracePoint2D((double) System.currentTimeMillis(), this.m_y); 67 } 68 } 69 | Popular Tags |