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.
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
;
36 public StubPath
getParentPath() {
41 public String
getId() {
45 public IElementType
getType() {
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;
62 public int hashCode() {
63 int result
= (myParentPath
!= null ? myParentPath
.hashCode() : 0);
64 result
= 31 * result
+ myId
.hashCode();
65 result
= 31 * result
+ myType
.hashCode();
69 public String
toString() {
70 return new StringBuilder().
71 append(myParentPath
!= null ? myParentPath
.toString() : "").
73 append(myType
.toString()).
76 append(")").toString();