KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > CompilationUnitElementInfo


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.internal.core;
12
13 import java.util.HashMap JavaDoc;
14
15 import org.eclipse.jdt.core.IJavaElement;
16 import org.eclipse.jdt.core.ISourceRange;
17
18 public class CompilationUnitElementInfo extends OpenableElementInfo {
19
20     /**
21      * The length of this compilation unit's source code <code>String</code>
22      */

23     protected int sourceLength;
24
25     /**
26      * Timestamp of original resource at the time this element
27      * was opened or last updated.
28      */

29     protected long timestamp;
30     
31     /*
32      * The positions of annotations for each element in this compilation unit.
33      * A map from IJavaElement to long[]
34      */

35     public HashMap JavaDoc annotationPositions;
36     
37 public void addAnnotationPositions(IJavaElement handle, long[] positions) {
38     if (positions == null) return;
39     if (this.annotationPositions == null)
40         this.annotationPositions = new HashMap JavaDoc();
41     this.annotationPositions.put(handle, positions);
42 }
43 /**
44  * Returns the length of the source string.
45  */

46 public int getSourceLength() {
47     return this.sourceLength;
48 }
49 protected ISourceRange getSourceRange() {
50     return new SourceRange(0, this.sourceLength);
51 }
52 /**
53  * Sets the length of the source string.
54  */

55 public void setSourceLength(int newSourceLength) {
56     this.sourceLength = newSourceLength;
57 }
58 }
59
Popular Tags