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 newWithConfidence
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
int
compareTo
(WithConfidence<T> other) boolean
double
The confidence associated withelement
.The underlying element with whom a confidence is associated.int
hashCode()
<S> WithConfidence
<S> Maps the existing object to another object, while retaining an identical confidence score.toString()
-
Constructor Details
-
WithConfidence
Creates a newWithConfidence
instance.- 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
WithConfidence
object containing the transformed element but preserving the confidence.
-
compareTo
- Specified by:
compareTo
in 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
.
-