]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.graph/src/org/simantics/graph/query/PathRoot.java
Option for exporting tg and pgraph with sharedlibrary
[simantics/platform.git] / bundles / org.simantics.graph / src / org / simantics / graph / query / PathRoot.java
1 package org.simantics.graph.query;
2
3 public class PathRoot implements Path {
4         public final String name;
5
6         public PathRoot(String name) {
7                 this.name = name;
8         }
9         
10         @Override
11         public int hashCode() {
12                 final int prime = 31;
13                 int result = 1;
14                 result = prime * result + ((name == null) ? 0 : name.hashCode());
15                 return result;
16         }
17
18
19         @Override
20         public boolean equals(Object obj) {
21                 if (this == obj)
22                         return true;
23                 if (obj == null)
24                         return false;
25                 if (getClass() != obj.getClass())
26                         return false;
27                 PathRoot other = (PathRoot) obj;
28                 if (name == null) {
29                         if (other.name != null)
30                                 return false;
31                 } else if (!name.equals(other.name))
32                         return false;
33                 return true;
34         }
35
36         @Override
37         public String toString() {
38                 if(name.isEmpty())
39                         return "http:/";
40                 else
41                         return name;
42         }
43         
44         @Override
45         public void toString(StringBuilder b) {
46                 if(name.isEmpty())
47                         b.append("http:/");
48                 else
49                         b.append(name);
50         }
51         
52         @Override
53         public Path child(String childName) {
54                 return new PathChild(childName, this);
55         }       
56 }