edu.stanford.nlp.trees.Labeled Maven / Gradle / Ivy
package edu.stanford.nlp.trees;
import edu.stanford.nlp.ling.Label;
import java.util.Collection;
/**
* Interface for Objects which have a Label
.
* For instance, they may be hand-classified with one or more tags.
* Note that it is for things that possess
* a label via composition, rather than for things that implement
* the Label
interface.
* An implementor might choose to be read-only and throw an
* UnsupportedOperationException on the setLabel(s)() commands, but should
* minimally implement both commands to return Label(s).
*
* @author Sep Kamvar
* @author Christopher Manning
* @author Sarah Spikes ([email protected]) - filled in types
*/
public interface Labeled {
/**
* Returns the Object's label.
*
* @return One of the labels of the object (if there are multiple labels,
* preferably the primary label, if it exists).
* Returns null if there is no label.
*/
public Label label();
/**
* Sets the label associated with this object.
*
* @param label The Label value
*/
public void setLabel(final Label label);
/**
* Gives back all labels for this thing.
*
* @return A Collection of the Object's labels. Returns an empty
* Collection if there are no labels.
*/
public Collection