]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/ComponentTypeScriptResult.java
Sync git svn branch with SVN repository r33366.
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / ComponentTypeScriptResult.java
1 package org.simantics.modeling;\r
2 \r
3 import java.util.List;\r
4 import java.util.Set;\r
5 \r
6 import org.simantics.scl.compiler.errors.CompilationError;\r
7 \r
8 public class ComponentTypeScriptResult {\r
9 \r
10     private List<CompilationError> errors;\r
11     private Object value;\r
12 \r
13     private Set<String> moduleReads;\r
14     private Set<String> moduleWrites;\r
15     \r
16     public ComponentTypeScriptResult(List<CompilationError> errors, Object value) {\r
17         this(errors, value, null, null);\r
18     }\r
19     \r
20     public ComponentTypeScriptResult(List<CompilationError> errors, Object value, Set<String> moduleReads, Set<String> moduleWrites) {\r
21         this.errors = errors;\r
22         this.value = value;\r
23         this.moduleReads = moduleReads;\r
24         this.moduleWrites = moduleWrites;\r
25     }\r
26     \r
27     public List<CompilationError> getErrors() {\r
28         return errors;\r
29     }\r
30     \r
31     public Object getValue() {\r
32         return value;\r
33     }\r
34     \r
35     public Set<String> getModuleReads() {\r
36         return moduleReads;\r
37     }\r
38     \r
39     public Set<String> getModuleWrites() {\r
40         return moduleWrites;\r
41     }\r
42     \r
43     @Override\r
44     public int hashCode() {\r
45         final int prime = 31;\r
46         int result = 1;\r
47         result = prime * result + ((errors == null) ? 0 : errors.hashCode());\r
48         result = prime * result\r
49                 + ((moduleReads == null) ? 0 : moduleReads.hashCode());\r
50         result = prime * result\r
51                 + ((moduleWrites == null) ? 0 : moduleWrites.hashCode());\r
52         result = prime * result + ((value == null) ? 0 : value.hashCode());\r
53         return result;\r
54     }\r
55 \r
56     @Override\r
57     public boolean equals(Object obj) {\r
58         if (this == obj)\r
59             return true;\r
60         if (obj == null)\r
61             return false;\r
62         if (getClass() != obj.getClass())\r
63             return false;\r
64         ComponentTypeScriptResult other = (ComponentTypeScriptResult) obj;\r
65         if (errors == null) {\r
66             if (other.errors != null)\r
67                 return false;\r
68         } else if (!errors.equals(other.errors))\r
69             return false;\r
70         if (moduleReads == null) {\r
71             if (other.moduleReads != null)\r
72                 return false;\r
73         } else if (!moduleReads.equals(other.moduleReads))\r
74             return false;\r
75         if (moduleWrites == null) {\r
76             if (other.moduleWrites != null)\r
77                 return false;\r
78         } else if (!moduleWrites.equals(other.moduleWrites))\r
79             return false;\r
80         if (value == null) {\r
81             if (other.value != null)\r
82                 return false;\r
83         } else if (!value.equals(other.value))\r
84             return false;\r
85         return true;\r
86     }\r
87 \r
88 }\r