net.avcompris.commons.query.impl.OrProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of avc-commons3-query Show documentation
Show all versions of avc-commons3-query Show documentation
Common classes for avc-commons3 queries and filtering.
package net.avcompris.commons.query.impl;
import static net.avcompris.commons.query.Filtering.Type.OR;
import java.util.Arrays;
import net.avcompris.commons.query.Filtering;
import net.avcompris.commons.query.FilteringHandler;
import net.avcompris.commons.query.Or;
final class OrProxy, U extends Filtering.Field> extends AbstractConnectorProxy
implements Or {
public OrProxy(final Class extends T> filteringClass, final Filtering[] fs) {
super(filteringClass, "or", fs);
}
public OrProxy(final Class extends T> filteringClass, final Filtering f1, final Filtering f2) {
super(filteringClass, "or", f1, f2);
}
public OrProxy(final Class extends T> filteringClass, final Filtering f, final Filtering[] fs) {
super(filteringClass, "or", f, fs);
}
public OrProxy(final Class extends T> filteringClass, final Filtering[] fs1, final Filtering[] fs2) {
super(filteringClass, "or", fs1, fs2);
}
public OrProxy(final Class extends T> filteringClass, final Filtering[] fs, final Filtering f) {
super(filteringClass, "or", fs, f);
}
@Override
public boolean match(final Object arg) {
for (final Filtering f : fs) {
if (f.match(arg)) {
return true;
}
}
return false;
}
@Override
public void applyTo(final FilteringHandler handler) {
for (final Filtering f : fs) {
final FilteringHandler subHandler = handler.newOrMember();
f.applyTo(subHandler);
}
}
@Override
public Type getType() {
return OR;
}
@Override
public Filtering[] getArgs() {
return Arrays.copyOf(fs, fs.length);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy