public class LabelEditingReporter extends java.lang.Object
JPhyloIOEventWriter
to give feedback to the application
on how labels of different elements (e.g. OTUs, sequences, nodes) were changed in order to fulfill the
requirements of the target format. In some cases it may also happen that the specific element was not at all
written to the target format, because it is not supported there.Modifier and Type | Class and Description |
---|---|
static class |
LabelEditingReporter.LabelStatus
Enumerates the possible cases of how the label associated with a data element was treated by an
instance of
JPhyloIOEventWriter . |
Constructor and Description |
---|
LabelEditingReporter() |
Modifier and Type | Method and Description |
---|---|
void |
addEdit(EventContentType contentType,
java.lang.String id,
java.lang.String label,
boolean edited)
Adds a new mapping from an element ID to the label used for it in the target document to this instance.
|
void |
addEdit(LabeledIDEvent event,
java.lang.String label)
Adds a new mapping from an element ID to the label used for it in the target document to this instance.
|
boolean |
anyLabelEdited(EventContentType contentType)
Determines whether any label of data elements of the specified content type was edited.
|
void |
clear()
Removes all mappings from this instance.
|
java.lang.String |
getEditedLabel(EventContentType contentType,
java.lang.String id)
Returns the (edited) label associated with the specified data element.
|
java.lang.String |
getEditedLabel(LabeledIDEvent event)
Returns the (edited) label associated with the specified data element.
|
LabelEditingReporter.LabelStatus |
getLabelStatus(EventContentType contentType,
java.lang.String id)
Returns the status of the specified data element and its label.
|
LabelEditingReporter.LabelStatus |
getLabelStatus(LabeledIDEvent event)
Returns the status of the specified data element and its label.
|
boolean |
isLabelUsed(EventContentType contentType,
java.lang.String label)
Checks whether the specified label was already used for the specified content type.
|
public LabelEditingReporter()
public void addEdit(EventContentType contentType, java.lang.String id, java.lang.String label, boolean edited)
contentType
- the content type of the element to be mappedid
- the ID of the element to be mappedlabel
- the label that was used in the target document for the specified elementedited
- Specify true
here, if the specified label is not the label originally associated
with the specified element (denoted id
).java.lang.NullPointerException
- if contentType
or id
are null
public void addEdit(LabeledIDEvent event, java.lang.String label)
event
- the event object describing the element associated with the edited labellabel
- the label that was used in the target document for the specified elementjava.lang.NullPointerException
- if event
is null
public void clear()
public java.lang.String getEditedLabel(EventContentType contentType, java.lang.String id)
contentType
- the content type of the labeled data elementid
- the ID of the labeled data elementnull
if the specified data element was either not
written to the target document or no according mapping could not be found in this instancepublic java.lang.String getEditedLabel(LabeledIDEvent event)
event
- the event representing the labeled data elementnull
if the specified data element was either not
written to the target document or no according mapping could not be found in this instancepublic LabelEditingReporter.LabelStatus getLabelStatus(EventContentType contentType, java.lang.String id)
contentType
- the content type of the labeled data elementid
- the ID of the labeled data elementpublic LabelEditingReporter.LabelStatus getLabelStatus(LabeledIDEvent event)
event
- the event representing the labeled data elementpublic boolean isLabelUsed(EventContentType contentType, java.lang.String label)
JPhyloIOEventWriter
and will usually not be of much use for application developers.contentType
- the content type for which the label could have been usedlabel
- the label to search fortrue
if the specified label was already used until now or false
otherwisepublic boolean anyLabelEdited(EventContentType contentType)
JPhyloIOEventWriter
has been used to write a document.contentType
- the content type of the labeled data elementtrue