edu.stanford.protege.webprotege.match.AndMatcher Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.match;
import com.google.common.collect.ImmutableList;
import javax.annotation.Nonnull;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 7 Jun 2018
*/
public class AndMatcher implements Matcher {
@Nonnull
private final ImmutableList> matchers;
public AndMatcher(@Nonnull ImmutableList> matchers) {
this.matchers = checkNotNull(matchers);
}
@SafeVarargs
public static AndMatcher get(Matcher ... matchers) {
return new AndMatcher<>(ImmutableList.copyOf(matchers));
}
@Override
public boolean matches(@Nonnull T value) {
return matchers.stream()
.allMatch(m -> m.matches(value));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy