3 * Copyright 2000-2009 JetBrains s.r.o.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package com
.intellij
.psi
.impl
.search
;
20 import com
.intellij
.openapi
.util
.TextRange
;
21 import com
.intellij
.psi
.PsiFile
;
22 import com
.intellij
.psi
.search
.TodoItem
;
23 import com
.intellij
.psi
.search
.TodoPattern
;
25 public class TodoItemImpl
implements TodoItem
{
26 private final PsiFile myFile
;
27 private final int myStartOffset
;
28 private final int myEndOffset
;
29 private final TodoPattern myPattern
;
31 public TodoItemImpl(PsiFile file
, int startOffset
, int endOffset
, TodoPattern pattern
) {
33 myStartOffset
= startOffset
;
34 myEndOffset
= endOffset
;
38 public PsiFile
getFile() {
42 public TextRange
getTextRange() {
43 return new TextRange(myStartOffset
, myEndOffset
);
46 public TodoPattern
getPattern() {
50 public int hashCode(){
51 return myFile
.hashCode()+myStartOffset
+myEndOffset
+myPattern
.hashCode();
54 public boolean equals(Object obj
){
55 if(!(obj
instanceof TodoItemImpl
)){
58 TodoItemImpl todoItem
=(TodoItemImpl
)obj
;
60 !myFile
.equals(todoItem
.myFile
)||
61 myStartOffset
!=todoItem
.myStartOffset
||
62 myEndOffset
!=todoItem
.myEndOffset
||
63 !myPattern
.equals(todoItem
.myPattern
)