IDEADEV-27103
[fedora-idea.git] / lang-impl / src / com / intellij / psi / impl / search / IndexPatternOccurrenceImpl.java
blob7855a86f81d2ec70c7034567844978df7d0134a3
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;
9 /**
10 * @author yole
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) {
19 myFile = file;
20 myStartOffset = startOffset;
21 myEndOffset = endOffset;
22 myPattern = pattern;
25 @NotNull
26 public PsiFile getFile() {
27 return myFile;
30 @NotNull
31 public TextRange getTextRange() {
32 return new TextRange(myStartOffset, myEndOffset);
35 @NotNull
36 public IndexPattern getPattern() {
37 return myPattern;
40 public int hashCode(){
41 return myFile.hashCode()+myStartOffset+myEndOffset+myPattern.hashCode();
44 public boolean equals(Object obj){
45 if(!(obj instanceof IndexPatternOccurrenceImpl)){
46 return false;
48 IndexPatternOccurrenceImpl todoItem=(IndexPatternOccurrenceImpl)obj;
49 return myFile.equals(todoItem.myFile) &&
50 myStartOffset == todoItem.myStartOffset &&
51 myEndOffset == todoItem.myEndOffset &&
52 myPattern.equals(todoItem.myPattern);