1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
16 public class ImportReference extends ASTNode {
18 public char[][] tokens;
19 public long[] sourcePositions; //each entry is using the code : (start<<32) + end
20 public boolean onDemand = true; //most of the time
21 public int declarationEnd; // doesn't include an potential trailing comment
22 public int declarationSourceStart;
23 public int declarationSourceEnd;
25 public int modifiers; // 1.5 addition for static imports
27 public ImportReference(
29 long[] sourcePositions,
34 this.sourcePositions = sourcePositions;
35 this.onDemand = onDemand;
36 this.sourceEnd = (int) (sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
37 this.sourceStart = (int) (sourcePositions[0] >>> 32);
38 this.modifiers = modifiers;
44 public char[][] getImportName() {
49 public StringBuffer print(int indent, StringBuffer output) {
51 return print(indent, output, true);
54 public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) {
56 /* when withOnDemand is false, only the name is printed */
57 for (int i = 0; i < tokens.length; i++) {
58 if (i > 0) output.append('.');
59 output.append(tokens[i]);
61 if (withOnDemand && onDemand) {
62 output.append(".*"); //$NON-NLS-1$
67 public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
69 visitor.visit(this, scope);
70 visitor.endVisit(this, scope);