Package net.diversionmc.parser.pattern
Record Class PatternResult<T extends Sentence>
java.lang.Object
java.lang.Record
net.diversionmc.parser.pattern.PatternResult<T>
- Type Parameters:
T- Sentence type, matchingParsePatternandParser.- Record Components:
length- Amount of pieces used by this pattern.result- Resulting sentence.
public record PatternResult<T extends Sentence>(int length, T extends Sentence result)
extends Record
Represents a result of a sentence parse.
-
Constructor Summary
ConstructorsConstructorDescriptionPatternResult(int length, T result) Creates an instance of aPatternResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanCheck if resulting sentence is a statement.intlength()Returns the value of thelengthrecord component.result()Returns the value of theresultrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
isStatement
public boolean isStatement()Check if resulting sentence is a statement.- Returns:
Sentence.isStatement()
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
length
public int length()Returns the value of thelengthrecord component.- Returns:
- the value of the
lengthrecord component
-
result
Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-