1 11 package org.eclipse.jdt.internal.compiler.env; 12 13 public class NameEnvironmentAnswer { 14 15 IBinaryType binaryType; 17 ICompilationUnit compilationUnit; 18 ISourceType[] sourceTypes; 19 AccessRestriction accessRestriction; 20 21 public NameEnvironmentAnswer(IBinaryType binaryType, AccessRestriction accessRestriction) { 22 this.binaryType = binaryType; 23 this.accessRestriction = accessRestriction; 24 } 25 26 public NameEnvironmentAnswer(ICompilationUnit compilationUnit, AccessRestriction accessRestriction) { 27 this.compilationUnit = compilationUnit; 28 this.accessRestriction = accessRestriction; 29 } 30 31 public NameEnvironmentAnswer(ISourceType[] sourceTypes, AccessRestriction accessRestriction) { 32 this.sourceTypes = sourceTypes; 33 this.accessRestriction = accessRestriction; 34 } 35 38 public AccessRestriction getAccessRestriction() { 39 return this.accessRestriction; 40 } 41 45 public IBinaryType getBinaryType() { 46 return this.binaryType; 47 } 48 49 53 public ICompilationUnit getCompilationUnit() { 54 return this.compilationUnit; 55 } 56 57 64 public ISourceType[] getSourceTypes() { 65 return this.sourceTypes; 66 } 67 68 71 public boolean isBinaryType() { 72 return this.binaryType != null; 73 } 74 75 78 public boolean isCompilationUnit() { 79 return this.compilationUnit != null; 80 } 81 82 85 public boolean isSourceType() { 86 return this.sourceTypes != null; 87 } 88 89 public boolean ignoreIfBetter() { 90 return this.accessRestriction != null && this.accessRestriction.ignoreIfBetter(); 91 } 92 93 98 public boolean isBetter(NameEnvironmentAnswer otherAnswer) { 99 if (otherAnswer == null) return true; 100 if (this.accessRestriction == null) return true; 101 return otherAnswer.accessRestriction != null 102 && this.accessRestriction.getProblemId() < otherAnswer.accessRestriction.getProblemId(); 103 } 104 } 105 | Popular Tags |