T
- element to be associated with a confidence score.public class LabelledWithConfidence<T> extends Object implements Comparable<LabelledWithConfidence<T>>
WithConfidence
but additionally adds a label.Constructor and Description |
---|
LabelledWithConfidence(String label,
WithConfidence<T> withConfidence) |
LabelledWithConfidence(T element,
double confidence,
String label)
Create for given element, confidence and label.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
int |
compareTo(LabelledWithConfidence<T> other) |
boolean |
equals(Object o) |
double |
getConfidence()
The confidence associated with
element . |
T |
getElement()
The underlying element with whom a confidence and label is associated.
|
String |
getLabel()
The label associated with the element.
|
WithConfidence<T> |
getWithConfidence()
The element with associated confidence.
|
int |
hashCode() |
<S> LabelledWithConfidence<S> |
map(java.util.function.Function<T,S> transform)
Maps the existing object to another object, while retaining an identical confidence score.
|
String |
toString() |
public LabelledWithConfidence(T element, double confidence, String label)
element
- the underlying element with whom a confidence and label is associated.confidence
- the confidence associated with element
.label
- the label associated with the element.public LabelledWithConfidence(String label, WithConfidence<T> withConfidence)
public <S> LabelledWithConfidence<S> map(java.util.function.Function<T,S> transform)
S
- type to map totransform
- converts the existing element into the new typeWithConfidence
object containing the transformed element but
preserving the confidence.public T getElement()
public double getConfidence()
element
.public int compareTo(LabelledWithConfidence<T> other)
compareTo
in interface Comparable<LabelledWithConfidence<T>>
protected boolean canEqual(Object other)
public String getLabel()
public WithConfidence<T> getWithConfidence()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.