Class WordTokenDefinition

java.lang.Object
net.luis.utils.io.token.definition.WordTokenDefinition
All Implemented Interfaces:
TokenDefinition, TokenRule

@Singleton public final class WordTokenDefinition extends Object implements TokenDefinition
Token definition for a word.
This token definition matches a string that is not empty.
It should be used for tokens that cannot be defined by a single character or string.
An example would be identifiers in programming languages.
  • Field Details

    • INSTANCE

      public static final WordTokenDefinition INSTANCE
      Singleton instance of the word token definition.
  • Constructor Details

    • WordTokenDefinition

      private WordTokenDefinition()
      Private constructor to prevent instantiation.
  • Method Details

    • matches

      public boolean matches(@NotNull @NotNull String word)
      Description copied from interface: TokenDefinition
      Checks if the given word matches this token definition.
      Specified by:
      matches in interface TokenDefinition
      Parameters:
      word - The word to check
      Returns:
      True if the word matches this token definition, false otherwise
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object