org.apache.lucene.util.automaton

## Class SpecialOperations

- java.lang.Object
- - org.apache.lucene.util.automaton.SpecialOperations

    public final class SpecialOperations
    extends Object

Special automata operations.

WARNING: This API is experimental and might change in incompatible ways in the next release.

### Method Summary

Methods
`static String` `getCommonPrefix(Automaton a)` Returns the longest string that is a prefix of all accepted strings and visits each state at most once.
`static BytesRef` `getCommonPrefixBytesRef(Automaton a)`
`static String` `getCommonSuffix(Automaton a)` Returns the longest string that is a suffix of all accepted strings and visits each state at most once.
`static BytesRef` `getCommonSuffixBytesRef(Automaton a)`
`static Set<IntsRef>` `getFiniteStrings(Automaton a, int limit)` Returns the set of accepted strings, assuming that at most `limit` strings are accepted.
`static boolean` `isFinite(Automaton a)` Returns true if the language of this automaton is finite.
`static Set<State>` `reverse(Automaton a)` Reverses the language of the given (non-singleton) automaton while returning the set of new initial states.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### isFinite

    public static boolean isFinite(Automaton a)

Returns true if the language of this automaton is finite.

#### getCommonPrefix

    public static String getCommonPrefix(Automaton a)

Returns the longest string that is a prefix of all accepted strings and visits each state at most once.

Returns:
  common prefix

#### getCommonPrefixBytesRef

    public static BytesRef getCommonPrefixBytesRef(Automaton a)

#### getCommonSuffix

    public static String getCommonSuffix(Automaton a)

Returns the longest string that is a suffix of all accepted strings and visits each state at most once.

Returns:
  common suffix

#### getCommonSuffixBytesRef

    public static BytesRef getCommonSuffixBytesRef(Automaton a)

#### reverse

    public static Set<State> reverse(Automaton a)

Reverses the language of the given (non-singleton) automaton while returning the set of new initial states.

#### getFiniteStrings

    public static Set<IntsRef> getFiniteStrings(Automaton a,
                                int limit)

Returns the set of accepted strings, assuming that at most `limit` strings are accepted. If more than `limit` strings are accepted, null is returned. If `limit`<0, then the limit is infinite.