Class StringToken


  • public class StringToken
    extends Token
    A token denoting an alphabetic string.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringToken​(java.lang.String lexeme, int position)
      Create a token.
    • Constructor Detail

      • StringToken

        public StringToken​(java.lang.String lexeme,
                           int position)
        Create a token.
        Parameters:
        lexeme - the string of alphabetic characters
        position - position of the token within the string
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object actual)
        Compare two tokens.
        Specified by:
        equals in class Token
        Parameters:
        actual - the other token
        Returns:
        true iff actual is a StringToken and the lexemes match.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hash code for this token