-package org.simantics.graph.query;\r
-\r
-import org.simantics.databoard.util.URIStringUtils;\r
-\r
-\r
-public class PathChild implements Path {\r
- public final String name;\r
- public final Path parent;\r
- \r
- public PathChild(String name, Path parent) {\r
- if(parent == null)\r
- System.out.println("ERR");\r
- this.name = name;\r
- this.parent = parent;\r
- }\r
- \r
- @Override\r
- public int hashCode() {\r
- return name.hashCode() + (parent == null ? 0 : 31 * parent.hashCode());\r
- }\r
- \r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null || getClass() != obj.getClass())\r
- return false;\r
- PathChild other = (PathChild) obj;\r
- return name.equals(other.name) &&\r
- (parent == null ? other.parent == null : parent.equals(other.parent)); \r
- }\r
- \r
- @Override\r
- public String toString() {\r
- StringBuilder b = new StringBuilder();\r
- toString(b);\r
- return b.toString();\r
- }\r
-\r
- public void toString(StringBuilder b) {\r
- if(parent == null)\r
- b.append("http:/");\r
- else\r
- parent.toString(b);\r
- b.append("/");\r
- b.append(URIStringUtils.escape(name));\r
- }\r
- \r
- @Override\r
- public Path child(String childName) {\r
- return new PathChild(childName, this);\r
- }\r
-}\r
+package org.simantics.graph.query;
+
+import org.simantics.databoard.util.URIStringUtils;
+
+
+public class PathChild implements Path {
+ public final String name;
+ public final Path parent;
+
+ public PathChild(String name, Path parent) {
+ if(parent == null)
+ System.out.println("ERR");
+ this.name = name;
+ this.parent = parent;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode() + (parent == null ? 0 : 31 * parent.hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ PathChild other = (PathChild) obj;
+ return name.equals(other.name) &&
+ (parent == null ? other.parent == null : parent.equals(other.parent));
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder b = new StringBuilder();
+ toString(b);
+ return b.toString();
+ }
+
+ public void toString(StringBuilder b) {
+ if(parent == null)
+ b.append("http:/");
+ else
+ parent.toString(b);
+ b.append("/");
+ b.append(URIStringUtils.escape(name));
+ }
+
+ @Override
+ public Path child(String childName) {
+ return new PathChild(childName, this);
+ }
+}