KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > search > FieldReferenceMatch


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core.search;
12
13 import org.eclipse.core.resources.IResource;
14 import org.eclipse.jdt.core.IJavaElement;
15
16 /**
17  * A Java search match that represents a field reference.
18  * The element is the inner-most enclosing member that references this field.
19  * <p>
20  * This class is intended to be instantiated and subclassed by clients.
21  * </p>
22  *
23  * @since 3.0
24  */

25 public class FieldReferenceMatch extends SearchMatch {
26
27     private boolean isReadAccess;
28     private boolean isWriteAccess;
29
30     /**
31      * Creates a new field reference match.
32      *
33      * @param enclosingElement the inner-most enclosing member that references this field
34      * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE}
35      * @param offset the offset the match starts at, or -1 if unknown
36      * @param length the length of the match, or -1 if unknown
37      * @param isReadAccess whether the match represents a read access
38      * @param isWriteAccess whethre the match represents a write access
39      * @param insideDocComment <code>true</code> if this search match is inside a doc
40      * comment, and <code>false</code> otherwise
41      * @param participant the search participant that created the match
42      * @param resource the resource of the element
43      */

44     public FieldReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean isReadAccess, boolean isWriteAccess, boolean insideDocComment, SearchParticipant participant, IResource resource) {
45         super(enclosingElement, accuracy, offset, length, participant, resource);
46         this.isReadAccess = isReadAccess;
47         this.isWriteAccess = isWriteAccess;
48         setInsideDocComment(insideDocComment);
49     }
50     
51     /**
52      * Returns whether the field reference is a read access to the field.
53      * Note that a field reference can be read and written at once in case of compound assignments (e.g. i += 0;)
54      *
55      * @return whether the field reference is a read access to the field.
56      */

57     public final boolean isReadAccess() {
58         return this.isReadAccess;
59     }
60
61     /**
62      * Returns whether the field reference is a write access to the field.
63      * Note that a field reference can be read and written at once in case of compound assignments (e.g. i += 0;)
64      *
65      * @return whether the field reference is a write access to the field.
66      */

67     public final boolean isWriteAccess() {
68         return this.isWriteAccess;
69     }
70     
71 }
72
Popular Tags