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