Record Class GroupingTokenAction

java.lang.Object
java.lang.Record
net.luis.utils.io.token.rule.actions.GroupingTokenAction
Record Components:
definition - The definition of the token group
All Implemented Interfaces:
TokenAction

public record GroupingTokenAction(@NotNull TokenDefinition definition) extends Record implements TokenAction
Token action that groups the tokens into a single token group.
The value of the group must match the definition of this action.
See Also:
  • Field Details

  • Constructor Details

    • GroupingTokenAction

      public GroupingTokenAction(@NotNull @NotNull TokenDefinition definition)
      Constructs a new grouping token action with the given definition.
      Parameters:
      definition - The definition of the token group
      Throws:
      NullPointerException - If the definition is null
  • Method Details

    • apply

      @NotNull public @NotNull @Unmodifiable List<Token> apply(@NotNull @NotNull TokenRuleMatch match)
      Description copied from interface: TokenAction
      Applies this token action to the given token rule match.
      The action can modify, transform or remove the tokens of the match.
      Specified by:
      apply in interface TokenAction
      Parameters:
      match - The token rule match to apply the action to
      Returns:
      The resulting immutable list of tokens after applying the action
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • definition

      @NotNull public @NotNull TokenDefinition definition()
      Returns the value of the definition record component.
      Returns:
      the value of the definition record component