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>
ATransitionSymbolfor single characters, represented as strings for simple modeling of epsilon.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSymbolEPSILONSingleton 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 intcompareTo(StringSymbol o)StringSymbolconcat(StringSymbol other)Merges the two symbols in a unique one by joining the two inner strings.booleanequals(java.lang.Object obj)java.lang.StringgetSymbol()Yields the string represented by this symbol.inthashCode()booleanisEpsilon()intmaxLength()intminLength()StringSymbolreverse()java.lang.StringtoString()
-
-
-
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:
compareToin interfacejava.lang.Comparable<StringSymbol>
-
isEpsilon
public boolean isEpsilon()
- Specified by:
isEpsilonin interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
reverse
public StringSymbol reverse()
- Specified by:
reversein interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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:
maxLengthin interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
minLength
public int minLength()
- Specified by:
minLengthin interfaceit.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
-
-