X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fquery%2FPathChild.java;h=0b789f70d93ba161677bbff743ebabb623996861;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=bb354c3167e7c941d01f0ab9b4cebdc0851323a6;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/query/PathChild.java b/bundles/org.simantics.graph/src/org/simantics/graph/query/PathChild.java index bb354c316..0b789f70d 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/query/PathChild.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/query/PathChild.java @@ -1,53 +1,53 @@ -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); - } -} +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); + } +}