java.lang.Object
java.lang.Record
net.luis.utils.io.token.definition.CharTokenDefinition
- Record Components:
token
- The token character
- All Implemented Interfaces:
TokenDefinition
,TokenRule
Token definition for a single character.
This token definition matches a string that is equal to the token character.
This token definition matches a string that is equal to the token character.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCharTokenDefinition
(char token) Creates an instance of aCharTokenDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Checks if the given word matches this token definition.char
token()
Returns the value of thetoken
record component.@NotNull String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.luis.utils.io.token.definition.TokenDefinition
match
Methods inherited from interface net.luis.utils.io.token.rule.rules.TokenRule
optional, repeatAtLeast, repeatAtMost, repeatBetween, repeatExactly, repeatInfinitely
-
Field Details
-
token
private final char tokenThe field for thetoken
record component.
-
-
Constructor Details
-
CharTokenDefinition
public CharTokenDefinition(char token) Creates an instance of aCharTokenDefinition
record class.- Parameters:
token
- the value for thetoken
record component
-
-
Method Details
-
matches
Description copied from interface:TokenDefinition
Checks if the given word matches this token definition.- Specified by:
matches
in interfaceTokenDefinition
- Parameters:
word
- The word to check- Returns:
- True if the word matches this token definition, false otherwise
-
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. -
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. -
equals
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 '=='. -
token
public char token()Returns the value of thetoken
record component.- Returns:
- the value of the
token
record component
-