]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/exceptions/Problem.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / types / exceptions / Problem.java
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/exceptions/Problem.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/exceptions/Problem.java
new file mode 100644 (file)
index 0000000..1be0c23
--- /dev/null
@@ -0,0 +1,72 @@
+package org.simantics.scl.compiler.types.exceptions;
+
+public class Problem {
+    int start;
+    int end;
+    String description;
+
+    public Problem(int start, int end, String description) {
+        this.start = start;
+        this.end = end;
+        this.description = description;
+    }
+    
+    public int getStart() {
+        return start;
+    }
+    
+    public int getEnd() {
+        return end;
+    }
+    
+    public String getDescription() {
+        return description;
+    }    
+    
+    @Override
+    public String toString() {
+        StringBuilder b = new StringBuilder();
+        toString(b);
+        return b.toString();
+    }
+
+    void toString(StringBuilder b) {
+        b.append(start);
+        b.append("-");
+        b.append(end);
+        b.append(": ");
+        b.append(description);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((description == null) ? 0 : description.hashCode());
+        result = prime * result + end;
+        result = prime * result + start;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Problem other = (Problem) obj;
+        if (description == null) {
+            if (other.description != null)
+                return false;
+        } else if (!description.equals(other.description))
+            return false;
+        if (end != other.end)
+            return false;
+        if (start != other.start)
+            return false;
+        return true;
+    }
+}