]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerPropertyInfo.java
Option for exporting tg and pgraph with sharedlibrary
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / ComponentTypeViewerPropertyInfo.java
1 package org.simantics.modeling.ui.componentTypeEditor;
2
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;
7
8 public class ComponentTypeViewerPropertyInfo implements Comparable<ComponentTypeViewerPropertyInfo> {
9     public Resource resource;
10     public String name;
11     public String type;
12     public String defaultValue;
13     public String label;
14     public String description;
15     @Optional
16     public String expression;
17     @Optional
18     public String valid;
19     @Optional
20     public NumberType numberType;
21     @Optional
22     public String unit;
23     public boolean immutable;
24     public Object sectionSpecificData; 
25
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;
28         this.name = name;
29         this.type = type;
30         this.defaultValue = defaultValue;
31         this.numberType = numberType;
32         this.unit = unit;
33         this.label = label;
34         this.description = description;
35         this.expression = expression;
36         this.valid = valid;
37         this.immutable = immutable;
38     }
39
40     @Override
41     public int compareTo(ComponentTypeViewerPropertyInfo o) {
42         return AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(name, (o.name));
43     }
44
45     @Override
46     public int hashCode() {
47         final int prime = 31;
48         int result = 1;
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());
67         return result;
68     }
69
70     @Override
71     public boolean equals(Object obj) {
72         if (this == obj)
73             return true;
74         if (obj == null)
75             return false;
76         if (getClass() != obj.getClass())
77             return false;
78         ComponentTypeViewerPropertyInfo other = (ComponentTypeViewerPropertyInfo) obj;
79         if (defaultValue == null) {
80             if (other.defaultValue != null)
81                 return false;
82         } else if (!defaultValue.equals(other.defaultValue))
83             return false;
84         if (description == null) {
85             if (other.description != null)
86                 return false;
87         } else if (!description.equals(other.description))
88             return false;
89         if (expression == null) {
90             if (other.expression != null)
91                 return false;
92         } else if (!expression.equals(other.expression))
93             return false;
94         if (immutable != other.immutable)
95             return false;
96         if (label == null) {
97             if (other.label != null)
98                 return false;
99         } else if (!label.equals(other.label))
100             return false;
101         if (name == null) {
102             if (other.name != null)
103                 return false;
104         } else if (!name.equals(other.name))
105             return false;
106         if (numberType == null) {
107             if (other.numberType != null)
108                 return false;
109         } else if (!numberType.equals(other.numberType))
110             return false;
111         if (resource == null) {
112             if (other.resource != null)
113                 return false;
114         } else if (!resource.equals(other.resource))
115             return false;
116         if (sectionSpecificData == null) {
117             if (other.sectionSpecificData != null)
118                 return false;
119         } else if (!sectionSpecificData.equals(other.sectionSpecificData))
120             return false;
121         if (type == null) {
122             if (other.type != null)
123                 return false;
124         } else if (!type.equals(other.type))
125             return false;
126         if (unit == null) {
127             if (other.unit != null)
128                 return false;
129         } else if (!unit.equals(other.unit))
130             return false;
131         if (valid == null) {
132             if (other.valid != null)
133                 return false;
134         } else if (!valid.equals(other.valid))
135             return false;
136         return true;
137     }
138     
139     
140 }