1 package com
.intellij
.psi
.impl
.search
;
3 import com
.intellij
.openapi
.util
.TextRange
;
4 import com
.intellij
.psi
.PsiFile
;
5 import com
.intellij
.psi
.search
.IndexPattern
;
6 import com
.intellij
.psi
.search
.IndexPatternOccurrence
;
7 import org
.jetbrains
.annotations
.NotNull
;
12 class IndexPatternOccurrenceImpl
implements IndexPatternOccurrence
{
13 private final PsiFile myFile
;
14 private final int myStartOffset
;
15 private final int myEndOffset
;
16 private final IndexPattern myPattern
;
18 public IndexPatternOccurrenceImpl(PsiFile file
, int startOffset
, int endOffset
, IndexPattern pattern
) {
20 myStartOffset
= startOffset
;
21 myEndOffset
= endOffset
;
26 public PsiFile
getFile() {
31 public TextRange
getTextRange() {
32 return new TextRange(myStartOffset
, myEndOffset
);
36 public IndexPattern
getPattern() {
40 public int hashCode(){
41 return myFile
.hashCode()+myStartOffset
+myEndOffset
+myPattern
.hashCode();
44 public boolean equals(Object obj
){
45 if(!(obj
instanceof IndexPatternOccurrenceImpl
)){
48 IndexPatternOccurrenceImpl todoItem
=(IndexPatternOccurrenceImpl
)obj
;
49 return myFile
.equals(todoItem
.myFile
) &&
50 myStartOffset
== todoItem
.myStartOffset
&&
51 myEndOffset
== todoItem
.myEndOffset
&&
52 myPattern
.equals(todoItem
.myPattern
);