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 SymbolicString
collapseTopChars()
Yields a new extended string where all subsequent occurrences of the unknown character have been collapsed into a single one.int
compareTo(SymbolicString other)
SymbolicString
concat(SymbolicString str)
Joins together two extended strings.boolean
contains(java.lang.CharSequence s)
Yieldstrue
if and only if this extended string contains the given sequence.boolean
endsWith(java.lang.String suffix)
Yieldstrue
if and only if this extended string ends with the given suffix.boolean
equals(java.lang.Object obj)
int
hashCode()
java.util.Iterator<SymbolicChar>
iterator()
int
length()
Yields the length of this extended string.static SymbolicString
mkEmptyString()
Builds a new empty extend string.static SymbolicString
mkString(java.lang.String str)
Builds a new extend string corresponding to the given string.static SymbolicString
mkStringFromChar(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 SymbolicString
mkTopString(int length)
Builds a new extend string composed oflength
unknown characters.boolean
startsWith(java.lang.String prefix)
Yieldstrue
if and only if this extended string starts with the given prefix.java.lang.String
toString()
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 oflength
unknown 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:
toString
in classjava.lang.Object
-
compareTo
public int compareTo(SymbolicString other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<SymbolicString>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in 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)
Yieldstrue
if and only if this extended string starts with the given prefix.- Parameters:
prefix
- the prefix- Returns:
true
if that condition holds
-
endsWith
public boolean endsWith(java.lang.String suffix)
Yieldstrue
if and only if this extended string ends with the given suffix.- Parameters:
suffix
- the suffix- Returns:
true
if that condition holds
-
contains
public boolean contains(java.lang.CharSequence s)
Yieldstrue
if and only if this extended string contains the given sequence.- Parameters:
s
- the sequence- Returns:
true
if that condition holds
-
iterator
public java.util.Iterator<SymbolicChar> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<SymbolicChar>
-
-