All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.magentys.cinnamon.webdriver.conditions.OrCondition Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
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) + ")";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy