]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerPropertyInfo.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / ComponentTypeViewerPropertyInfo.java
1 package org.simantics.modeling.ui.componentTypeEditor;\r
2 \r
3 import org.simantics.databoard.annotations.Optional;\r
4 import org.simantics.databoard.type.NumberType;\r
5 import org.simantics.db.Resource;\r
6 import org.simantics.utils.strings.AlphanumComparator;\r
7 \r
8 public class ComponentTypeViewerPropertyInfo implements Comparable<ComponentTypeViewerPropertyInfo> {\r
9     public Resource resource;\r
10     public String name;\r
11     public String type;\r
12     public String defaultValue;\r
13     public String label;\r
14     public String description;\r
15     @Optional\r
16     public String expression;\r
17     @Optional\r
18     public String valid;\r
19     @Optional\r
20     public NumberType numberType;\r
21     @Optional\r
22     public String unit;\r
23     public boolean immutable;\r
24     public Object sectionSpecificData; \r
25 \r
26     public ComponentTypeViewerPropertyInfo(Resource resource, String name, String type, String defaultValue, NumberType numberType, String unit, String label, String description, String expression, String valid, boolean immutable) {\r
27         this.resource = resource;\r
28         this.name = name;\r
29         this.type = type;\r
30         this.defaultValue = defaultValue;\r
31         this.numberType = numberType;\r
32         this.unit = unit;\r
33         this.label = label;\r
34         this.description = description;\r
35         this.expression = expression;\r
36         this.valid = valid;\r
37         this.immutable = immutable;\r
38     }\r
39 \r
40     @Override\r
41     public int compareTo(ComponentTypeViewerPropertyInfo o) {\r
42         return AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(name, (o.name));\r
43     }\r
44 \r
45     @Override\r
46     public int hashCode() {\r
47         final int prime = 31;\r
48         int result = 1;\r
49         result = prime * result\r
50                 + ((defaultValue == null) ? 0 : defaultValue.hashCode());\r
51         result = prime * result\r
52                 + ((description == null) ? 0 : description.hashCode());\r
53         result = prime * result\r
54                 + ((expression == null) ? 0 : expression.hashCode());\r
55         result = prime * result + (immutable ? 1231 : 1237);\r
56         result = prime * result + ((label == null) ? 0 : label.hashCode());\r
57         result = prime * result + ((name == null) ? 0 : name.hashCode());\r
58         result = prime * result\r
59                 + ((numberType == null) ? 0 : numberType.hashCode());\r
60         result = prime * result\r
61                 + ((resource == null) ? 0 : resource.hashCode());\r
62         result = prime * result + ((sectionSpecificData == null) ? 0\r
63                 : sectionSpecificData.hashCode());\r
64         result = prime * result + ((type == null) ? 0 : type.hashCode());\r
65         result = prime * result + ((unit == null) ? 0 : unit.hashCode());\r
66         result = prime * result + ((valid == null) ? 0 : valid.hashCode());\r
67         return result;\r
68     }\r
69 \r
70     @Override\r
71     public boolean equals(Object obj) {\r
72         if (this == obj)\r
73             return true;\r
74         if (obj == null)\r
75             return false;\r
76         if (getClass() != obj.getClass())\r
77             return false;\r
78         ComponentTypeViewerPropertyInfo other = (ComponentTypeViewerPropertyInfo) obj;\r
79         if (defaultValue == null) {\r
80             if (other.defaultValue != null)\r
81                 return false;\r
82         } else if (!defaultValue.equals(other.defaultValue))\r
83             return false;\r
84         if (description == null) {\r
85             if (other.description != null)\r
86                 return false;\r
87         } else if (!description.equals(other.description))\r
88             return false;\r
89         if (expression == null) {\r
90             if (other.expression != null)\r
91                 return false;\r
92         } else if (!expression.equals(other.expression))\r
93             return false;\r
94         if (immutable != other.immutable)\r
95             return false;\r
96         if (label == null) {\r
97             if (other.label != null)\r
98                 return false;\r
99         } else if (!label.equals(other.label))\r
100             return false;\r
101         if (name == null) {\r
102             if (other.name != null)\r
103                 return false;\r
104         } else if (!name.equals(other.name))\r
105             return false;\r
106         if (numberType == null) {\r
107             if (other.numberType != null)\r
108                 return false;\r
109         } else if (!numberType.equals(other.numberType))\r
110             return false;\r
111         if (resource == null) {\r
112             if (other.resource != null)\r
113                 return false;\r
114         } else if (!resource.equals(other.resource))\r
115             return false;\r
116         if (sectionSpecificData == null) {\r
117             if (other.sectionSpecificData != null)\r
118                 return false;\r
119         } else if (!sectionSpecificData.equals(other.sectionSpecificData))\r
120             return false;\r
121         if (type == null) {\r
122             if (other.type != null)\r
123                 return false;\r
124         } else if (!type.equals(other.type))\r
125             return false;\r
126         if (unit == null) {\r
127             if (other.unit != null)\r
128                 return false;\r
129         } else if (!unit.equals(other.unit))\r
130             return false;\r
131         if (valid == null) {\r
132             if (other.valid != null)\r
133                 return false;\r
134         } else if (!valid.equals(other.valid))\r
135             return false;\r
136         return true;\r
137     }\r
138     \r
139     \r
140 }