-package org.simantics.structural2.queries;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class Terminal {\r
-\r
- private final Resource component;\r
- private final Resource relation;\r
-\r
- private final int hash;\r
-\r
- public Terminal(Resource component, Resource relation) {\r
- this.component = component;\r
- this.relation = relation;\r
- this.hash = makeHash();\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null)\r
- return false;\r
- if (!(obj.getClass().equals(this.getClass())))\r
- return false;\r
- Terminal other = (Terminal) obj;\r
- return component.equals(other.component) && relation.equals(other.relation);\r
- }\r
-\r
- public Resource getComponent() {\r
- return component;\r
- }\r
-\r
- public Resource getRelation() {\r
- return relation;\r
- }\r
-\r
- private int makeHash() {\r
- return component.hashCode() + relation.hashCode() * 31;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- return hash;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return component + " " + relation;\r
- }\r
-\r
- public String toString(ReadGraph graph) throws DatabaseException {\r
- return NameUtils.getSafeName(graph, component) + " " + NameUtils.getSafeName(graph, relation);\r
- }\r
-\r
-}\r
+package org.simantics.structural2.queries;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.utils.NameUtils;
+import org.simantics.db.exception.DatabaseException;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class Terminal {
+
+ private final Resource component;
+ private final Resource relation;
+
+ private final int hash;
+
+ public Terminal(Resource component, Resource relation) {
+ this.component = component;
+ this.relation = relation;
+ this.hash = makeHash();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj.getClass().equals(this.getClass())))
+ return false;
+ Terminal other = (Terminal) obj;
+ return component.equals(other.component) && relation.equals(other.relation);
+ }
+
+ public Resource getComponent() {
+ return component;
+ }
+
+ public Resource getRelation() {
+ return relation;
+ }
+
+ private int makeHash() {
+ return component.hashCode() + relation.hashCode() * 31;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ return component + " " + relation;
+ }
+
+ public String toString(ReadGraph graph) throws DatabaseException {
+ return NameUtils.getSafeName(graph, component) + " " + NameUtils.getSafeName(graph, relation);
+ }
+
+}