Package org.apache.lucene.classification
Record Class ClassificationResult<T>
java.lang.Object
java.lang.Record
org.apache.lucene.classification.ClassificationResult<T>
- Record Components:
assignedClass
- the classT
assigned by aClassifier
score
- score the score for the assignedClass as adouble
- All Implemented Interfaces:
Comparable<ClassificationResult<T>>
public record ClassificationResult<T>(T assignedClass, double score)
extends Record
implements Comparable<ClassificationResult<T>>
The result of a call to
Classifier.assignClass(String)
holding an assigned class of type
T
and a score.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
ConstructorsConstructorDescriptionClassificationResult
(T assignedClass, double score) Creates an instance of aClassificationResult
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theassignedClass
record component.int
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double
score()
Returns the value of thescore
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ClassificationResult
Creates an instance of aClassificationResult
record class.- Parameters:
assignedClass
- the value for theassignedClass
record componentscore
- the value for thescore
record component
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<T>
-
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 '=='. -
assignedClass
Returns the value of theassignedClass
record component.- Returns:
- the value of the
assignedClass
record component
-
score
public double score()Returns the value of thescore
record component.- Returns:
- the value of the
score
record component
-