Class WithConfidence<T>
Object
WithConfidence<T>
- Type Parameters:
T- element to be associated with a confidence score
- All Implemented Interfaces:
Comparable<WithConfidence<T>>
Wraps an element with a confidence-score.
A natural ordering exists, highest confidences ahead of lower confidences.
-
Constructor Summary
ConstructorsConstructorDescriptionWithConfidence(T element, double confidence) Creates a newWithConfidenceinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanintcompareTo(WithConfidence<T> other) booleandoubleThe confidence associated withelement.The underlying element with whom a confidence is associated.inthashCode()<S> WithConfidence<S> Maps the existing object to another object, while retaining an identical confidence score.toString()
-
Constructor Details
-
WithConfidence
Creates a newWithConfidenceinstance.- Parameters:
element- The underlying element with whom a confidence is associated.confidence- The confidence associated withelement.
-
-
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.
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getElement
The underlying element with whom a confidence is associated. -
getConfidence
public double getConfidence()The confidence associated withelement.
-