ce10dac89ff0fc46cfc5941cdf4f62e1382b62b3
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / ImportReference.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 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 net.sourceforge.phpeclipse.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
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 final char[] includeSource;
22         public int declarationEnd;// doesn't include an potential trailing comment
23         public int declarationSourceStart;
24         public int declarationSourceEnd;
25         public boolean used;
26
27 public ImportReference(char[] sourceString, int start, int end, boolean d) { // char[][] sources , long[] poss , boolean d) {
28 //      tokens = sources ;
29 //      sourcePositions = poss ;
30     includeSource = sourceString;
31         onDemand = d;
32         sourceEnd = end;//(int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
33         sourceStart = start;//(int)(sourcePositions[0]>>>32) ;
34 }
35 /**
36  * @return char[][]
37  */
38 //public char[][] getImportName() {
39 //      return tokens;
40 //}
41
42 public char[] getIncludeName() {
43 return includeSource;
44 }
45 public String toString(int tab ){
46
47         return toString(tab,true);
48 }
49 public String toString(int tab, boolean withOnDemand) {
50         /* when withOnDemand is false, only the name is printed */
51 //      StringBuffer buffer = new StringBuffer();
52 //      for (int i = 0; i < tokens.length; i++) {
53 //              buffer.append(tokens[i]);
54 //              if (i < (tokens.length - 1)) {
55 //                      buffer.append("."); //$NON-NLS-1$
56 //              }
57 //      }
58 //      if (withOnDemand && onDemand) {
59 //              buffer.append(".*"); //$NON-NLS-1$
60 //      }
61 //      return buffer.toString();
62     return new String(includeSource);
63 }
64 public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
65         visitor.visit(this, scope);
66         visitor.endVisit(this, scope);
67 }
68 }