Makefile fixup
[org.ibex.tool.git] / repo / org.ibex.tool / src / org / eclipse / jdt / internal / compiler / ast / ImportReference.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
12
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
15
16 public class ImportReference extends ASTNode {
17
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;
24         public boolean used;
25         public int modifiers; // 1.5 addition for static imports
26
27         public ImportReference(
28                         char[][] tokens,
29                         long[] sourcePositions,
30                         boolean onDemand,
31                         int modifiers) {
32
33                 this.tokens = tokens;
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;
39         }
40
41         /**
42          * @return char[][]
43          */
44         public char[][] getImportName() {
45
46                 return tokens;
47         }
48
49         public StringBuffer print(int indent, StringBuffer output) {
50
51                 return print(indent, output, true);
52         }
53
54         public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) {
55
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]);
60                 }
61                 if (withOnDemand && onDemand) {
62                         output.append(".*"); //$NON-NLS-1$
63                 }
64                 return output;
65         }
66
67         public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
68
69                 visitor.visit(this, scope);
70                 visitor.endVisit(this, scope);
71         }
72 }