]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/SimpleFont.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.document.server.io / src / org / simantics / document / server / io / SimpleFont.java
1 package org.simantics.document.server.io;
2
3 public class SimpleFont implements IFont {
4
5         private final String family;
6         private final String style;
7         private final int height;
8
9         public SimpleFont(String family, String style, int height) {
10                 this.family = family;
11                 this.style = style;
12                 this.height = height;
13         }
14
15         @Override
16         public int hashCode() {
17                 final int prime = 31;
18                 int result = 1;
19                 result = prime * result + ((family == null) ? 0 : family.hashCode());
20                 result = prime * result + height;
21                 result = prime * result + ((style == null) ? 0 : style.hashCode());
22                 return result;
23         }
24
25         @Override
26         public boolean equals(Object obj) {
27                 if (this == obj)
28                         return true;
29                 if (obj == null)
30                         return false;
31                 if (getClass() != obj.getClass())
32                         return false;
33                 SimpleFont other = (SimpleFont) obj;
34                 if (family == null) {
35                         if (other.family != null)
36                                 return false;
37                 } else if (!family.equals(other.family))
38                         return false;
39                 if (height != other.height)
40                         return false;
41                 if (style == null) {
42                         if (other.style != null)
43                                 return false;
44                 } else if (!style.equals(other.style))
45                         return false;
46                 return true;
47         }
48
49         @Override
50         public String getFamily() {
51                 return family;
52         }
53
54         @Override
55         public String getStyle() {
56                 return style;
57         }
58
59         @Override
60         public int getHeight() {
61                 return height;
62         }
63         
64 }