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

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

package io.magentys.cinnamon.webdriver.conditions;

import io.magentys.cinnamon.webdriver.conditions.Condition;

import java.util.Arrays;

public class AndCondition extends Condition {

    private final Condition[] conditions;

    @SafeVarargs
    public AndCondition(final Condition... conditions) {
        this.conditions = conditions;
    }

    @Override
    public boolean apply(final T t) {
        try {
            for (final Condition condition : conditions) {
                if (!condition.apply(t))
                    return false;
            }
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    @Override
    public String toString() {
        return "and(" + Arrays.toString(conditions) + ")";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy