Example usage for org.apache.lucene.util.automaton Operations union

List of usage examples for org.apache.lucene.util.automaton Operations union

Introduction

In this page you can find the example usage for org.apache.lucene.util.automaton Operations union.

Prototype

public static Automaton union(Collection<Automaton> l) 

Source Link

Document

Returns an automaton that accepts the union of the languages of the given automata.

Usage

From source file:org.codelibs.elasticsearch.common.regex.Regex.java

License:Apache License

/**
 * Return an Automaton that matches the union of the provided patterns.
 *///from  www .ja v  a2s.  co m
public static Automaton simpleMatchToAutomaton(String... patterns) {
    if (patterns.length < 1) {
        throw new IllegalArgumentException("There must be at least one pattern, zero given");
    }
    List<Automaton> automata = new ArrayList<>();
    for (String pattern : patterns) {
        automata.add(simpleMatchToAutomaton(pattern));
    }
    return Operations.union(automata);
}