Class StringReplacer
- java.lang.Object
-
- it.unive.lisa.analysis.string.tarsis.StringReplacer
-
public class StringReplacer extends java.lang.Object
An algorithm that replaces strings across all paths of an automaton.
-
-
Constructor Summary
Constructors Constructor Description StringReplacer(RegexAutomaton origin)
Builds the replacer.
-
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 oftoReplace
have been replaced withstr
.
-
-
-
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 toRegexAutomaton.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 oftoReplace
have been replaced withstr
. Ifmust
istrue
, then this method effectively replacestoReplace
. Otherwise, a may-replacement is perfomed, meaning thattoReplaced
is replaced withtoReplace || str
.- Parameters:
toReplace
- the string to replacestr
- the automaton to use as a replacementmust
- whether or not a must-replacement has to be made- Returns:
- the replaced automaton
-
-