public static class Answer { public IType type; AccessRestriction restriction; Answer(IType type, AccessRestriction restriction) { this.type = type; this.restriction = restriction; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
public static class Answer { public IType type; AccessRestriction restriction; Answer(IType type, AccessRestriction restriction) { this.type = type; this.restriction = restriction; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
public static class Answer { public IType type; AccessRestriction restriction; Answer(IType type, AccessRestriction restriction) { this.type = type; this.restriction = restriction; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
/** * Returns the first type in the given package whose name * matches the given (unqualified) name, or <code>null</code> if none * exist. Specifying a <code>null</code> package will result in no matches. * The domain of the search is bounded by the Java project from which * this name lookup was obtained. * * @param name the name of the type to find * @param pkg the package to search * @param partialMatch partial name matches qualify when <code>true</code>, * only exact name matches qualify when <code>false</code> * @param acceptFlags a bit mask describing if classes, interfaces or both classes and interfaces * are desired results. If no flags are specified, all types are returned. * @param considerSecondaryTypes flag to know whether secondary types has to be considered * during the search * * @see #ACCEPT_CLASSES * @see #ACCEPT_INTERFACES * @see #ACCEPT_ENUMS * @see #ACCEPT_ANNOTATIONS */ public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes) { IType type = findType(name, pkg, partialMatch, acceptFlags); if (type == null && considerSecondaryTypes) { type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), false, null); } return type; }
public static class Answer { public IType type; AccessRestriction restriction; IClasspathEntry entry; Answer(IType type, AccessRestriction restriction, IClasspathEntry entry) { this.type = type; this.restriction = restriction; this.entry = entry; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
private class Selector implements IJavaElementRequestor { public List<IPackageFragment> pkgFragments; public Selector(String moduleName) { this.pkgFragments = new ArrayList<>(); } @Override public void acceptField(IField field) { // do nothing } @Override public void acceptInitializer(IInitializer initializer) { // do nothing } @Override public void acceptMemberType(IType type) { // do nothing } @Override public void acceptMethod(IMethod method) { // do nothing } @Override public void acceptPackageFragment(IPackageFragment packageFragment) { this.pkgFragments.add(packageFragment);
private class Selector implements IJavaElementRequestor { public List<IPackageFragment> pkgFragments; public Selector(String moduleName) { this.pkgFragments = new ArrayList<>(); } @Override public void acceptField(IField field) { // do nothing } @Override public void acceptInitializer(IInitializer initializer) { // do nothing } @Override public void acceptMemberType(IType type) { // do nothing } @Override public void acceptMethod(IMethod method) { // do nothing } @Override public void acceptPackageFragment(IPackageFragment packageFragment) { this.pkgFragments.add(packageFragment);
type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), waitForIndices, null);
type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), waitForIndices, null);
type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), waitForIndices, null);
type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), waitForIndices, null);
type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), waitForIndices, null);