]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/elements/EditorStateStatic.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / elements / EditorStateStatic.java
1 package org.simantics.diagram.elements;
2
3 import java.awt.geom.Rectangle2D;
4
5 /**
6  * @author Antti Villberg
7  * @since 1.31.0
8  */
9 class EditorStateStatic {
10
11         Rectangle2D verticalDimensions = null;
12         double termStringWidth = 0;
13         String textElementId = null;
14
15         @Override
16         public int hashCode() {
17                 final int prime = 31;
18                 int result = 1;
19                 result = prime * result + ((textElementId == null) ? 0 : textElementId.hashCode());
20                 result = prime * result + ((verticalDimensions == null) ? 0 : verticalDimensions.hashCode());
21                 long temp;
22                 temp = Double.doubleToLongBits(termStringWidth);
23                 result = prime * result + (int) (temp ^ (temp >>> 32));
24                 return result;
25         }
26
27         @Override
28         public boolean equals(Object obj) {
29                 if (this == obj)
30                         return true;
31                 if (obj == null)
32                         return false;
33                 if (getClass() != obj.getClass())
34                         return false;
35                 EditorStateStatic other = (EditorStateStatic) obj;
36                 if (textElementId == null) {
37                         if (other.textElementId != null)
38                                 return false;
39                 } else if (!textElementId.equals(other.textElementId))
40                         return false;
41                 if (verticalDimensions == null) {
42                         if (other.verticalDimensions != null)
43                                 return false;
44                 } else if (!verticalDimensions.equals(other.verticalDimensions))
45                         return false;
46                 if (Double.doubleToLongBits(termStringWidth) != Double.doubleToLongBits(other.termStringWidth))
47                         return false;
48                 return true;
49         }
50
51 }