1 package org.sat4j.sat.visu;
2
3 import info.monitorenter.gui.chart.ITracePoint2D;
4 import info.monitorenter.gui.chart.traces.painters.ATracePainter;
5
6 import java.awt.Graphics;
7
8 public class TracePainterPlus extends ATracePainter {
9
10
11
12
13 private static final long serialVersionUID = 1L;
14
15
16 private final PointPainterPlus mPointPainter;
17
18 private static final int DEFAULT_SIZE = 6;
19
20
21
22
23
24 public TracePainterPlus() {
25 this.mPointPainter = new PointPainterPlus(DEFAULT_SIZE);
26 }
27
28
29
30
31
32
33
34 public TracePainterPlus(final int plusSize) {
35 this.mPointPainter = new PointPainterPlus(plusSize);
36 }
37
38
39
40
41 @Override
42 public void endPaintIteration(final Graphics g2d) {
43 if (g2d != null) {
44 int previousX = this.getPreviousX();
45 int previousY = this.getPreviousY();
46 if (previousX != Integer.MIN_VALUE
47 || previousY != Integer.MIN_VALUE) {
48 this.mPointPainter.paintPoint(previousX, previousY, 0, 0, g2d,
49 this.getPreviousPoint());
50 }
51 }
52 this.mPointPainter.endPaintIteration(g2d);
53 }
54
55
56
57
58 @Override
59 public boolean equals(final Object obj) {
60 if (this == obj) {
61 return true;
62 }
63 if (!super.equals(obj)) {
64 return false;
65 }
66 if (this.getClass() != obj.getClass()) {
67 return false;
68 }
69 final TracePainterPlus other = (TracePainterPlus) obj;
70 if (this.mPointPainter == null) {
71 if (other.mPointPainter != null) {
72 return false;
73 }
74 } else if (!this.mPointPainter.equals(other.mPointPainter)) {
75 return false;
76 }
77 return true;
78 }
79
80
81
82
83
84
85
86 public int getPlusSize() {
87 return this.mPointPainter.getPlusSize();
88 }
89
90
91
92
93 @Override
94 public int hashCode() {
95 final int prime = 31;
96 int result = super.hashCode();
97 result = prime
98 * result
99 + (this.mPointPainter == null ? 0 : this.mPointPainter
100 .hashCode());
101 return result;
102 }
103
104
105
106
107
108
109 @Override
110 public void paintPoint(final int absoluteX, final int absoluteY,
111 final int nextX, final int nextY, final Graphics g,
112 final ITracePoint2D original) {
113 super.paintPoint(absoluteX, absoluteY, nextX, nextY, g, original);
114 this.mPointPainter.paintPoint(absoluteX, absoluteY, nextX, nextY, g,
115 original);
116 }
117
118
119
120
121
122
123
124
125 public void setPlusSize(final int plusSize) {
126 this.mPointPainter.setPlusSize(plusSize);
127 }
128
129
130
131
132 @Override
133 public void startPaintIteration(final Graphics g2d) {
134 super.startPaintIteration(g2d);
135 this.mPointPainter.startPaintIteration(g2d);
136 }
137 }