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

com.harium.suneidesis.linguistic.matcher.Or Maven / Gradle / Ivy

The newest version!
package com.harium.suneidesis.linguistic.matcher;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Or implements Matcher {

    protected List matchers = new ArrayList<>();

    public Or(List matchers) {
        this.matchers.addAll(matchers);
    }

    public Or(Matcher... matchers) {
        this.matchers.addAll(Arrays.asList(matchers));
    }

    @Override
    public boolean matches(String[] tokens) {
        if (matchers.isEmpty()) {
            return true;
        }

        for (Matcher matcher : matchers) {
            if (matcher.matches(tokens)) {
                return true;
            }
        }

        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy