1 22 package info.monitorenter.gui.chart.traces.painters; 23 24 import java.awt.Graphics2D ; 25 26 36 public abstract class ATracePainter implements info.monitorenter.gui.chart.ITracePainter { 37 38 43 44 protected Graphics2D m_graphics; 45 46 47 private boolean m_isEnded = false; 48 49 58 59 protected int m_lastX; 60 61 70 71 protected int m_lastY; 72 73 76 public int compareTo(final Object o) { 77 78 return this.getClass().getName().compareTo(o.getClass().getName()); 79 } 80 81 84 public void discontinue() { 85 this.endPaintIteration(); 86 this.startPaintIteration(); 87 } 88 89 92 public void endPaintIteration() { 93 } 95 96 107 public boolean equals(final Object obj) { 108 return this.getClass() == obj.getClass(); 109 } 110 111 114 protected final Graphics2D getGraphics() { 115 return this.m_graphics; 116 } 117 118 130 public int getPreviousX() { 131 int result = this.m_lastX; 132 if (this.m_isEnded) { 133 this.m_lastX = Integer.MIN_VALUE; 134 if (this.m_lastY == Integer.MIN_VALUE) { 135 this.m_isEnded = false; 136 } 137 138 } 139 return result; 140 } 141 142 154 public int getPreviousY() { 155 int result = this.m_lastY; 156 if (this.m_isEnded) { 157 this.m_lastY = Integer.MIN_VALUE; 158 if (this.m_lastX == Integer.MIN_VALUE) { 159 this.m_isEnded = false; 160 } 161 } 162 return result; 163 } 164 165 168 public int hashCode() { 169 return this.getClass().hashCode(); 170 } 171 172 176 public void paintPoint(final int absoluteX, final int absoluteY, final int nextX, 177 final int nextY, final Graphics2D g) { 178 this.m_lastX = nextX; 179 this.m_lastY = nextY; 180 this.m_graphics = g; 181 } 182 183 186 public void startPaintIteration() { 187 } 189 } 190 | Popular Tags |