1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.ASTVisitor; 14 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; 15 import org.eclipse.jdt.internal.compiler.lookup.*; 16 17 public class ImportReference extends ASTNode { 18 19 public char[][] tokens; 20 public long[] sourcePositions; public int declarationEnd; public int declarationSourceStart; 23 public int declarationSourceEnd; 24 public int modifiers; public Annotation[] annotations; 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 if (onDemand) { 36 this.bits |= ASTNode.OnDemand; 37 } 38 this.sourceEnd = (int) (sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF); 39 this.sourceStart = (int) (sourcePositions[0] >>> 32); 40 this.modifiers = modifiers; 41 } 42 43 public boolean isStatic() { 44 return (this.modifiers & ClassFileConstants.AccStatic) != 0; 45 } 46 47 50 public char[][] getImportName() { 51 52 return tokens; 53 } 54 55 public StringBuffer print(int indent, StringBuffer output) { 56 57 return print(indent, output, true); 58 } 59 60 public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) { 61 62 63 for (int i = 0; i < tokens.length; i++) { 64 if (i > 0) output.append('.'); 65 output.append(tokens[i]); 66 } 67 if (withOnDemand && ((this.bits & ASTNode.OnDemand) != 0)) { 68 output.append(".*"); } 70 return output; 71 } 72 73 public void traverse(ASTVisitor visitor, CompilationUnitScope scope) { 74 visitor.visit(this, scope); 76 visitor.endVisit(this, scope); 77 } 78 } 79 | Popular Tags |