if (spec != null && spec.test(hostnameRequirement).isMatch() && d.test(requirements)) { domain = d; break;
/** * Returns {@code true} if and only if the supplied {@link DomainRequirement}s are a match for this {@link Domain}. * * @param requirements the {@link DomainRequirement}s to test. * @return {@code true} if and only if the supplied {@link DomainRequirement}s are a match for this {@link Domain}. */ public boolean test(@NonNull List<DomainRequirement> requirements) { for (DomainRequirement scope : requirements) { if (scope == null) { continue; } for (DomainSpecification matcher : specifications) { DomainSpecification.Result result = matcher.test(scope); if (result.isDefinitive()) { if (result.isMatch()) { // we have matched this scope => continue with next scope break; } else { // we have a non-test => done return false; } } // continue as nothing is definitive } } // must be a test return true; }
/** * Returns {@code true} if and only if the supplied {@link DomainRequirement}s are a match for this {@link Domain}. * * @param requirements the {@link DomainRequirement}s to test. * @return {@code true} if and only if the supplied {@link DomainRequirement}s are a match for this {@link Domain}. */ public boolean test(@NonNull List<DomainRequirement> requirements) { for (DomainRequirement scope : requirements) { if (scope == null) { continue; } for (DomainSpecification matcher : specifications) { DomainSpecification.Result result = matcher.test(scope); if (result.isDefinitive()) { if (result.isMatch()) { // we have matched this scope => continue with next scope break; } else { // we have a non-test => done return false; } } // continue as nothing is definitive } } // must be a test return true; }