1 22 23 package info.monitorenter.gui.chart; 24 25 import info.monitorenter.gui.chart.traces.ATrace2D; 26 27 import java.awt.geom.Point2D ; 28 29 61 public class TracePoint2D extends Point2D.Double implements Comparable , java.io.Serializable , 62 Cloneable { 63 64 67 private static final long serialVersionUID = 3618980079204512309L; 68 69 76 private ATrace2D m_listener; 77 78 82 protected boolean m_scaledOnce = false; 83 84 87 protected double m_scaledX; 88 89 92 protected double m_scaledY; 93 94 104 public TracePoint2D(final double x, final double y) { 105 106 super(x, y); 107 } 108 109 112 public Object clone() { 113 TracePoint2D result = new TracePoint2D(this.x, this.y); 114 result.m_scaledOnce = this.m_scaledOnce; 115 result.m_scaledX = this.m_scaledX; 116 result.m_scaledY = this.m_scaledY; 117 return result; 118 } 119 120 136 public int compareTo(final Object obj) throws ClassCastException { 137 138 double othx = ((Point2D.Double ) obj).getX(); 139 if (this.x < othx) { 140 return -1; 141 } 142 if (this.x == othx) { 143 return 0; 144 } else { 145 return 1; 146 } 147 } 148 149 152 public boolean equals(final Object o) { 153 if (o == null) { 154 return false; 155 } 156 return compareTo(o) == 0; 157 } 158 159 162 public int hashCode() { 163 return super.hashCode(); 164 } 165 166 177 public void setListener(final ATrace2D listener) { 178 this.m_listener = listener; 179 } 180 181 196 public void setLocation(final double x, final double y) { 197 198 super.setLocation(x, y); 199 if (this.m_listener != null) { 200 this.m_listener.firePointChanged(this, true); 201 } 202 } 203 } 204 | Popular Tags |