Class SpecialOperations


  • public final class SpecialOperations
    extends Object
    Special automata operations.
    • Method Detail

      • 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.
      • overlap

        public static Automaton overlap​(Automaton a1,
                                        Automaton a2)
        Returns an automaton that accepts the overlap of strings that in more than one way can be split into a left part being accepted by a1 and a right part being accepted by a2.
      • trim

        public static Automaton trim​(Automaton a,
                                     String set,
                                     char c)
        Returns an automaton that accepts the trimmed language of the given automaton. The resulting automaton is constructed as follows: 1) Whenever a c character is allowed in the original automaton, one or more set characters are allowed in the new automaton. 2) The automaton is prefixed and postfixed with any number of set characters.
        Parameters:
        set - set of characters to be trimmed
        c - canonical trim character (assumed to be in set)
      • compress

        public static Automaton compress​(Automaton a,
                                         String set,
                                         char c)
        Returns an automaton that accepts the compressed language of the given automaton. Whenever a c character is allowed in the original automaton, one or more set characters are allowed in the new automaton.
        Parameters:
        set - set of characters to be compressed
        c - canonical compress character (assumed to be in set)
      • subst

        public static Automaton subst​(Automaton a,
                                      Map<Character,​Set<Character>> map)
        Returns an automaton where all transition labels have been substituted.

        Each transition labeled c is changed to a set of transitions, one for each character in map(c). If map(c) is null, then the transition is unchanged.

        Parameters:
        map - map from characters to sets of characters (where characters are Character objects)
      • subst

        public static Automaton subst​(Automaton a,
                                      char c,
                                      String s)
        Returns an automaton where all transitions of the given char are replaced by a string.
        Parameters:
        c - char
        s - string
        Returns:
        new automaton
      • 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