LabelType
- The type of the labels in the DatasetFeatureType
- The type of the features in the Datasetpublic class BasicDatum<LabelType,FeatureType> extends Object implements Datum<LabelType,FeatureType>
Constructor and Description |
---|
BasicDatum()
Constructs a new BasicDatum with no features or labels.
|
BasicDatum(Collection<FeatureType> features)
Constructs a new BasicDatum with the given features and no labels.
|
BasicDatum(Collection<FeatureType> features,
Collection<LabelType> labels)
Constructs a new BasicDatum with the given features and labels.
|
BasicDatum(Collection<FeatureType> features,
LabelType label)
Constructs a new BasicDatum with the given features and label.
|
Modifier and Type | Method and Description |
---|---|
void |
addLabel(LabelType label)
Adds the given Label to the List of labels for this Datum if it is not
null.
|
Collection<FeatureType> |
asFeatures()
Returns the collection that this BasicDatum was constructed with.
|
boolean |
equals(Object o)
Returns whether the given Datum contains the same features as this Datum.
|
int |
hashCode() |
LabelType |
label()
Returns the first label for this Datum, or null if none have been set.
|
Collection<LabelType> |
labels()
Returns the complete List of labels for this Datum, which may be empty.
|
void |
setLabel(LabelType label)
Removes all currently assigned Labels for this Datum then adds the
given Label.
|
void |
setLabels(Collection<LabelType> labels)
Removes all currently assigned labels for this Datum then adds all
of the given Labels.
|
String |
toString()
Returns a String representation of this BasicDatum (lists features and labels).
|
public BasicDatum(Collection<FeatureType> features, Collection<LabelType> labels)
public BasicDatum(Collection<FeatureType> features, LabelType label)
public BasicDatum(Collection<FeatureType> features)
public BasicDatum()
public Collection<FeatureType> asFeatures()
asFeatures
in interface Featurizable<FeatureType>
public LabelType label()
public Collection<LabelType> labels()
public void setLabel(LabelType label)
public void setLabels(Collection<LabelType> labels)
public void addLabel(LabelType label)
public String toString()
public boolean equals(Object o)