Class LabelledWithConfidence<T>
Object
LabelledWithConfidence<T>
- Type Parameters:
T- element to be associated with a confidence score.
- All Implemented Interfaces:
Comparable<LabelledWithConfidence<T>>
public class LabelledWithConfidence<T>
extends Object
implements Comparable<LabelledWithConfidence<T>>
Like
WithConfidence but additionally adds a label.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionLabelledWithConfidence(String label, WithConfidence<T> withConfidence) Creates a newLabelledWithConfidenceinstance.LabelledWithConfidence(T element, double confidence, String label) Create for given element, confidence and label. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanintcompareTo(LabelledWithConfidence<T> other) booleandoubleThe confidence associated withelement.The underlying element with whom a confidence and label is associated.getLabel()The label associated with the element.The element with associated confidence.inthashCode()<S> LabelledWithConfidence<S> Maps the existing object to another object, while retaining an identical confidence score.toString()
-
Constructor Details
-
LabelledWithConfidence
Create for given element, confidence and label.- Parameters:
element- the underlying element with whom a confidence and label is associated.confidence- the confidence associated withelement.label- the label associated with the element.
-
LabelledWithConfidence
Creates a newLabelledWithConfidenceinstance.- Parameters:
label- The label associated with the element.withConfidence- The element with associated confidence.
-
-
Method Details
-
map
Maps the existing object to another object, while retaining an identical confidence score.- Type Parameters:
S- type to map to- Parameters:
transform- converts the existing element into the new type- Returns:
- a newly created
WithConfidenceobject containing the transformed element but preserving the confidence.
-
getElement
The underlying element with whom a confidence and label is associated.- Returns:
- the element.
-
getConfidence
public double getConfidence()The confidence associated withelement.- Returns:
- the confidence.
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getLabel
The label associated with the element. -
getWithConfidence
The element with associated confidence.
-