io.magentys.cinnamon.webdriver.conditions.OrCondition Maven / Gradle / Ivy
package io.magentys.cinnamon.webdriver.conditions;
import io.magentys.cinnamon.webdriver.conditions.Condition;
import java.util.Arrays;
public class OrCondition extends Condition {
private final Condition[] conditions;
@SafeVarargs
public OrCondition(final Condition... conditions) {
this.conditions = conditions;
}
@Override
public boolean apply(final T t) {
try {
for (final Condition condition : conditions) {
if (condition.apply(t))
return true;
}
return false;
} catch (Exception e) {
return false;
}
}
@Override
public String toString() {
return "or(" + Arrays.toString(conditions) + ")";
}
}