Class StringReplacer


  • public class StringReplacer
    extends java.lang.Object
    An algorithm that replaces strings across all paths of an automaton.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RegexAutomaton replace​(java.lang.String toReplace, RegexAutomaton str, boolean must)
      Yields a new automaton where every occurrence of toReplace have been replaced with str.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringReplacer

        public StringReplacer​(RegexAutomaton origin)
        Builds the replacer. For this algorithm to work correctly, the target automaton is first exploded with a call to RegexAutomaton.explode().
        Parameters:
        origin - the target automaton
    • Method Detail

      • replace

        public RegexAutomaton replace​(java.lang.String toReplace,
                                      RegexAutomaton str,
                                      boolean must)
        Yields a new automaton where every occurrence of toReplace have been replaced with str. If must is true, then this method effectively replaces toReplace. Otherwise, a may-replacement is perfomed, meaning that toReplaced is replaced with toReplace || str.
        Parameters:
        toReplace - the string to replace
        str - the automaton to use as a replacement
        must - whether or not a must-replacement has to be made
        Returns:
        the replaced automaton