update copyrights
[fedora-idea.git] / platform / lang-impl / src / com / intellij / extapi / psi / StubPath.java
blob3ba3c7b77b211e803b2f76e682072bfba86e7cef
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author max
20 package com.intellij.extapi.psi;
22 import com.intellij.psi.tree.IElementType;
24 public class StubPath {
25 private final StubPath myParentPath;
26 private final String myId;
27 private final IElementType myType;
30 public StubPath(final StubPath parentPath, final String id, final IElementType type) {
31 myParentPath = parentPath;
32 myId = id;
33 myType = type;
36 public StubPath getParentPath() {
37 return myParentPath;
41 public String getId() {
42 return myId;
45 public IElementType getType() {
46 return myType;
49 public boolean equals(final Object o) {
50 if (this == o) return true;
51 if (!(o instanceof StubPath)) return false;
53 final StubPath stubPath = (StubPath)o;
55 if (!myId.equals(stubPath.myId)) return false;
56 if (myParentPath != null ? !myParentPath.equals(stubPath.myParentPath) : stubPath.myParentPath != null) return false;
57 if (!myType.equals(stubPath.myType)) return false;
59 return true;
62 public int hashCode() {
63 int result = (myParentPath != null ? myParentPath.hashCode() : 0);
64 result = 31 * result + myId.hashCode();
65 result = 31 * result + myType.hashCode();
66 return result;
69 public String toString() {
70 return new StringBuilder().
71 append(myParentPath != null ? myParentPath.toString() : "").
72 append("::(").
73 append(myType.toString()).
74 append(":").
75 append(myId).
76 append(")").toString();