1 package org.simantics.modeling.ui.componentTypeEditor;
3 import org.simantics.databoard.annotations.Optional;
4 import org.simantics.databoard.type.NumberType;
5 import org.simantics.db.Resource;
6 import org.simantics.utils.strings.AlphanumComparator;
8 public class ComponentTypeViewerPropertyInfo implements Comparable<ComponentTypeViewerPropertyInfo> {
9 public Resource resource;
12 public String defaultValue;
14 public String description;
16 public String expression;
20 public NumberType numberType;
23 public boolean immutable;
24 public Object sectionSpecificData;
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) {
27 this.resource = resource;
30 this.defaultValue = defaultValue;
31 this.numberType = numberType;
34 this.description = description;
35 this.expression = expression;
37 this.immutable = immutable;
41 public int compareTo(ComponentTypeViewerPropertyInfo o) {
42 return AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(name, (o.name));
46 public int hashCode() {
49 result = prime * result
50 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
51 result = prime * result
52 + ((description == null) ? 0 : description.hashCode());
53 result = prime * result
54 + ((expression == null) ? 0 : expression.hashCode());
55 result = prime * result + (immutable ? 1231 : 1237);
56 result = prime * result + ((label == null) ? 0 : label.hashCode());
57 result = prime * result + ((name == null) ? 0 : name.hashCode());
58 result = prime * result
59 + ((numberType == null) ? 0 : numberType.hashCode());
60 result = prime * result
61 + ((resource == null) ? 0 : resource.hashCode());
62 result = prime * result + ((sectionSpecificData == null) ? 0
63 : sectionSpecificData.hashCode());
64 result = prime * result + ((type == null) ? 0 : type.hashCode());
65 result = prime * result + ((unit == null) ? 0 : unit.hashCode());
66 result = prime * result + ((valid == null) ? 0 : valid.hashCode());
71 public boolean equals(Object obj) {
76 if (getClass() != obj.getClass())
78 ComponentTypeViewerPropertyInfo other = (ComponentTypeViewerPropertyInfo) obj;
79 if (defaultValue == null) {
80 if (other.defaultValue != null)
82 } else if (!defaultValue.equals(other.defaultValue))
84 if (description == null) {
85 if (other.description != null)
87 } else if (!description.equals(other.description))
89 if (expression == null) {
90 if (other.expression != null)
92 } else if (!expression.equals(other.expression))
94 if (immutable != other.immutable)
97 if (other.label != null)
99 } else if (!label.equals(other.label))
102 if (other.name != null)
104 } else if (!name.equals(other.name))
106 if (numberType == null) {
107 if (other.numberType != null)
109 } else if (!numberType.equals(other.numberType))
111 if (resource == null) {
112 if (other.resource != null)
114 } else if (!resource.equals(other.resource))
116 if (sectionSpecificData == null) {
117 if (other.sectionSpecificData != null)
119 } else if (!sectionSpecificData.equals(other.sectionSpecificData))
122 if (other.type != null)
124 } else if (!type.equals(other.type))
127 if (other.unit != null)
129 } else if (!unit.equals(other.unit))
132 if (other.valid != null)
134 } else if (!valid.equals(other.valid))