1 /***********************************************************************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
3 * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
4 * http://www.eclipse.org/legal/cpl-v10.html
6 * Contributors: IBM Corporation - initial API and implementation
7 **********************************************************************************************************************************/
8 package net.sourceforge.phpdt.internal.compiler.ast;
10 import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
11 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
13 import org.eclipse.core.resources.IFile;
15 public class ImportReference extends ASTNode {
17 public char[][] tokens;
19 // public long[] sourcePositions; //each entry is using the code :
21 public boolean onDemand = true; // most of the time
23 public final char[] includeSource;
25 public int declarationEnd;// doesn't include an potential trailing comment
27 public int declarationSourceStart;
29 public int declarationSourceEnd;
35 public ImportReference(char[][] sources, char[] sourceString, int start,
36 int end, boolean d) { // char[][] sources , long[] poss ,
39 // sourcePositions = poss ;
40 includeSource = sourceString;
42 sourceEnd = end;// (int)(sourcePositions[sourcePositions.length-1] &
43 // 0x00000000FFFFFFFF);
44 sourceStart = start;// (int)(sourcePositions[0]>>>32) ;
51 public char[][] getImportName() {
55 public char[] getIncludeName() {
59 public StringBuffer print(int indent, StringBuffer output) {
61 return print(indent, output, true);
64 public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) {
66 /* when withOnDemand is false, only the name is printed */
67 for (int i = 0; i < tokens.length; i++) {
70 output.append(tokens[i]);
72 if (withOnDemand && onDemand) {
73 output.append(".*"); //$NON-NLS-1$
78 public String toString(int tab) {
80 return toString(tab, true);
83 public String toString(int tab, boolean withOnDemand) {
84 /* when withOnDemand is false, only the name is printed */
85 StringBuffer buffer = new StringBuffer();
86 for (int i = 0; i < tokens.length; i++) {
87 buffer.append(tokens[i]);
88 if (i < (tokens.length - 1)) {
89 buffer.append("."); //$NON-NLS-1$
92 if (withOnDemand && onDemand) {
93 buffer.append(".*"); //$NON-NLS-1$
96 buffer.append(includeSource);
97 return buffer.toString();
98 // return new String(includeSource);
101 public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
102 visitor.visit(this, scope);
103 visitor.endVisit(this, scope);
107 * @return Returns the filePath.
109 public IFile getFile() {
115 * The filePath to set.
117 public void setFile(IFile filePath) {