| 1 24 25 package info.monitorenter.gui.chart.traces; 26 27 import info.monitorenter.gui.chart.TracePoint2D; 28 29 43 public class Trace2DLtdSorted extends Trace2DSorted { 44 45 46 protected int m_maxsize; 47 48 52 public Trace2DLtdSorted() { 53 54 this(100); 55 } 56 57 63 public Trace2DLtdSorted(final int maxsize) { 64 this.m_maxsize = maxsize; 65 } 66 67 83 protected boolean addPointInternal(final TracePoint2D point) { 84 85 boolean rem = this.removePoint(point); 86 this.m_points.add(point); 87 if (!rem) { 88 if (this.m_points.size() > this.m_maxsize) { 89 TracePoint2D remove = (TracePoint2D) this.m_points.last(); 90 this.removePoint(remove); 91 } 92 } 93 return true; 94 } 95 96 99 public final int getMaxSize() { 100 101 return this.m_maxsize; 102 } 103 104 111 public final void setMaxSize(final int amount) { 112 113 synchronized (this) { 114 this.m_maxsize = amount; 115 } 116 } 117 } 118 | Popular Tags |