Class DebuggingStringFormulaManager
- java.lang.Object
-
- org.sosy_lab.java_smt.delegate.debugging.DebuggingStringFormulaManager
-
- All Implemented Interfaces:
StringFormulaManager
public class DebuggingStringFormulaManager extends Object implements StringFormulaManager
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegexFormulaall()Note: The size of the used alphabet depends on the underlying SMT solver.RegexFormulaallChar()Note: The size of the used alphabet depends on the underlying SMT solver.StringFormulacharAt(StringFormula str, NumeralFormula.IntegerFormula index)Get a substring of length 1 from the given String if the given index is within bounds.RegexFormulaclosure(RegexFormula regex)RegexFormulacomplement(RegexFormula regex)StringFormulaconcat(List<StringFormula> parts)RegexFormulaconcatRegex(List<RegexFormula> parts)BooleanFormulacontains(StringFormula str, StringFormula part)RegexFormulacross(RegexFormula regex)RegexFormuladifference(RegexFormula regex1, RegexFormula regex2)BooleanFormulaequal(StringFormula str1, StringFormula str2)StringFormulafromCodePoint(NumeralFormula.IntegerFormula codepoint)Returns a String formula representing the single character with the given code point, if it is a valid Unicode code point within the Basic Multilingual Plane (BMP) or planes 1 and 2 (codepoints in range [0x00000, 0x2FFFF]).BooleanFormulagreaterOrEquals(StringFormula str1, StringFormula str2)BooleanFormulagreaterThan(StringFormula str1, StringFormula str2)BooleanFormulain(StringFormula str, RegexFormula regex)NumeralFormula.IntegerFormulaindexOf(StringFormula str, StringFormula part, NumeralFormula.IntegerFormula startIndex)Get the first index for a substring in a String, or -1 if the substring is not found.RegexFormulaintersection(RegexFormula regex1, RegexFormula regex2)NumeralFormula.IntegerFormulalength(StringFormula str)BooleanFormulalessOrEquals(StringFormula str1, StringFormula str2)BooleanFormulalessThan(StringFormula str1, StringFormula str2)RegexFormulamakeRegex(String value)Returns aRegexFormularepresenting the given constant.StringFormulamakeString(String value)Creates aStringFormularepresenting the given constant String.StringFormulamakeVariable(String pVar)Creates a variable of type String with exactly the given name.RegexFormulanone()RegexFormulaoptional(RegexFormula regex)BooleanFormulaprefix(StringFormula prefix, StringFormula str)Check whether the given prefix is a real prefix of str.RegexFormularange(StringFormula start, StringFormula end)StringFormulareplace(StringFormula fullStr, StringFormula target, StringFormula replacement)Replace the first appearances of target in fullStr with the replacement.StringFormulareplaceAll(StringFormula fullStr, StringFormula target, StringFormula replacement)Replace all appearances of target in fullStr with the replacement.StringFormulasubstring(StringFormula str, NumeralFormula.IntegerFormula index, NumeralFormula.IntegerFormula length)Get a substring from the given String.BooleanFormulasuffix(StringFormula suffix, StringFormula str)Check whether the given suffix is a real suffix of str.RegexFormulatimes(RegexFormula regex, int repetitions)NumeralFormula.IntegerFormulatoCodePoint(StringFormula str)Returns an Integer formula representing the code point of the only character of the given String formula, if it represents a single character.NumeralFormula.IntegerFormulatoIntegerFormula(StringFormula str)Interpret a String formula as an Integer formula.StringFormulatoStringFormula(NumeralFormula.IntegerFormula number)Interpret an Integer formula as a String formula.RegexFormulaunion(RegexFormula regex1, RegexFormula regex2)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sosy_lab.java_smt.api.StringFormulaManager
concat, concat, range
-
-
-
-
Method Detail
-
makeString
public StringFormula makeString(String value)
Description copied from interface:StringFormulaManagerCreates aStringFormularepresenting the given constant String.The String argument is expected to be a regular Java String and may contain Unicode characters from the first 3 planes (codepoints 0x00000-0x2FFFFF). Higher codepoints are not allowed due to limitations in SMTLIB. We do not support SMTLIB escape sequences in this method, and String like
"\\u{abc}"are read verbatim and are not substituted with their Unicode character. If you still want to use SMTLIB Strings with this method, the functionAbstractStringFormulaManager.unescapeUnicodeForSmtlib(String)can be used to handle the conversion before calling this method. Note that you may then also have to useAbstractStringFormulaManager.escapeUnicodeForSmtlib(String)to convert Strings from the model back to a format that is compatible with other SMTLIB based solvers.- Specified by:
makeStringin interfaceStringFormulaManager- Parameters:
value- the string value the returnedStringFormulashould represent- Returns:
- a
StringFormularepresenting the given value
-
makeVariable
public StringFormula makeVariable(String pVar)
Description copied from interface:StringFormulaManagerCreates a variable of type String with exactly the given name.This variable (symbol) represents a "String" for which the SMT solver needs to find a model.
Please make sure that the given name is valid in SMT-LIB2. Take a look at
FormulaManager.isValidName(java.lang.String)for further information.This method does not quote or unquote the given name, but uses the plain name "AS IS".
Formula.toString()can return a different String than the given one.- Specified by:
makeVariablein interfaceStringFormulaManager
-
equal
public BooleanFormula equal(StringFormula str1, StringFormula str2)
- Specified by:
equalin interfaceStringFormulaManager
-
greaterThan
public BooleanFormula greaterThan(StringFormula str1, StringFormula str2)
- Specified by:
greaterThanin interfaceStringFormulaManager
-
greaterOrEquals
public BooleanFormula greaterOrEquals(StringFormula str1, StringFormula str2)
- Specified by:
greaterOrEqualsin interfaceStringFormulaManager
-
lessThan
public BooleanFormula lessThan(StringFormula str1, StringFormula str2)
- Specified by:
lessThanin interfaceStringFormulaManager
-
lessOrEquals
public BooleanFormula lessOrEquals(StringFormula str1, StringFormula str2)
- Specified by:
lessOrEqualsin interfaceStringFormulaManager
-
prefix
public BooleanFormula prefix(StringFormula prefix, StringFormula str)
Description copied from interface:StringFormulaManagerCheck whether the given prefix is a real prefix of str.- Specified by:
prefixin interfaceStringFormulaManager
-
suffix
public BooleanFormula suffix(StringFormula suffix, StringFormula str)
Description copied from interface:StringFormulaManagerCheck whether the given suffix is a real suffix of str.- Specified by:
suffixin interfaceStringFormulaManager
-
contains
public BooleanFormula contains(StringFormula str, StringFormula part)
- Specified by:
containsin interfaceStringFormulaManager
-
indexOf
public NumeralFormula.IntegerFormula indexOf(StringFormula str, StringFormula part, NumeralFormula.IntegerFormula startIndex)
Description copied from interface:StringFormulaManagerGet the first index for a substring in a String, or -1 if the substring is not found. startIndex (inlcuded) denotes the start of the search for the index.- Specified by:
indexOfin interfaceStringFormulaManager
-
charAt
public StringFormula charAt(StringFormula str, NumeralFormula.IntegerFormula index)
Description copied from interface:StringFormulaManagerGet a substring of length 1 from the given String if the given index is within bounds. Otherwise, returns an empty string.- Specified by:
charAtin interfaceStringFormulaManager
-
substring
public StringFormula substring(StringFormula str, NumeralFormula.IntegerFormula index, NumeralFormula.IntegerFormula length)
Description copied from interface:StringFormulaManagerGet a substring from the given String.The result is underspecified, if the start index is out of bounds for the given String or if the requested length is negative. The length of the result is the minimum of the requested length and the remaining length of the given String.
- Specified by:
substringin interfaceStringFormulaManager
-
replace
public StringFormula replace(StringFormula fullStr, StringFormula target, StringFormula replacement)
Description copied from interface:StringFormulaManagerReplace the first appearances of target in fullStr with the replacement.- Specified by:
replacein interfaceStringFormulaManager
-
replaceAll
public StringFormula replaceAll(StringFormula fullStr, StringFormula target, StringFormula replacement)
Description copied from interface:StringFormulaManagerReplace all appearances of target in fullStr with the replacement.- Specified by:
replaceAllin interfaceStringFormulaManager
-
length
public NumeralFormula.IntegerFormula length(StringFormula str)
- Specified by:
lengthin interfaceStringFormulaManager
-
concat
public StringFormula concat(List<StringFormula> parts)
- Specified by:
concatin interfaceStringFormulaManager
-
in
public BooleanFormula in(StringFormula str, RegexFormula regex)
- Specified by:
inin interfaceStringFormulaManager- Parameters:
str- formula representing the string to matchregex- formula representing the regular expression- Returns:
- a formula representing the acceptance of the string by the regular expression
-
makeRegex
public RegexFormula makeRegex(String value)
Description copied from interface:StringFormulaManagerReturns aRegexFormularepresenting the given constant.This method does not parse an existing regex from String, but uses the String directly as a constant.
- Specified by:
makeRegexin interfaceStringFormulaManager- Parameters:
value- the regular expression the returnedFormulashould represent
-
none
public RegexFormula none()
- Specified by:
nonein interfaceStringFormulaManager- Returns:
- formula denoting the empty set of strings
-
all
public RegexFormula all()
Description copied from interface:StringFormulaManagerNote: The size of the used alphabet depends on the underlying SMT solver.- Specified by:
allin interfaceStringFormulaManager- Returns:
- formula denoting the set of all strings, also known as Regex
".*".
-
allChar
public RegexFormula allChar()
Description copied from interface:StringFormulaManagerNote: The size of the used alphabet depends on the underlying SMT solver.- Specified by:
allCharin interfaceStringFormulaManager- Returns:
- formula denoting the set of all strings of length 1, also known as DOT operator which
represents one arbitrary char, or as Regex
".".
-
range
public RegexFormula range(StringFormula start, StringFormula end)
- Specified by:
rangein interfaceStringFormulaManager- Returns:
- formula denoting the range regular expression over two sequences of length 1.
-
concatRegex
public RegexFormula concatRegex(List<RegexFormula> parts)
- Specified by:
concatRegexin interfaceStringFormulaManager- Returns:
- formula denoting the concatenation
-
union
public RegexFormula union(RegexFormula regex1, RegexFormula regex2)
- Specified by:
unionin interfaceStringFormulaManager- Returns:
- formula denoting the union
-
intersection
public RegexFormula intersection(RegexFormula regex1, RegexFormula regex2)
- Specified by:
intersectionin interfaceStringFormulaManager- Returns:
- formula denoting the intersection
-
complement
public RegexFormula complement(RegexFormula regex)
- Specified by:
complementin interfaceStringFormulaManager- Returns:
- formula denoting the Kleene closure
-
closure
public RegexFormula closure(RegexFormula regex)
- Specified by:
closurein interfaceStringFormulaManager- Returns:
- formula denoting the Kleene closure (0 or more), also known as STAR operand.
-
difference
public RegexFormula difference(RegexFormula regex1, RegexFormula regex2)
- Specified by:
differencein interfaceStringFormulaManager- Returns:
- formula denoting the difference
-
cross
public RegexFormula cross(RegexFormula regex)
- Specified by:
crossin interfaceStringFormulaManager- Returns:
- formula denoting the Kleene cross (1 or more), also known as PLUS operand.
-
optional
public RegexFormula optional(RegexFormula regex)
- Specified by:
optionalin interfaceStringFormulaManager- Returns:
- formula denoting the optionality, also known as QUESTIONMARK operand.
-
times
public RegexFormula times(RegexFormula regex, int repetitions)
- Specified by:
timesin interfaceStringFormulaManager- Returns:
- formula denoting the concatenation n times
-
toIntegerFormula
public NumeralFormula.IntegerFormula toIntegerFormula(StringFormula str)
Description copied from interface:StringFormulaManagerInterpret a String formula as an Integer formula.The number is interpreted in base 10 and has no leading zeros. The method works as expected for positive numbers, including zero. It returns the constant value of
-1for negative numbers or invalid number representations, for example if any char is no digit.- Specified by:
toIntegerFormulain interfaceStringFormulaManager
-
toStringFormula
public StringFormula toStringFormula(NumeralFormula.IntegerFormula number)
Description copied from interface:StringFormulaManagerInterpret an Integer formula as a String formula.The number is in base 10. The method works as expected for positive numbers, including zero. It returns the empty string
""for negative numbers.- Specified by:
toStringFormulain interfaceStringFormulaManager
-
toCodePoint
public NumeralFormula.IntegerFormula toCodePoint(StringFormula str)
Description copied from interface:StringFormulaManagerReturns an Integer formula representing the code point of the only character of the given String formula, if it represents a single character. Otherwise, returns -1.- Specified by:
toCodePointin interfaceStringFormulaManager
-
fromCodePoint
public StringFormula fromCodePoint(NumeralFormula.IntegerFormula codepoint)
Description copied from interface:StringFormulaManagerReturns a String formula representing the single character with the given code point, if it is a valid Unicode code point within the Basic Multilingual Plane (BMP) or planes 1 and 2 (codepoints in range [0x00000, 0x2FFFF]). Otherwise, returns the empty string.- Specified by:
fromCodePointin interfaceStringFormulaManager
-
-