Class SymbolicString
- java.lang.Object
-
- it.unive.lisa.util.datastructures.regex.symbolic.SymbolicString
-
- All Implemented Interfaces:
java.lang.Comparable<SymbolicString>,java.lang.Iterable<SymbolicChar>
public final class SymbolicString extends java.lang.Object implements java.lang.Comparable<SymbolicString>, java.lang.Iterable<SymbolicChar>
An extended string, that is, a string composed of an array ofSymbolicChar.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SymbolicStringcollapseTopChars()Yields a new extended string where all subsequent occurrences of the unknown character have been collapsed into a single one.intcompareTo(SymbolicString other)SymbolicStringconcat(SymbolicString str)Joins together two extended strings.booleancontains(java.lang.CharSequence s)Yieldstrueif and only if this extended string contains the given sequence.booleanendsWith(java.lang.String suffix)Yieldstrueif and only if this extended string ends with the given suffix.booleanequals(java.lang.Object obj)inthashCode()java.util.Iterator<SymbolicChar>iterator()intlength()Yields the length of this extended string.static SymbolicStringmkEmptyString()Builds a new empty extend string.static SymbolicStringmkString(java.lang.String str)Builds a new extend string corresponding to the given string.static SymbolicStringmkStringFromChar(char ch)Builds a new extend string corresponding to the given character.static SymbolicString[]mkStrings(java.lang.String... strings)Builds an array of extend strings corresponding to the given ones.static SymbolicStringmkTopString(int length)Builds a new extend string composed oflengthunknown characters.booleanstartsWith(java.lang.String prefix)Yieldstrueif and only if this extended string starts with the given prefix.java.lang.StringtoString()static java.util.Set<java.lang.String>toStrings(java.lang.Iterable<SymbolicString> extStrings)Builds a set of plain strings from a given set of extended strings.
-
-
-
Method Detail
-
mkEmptyString
public static SymbolicString mkEmptyString()
Builds a new empty extend string.- Returns:
- the extended string
-
mkTopString
public static SymbolicString mkTopString(int length)
Builds a new extend string composed oflengthunknown characters.- Parameters:
length- the desired length of the string- Returns:
- the extended string
-
toStrings
public static java.util.Set<java.lang.String> toStrings(java.lang.Iterable<SymbolicString> extStrings)
Builds a set of plain strings from a given set of extended strings.- Parameters:
extStrings- the extended strings- Returns:
- the strings set
-
mkString
public static SymbolicString mkString(java.lang.String str)
Builds a new extend string corresponding to the given string.- Parameters:
str- the string- Returns:
- the extended string
-
mkStrings
public static SymbolicString[] mkStrings(java.lang.String... strings)
Builds an array of extend strings corresponding to the given ones.- Parameters:
strings- the strings- Returns:
- the extended strings
-
mkStringFromChar
public static SymbolicString mkStringFromChar(char ch)
Builds a new extend string corresponding to the given character.- Parameters:
ch- the character- Returns:
- the extended string
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(SymbolicString other)
- Specified by:
compareToin interfacejava.lang.Comparable<SymbolicString>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
concat
public SymbolicString concat(SymbolicString str)
Joins together two extended strings.- Parameters:
str- the other extended string- Returns:
- the concatenation
-
collapseTopChars
public SymbolicString collapseTopChars()
Yields a new extended string where all subsequent occurrences of the unknown character have been collapsed into a single one.- Returns:
- the extended string
-
length
public int length()
Yields the length of this extended string.- Returns:
- the length
-
startsWith
public boolean startsWith(java.lang.String prefix)
Yieldstrueif and only if this extended string starts with the given prefix.- Parameters:
prefix- the prefix- Returns:
trueif that condition holds
-
endsWith
public boolean endsWith(java.lang.String suffix)
Yieldstrueif and only if this extended string ends with the given suffix.- Parameters:
suffix- the suffix- Returns:
trueif that condition holds
-
contains
public boolean contains(java.lang.CharSequence s)
Yieldstrueif and only if this extended string contains the given sequence.- Parameters:
s- the sequence- Returns:
trueif that condition holds
-
iterator
public java.util.Iterator<SymbolicChar> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<SymbolicChar>
-
-