Class 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>
    A TransitionSymbol 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.
      • Fields inherited from interface it.unive.lisa.util.datastructures.automaton.TransitionSymbol

        UNKNOWN_SYMBOL
    • 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.
    • 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 interface java.lang.Comparable<StringSymbol>
      • isEpsilon

        public boolean isEpsilon()
        Specified by:
        isEpsilon in interface it.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
      • reverse

        public StringSymbol reverse()
        Specified by:
        reverse in interface it.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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 interface it.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>
      • minLength

        public int minLength()
        Specified by:
        minLength in interface it.unive.lisa.util.datastructures.automaton.TransitionSymbol<StringSymbol>