]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.issues.common/src/org/simantics/issues/common/SimpleIssue.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.issues.common / src / org / simantics / issues / common / SimpleIssue.java
1 package org.simantics.issues.common;
2
3 import org.simantics.db.Resource;
4 import org.simantics.issues.Severity;
5
6
7 public class SimpleIssue {
8     public static final SimpleIssue[] EMPTY_ARRAY = new SimpleIssue[0];
9     
10     public final String label;
11     public final Severity severity;
12     // Optional, not used for equals/hashCode
13     public final Resource issueResource;
14     
15     public SimpleIssue(String label, Severity severity) {
16         this(label, severity, null);
17     }
18     
19     public SimpleIssue(String label, Severity severity, Resource issueResource) {
20         if(label == null)
21             throw new NullPointerException();
22         if(severity == null)
23             throw new NullPointerException();
24         this.label = label;
25         this.severity = severity;
26         this.issueResource = issueResource;
27     }
28
29     @Override
30     public int hashCode() {
31         return 31*label.hashCode() + severity.hashCode();
32     }
33
34     @Override
35     public boolean equals(Object obj) {
36         if (this == obj)
37             return true;
38         if (obj == null)
39             return false;
40         if (getClass() != obj.getClass())
41             return false;
42         SimpleIssue other = (SimpleIssue) obj;
43         return severity.equals(other.severity) && label.equals(other.label);                
44     }
45 }