Class StringSymbol
- java.lang.Object
-
- it.unive.lisa.analysis.string.fsa.StringSymbol
-
- All Implemented Interfaces:
it.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
,java.lang.Comparable<StringSymbol>
public class StringSymbol extends java.lang.Object implements it.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
ATransitionSymbol
for single characters, represented as strings for simple modeling of epsilon.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSymbol
EPSILON
Singleton symbol for the epsilon.
-
Constructor Summary
Constructors Constructor Description StringSymbol(char symbol)
Builds the symbol for the given character.StringSymbol(java.lang.String symbol)
Builds the symbol for the given string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(StringSymbol o)
StringSymbol
concat(StringSymbol other)
Merges the two symbols in a unique one by joining the two inner strings.boolean
equals(java.lang.Object obj)
java.lang.String
getSymbol()
Yields the string represented by this symbol.int
hashCode()
boolean
isEpsilon()
int
maxLength()
int
minLength()
StringSymbol
reverse()
java.lang.String
toString()
-
-
-
Field Detail
-
EPSILON
public static final StringSymbol EPSILON
Singleton symbol for the epsilon.
-
-
Constructor Detail
-
StringSymbol
public StringSymbol(java.lang.String symbol)
Builds the symbol for the given string. Note that, even if instances of this class should represent single characters, having a string enables modeling of epsilon.- Parameters:
symbol
- the string
-
StringSymbol
public StringSymbol(char symbol)
Builds the symbol for the given character.- Parameters:
symbol
- the character
-
-
Method Detail
-
compareTo
public int compareTo(StringSymbol o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<StringSymbol>
-
isEpsilon
public boolean isEpsilon()
- Specified by:
isEpsilon
in interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
reverse
public StringSymbol reverse()
- Specified by:
reverse
in interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSymbol
public java.lang.String getSymbol()
Yields the string represented by this symbol.- Returns:
- the concrete string
-
concat
public StringSymbol concat(StringSymbol other)
Merges the two symbols in a unique one by joining the two inner strings.- Parameters:
other
- the other symbol- Returns:
- the merged (joined) symbol
-
maxLength
public int maxLength()
- Specified by:
maxLength
in interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
minLength
public int minLength()
- Specified by:
minLength
in interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
-