public class EdgeEvent extends LabeledIDEvent
null. All referenced nodes must have been defined in the event stream before this event
is fired.
This event is a start event, which is followed by an end event of the same content type. Comment
and metainformation events maybe nested between this and its according end event. (See the description
of JPhyloIOEventReader for the complete grammar definition of JPhyloIO event streams.)
| Constructor and Description |
|---|
EdgeEvent(java.lang.String id,
java.lang.String label,
java.lang.String targetID,
double length)
Creates a new instance of this class that represents a root edge.
|
EdgeEvent(java.lang.String id,
java.lang.String label,
java.lang.String sourceID,
java.lang.String targetID,
double length)
Creates a new instance of this class that represents an internal edge or a root edge.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getLength()
Returns the length of this edge.
|
java.lang.String |
getSourceID()
Returns the ID of the source node linked by this edge.
|
java.lang.String |
getTargetID()
Returns the ID of the target node linked by this edge.
|
boolean |
hasLength()
Indicates whether this edge has a defined length.
|
boolean |
hasSource()
Indicates whether this edge has a source node and can therefore be considered a root edge.
|
java.lang.String |
toString() |
checkID, getIDgetLabel, hasLabelasCharacterDefinitionEvent, asCharacterSetIntervalEvent, asCommentEvent, asEdgeEvent, asLabeledIDEvent, asLinkedLabeledIDEvent, asLiteralMetadataContentEvent, asLiteralMetadataEvent, asNodeEvent, asPartEndEvent, asResourceMetadataEvent, asSequenceTokensEvent, asSetElementEvent, asSingleSequenceTokenEvent, asSingleTokenDefinitionEvent, asTokenSetDefinitionEvent, asUnknownCommandEvent, createEndEvent, getTypepublic EdgeEvent(java.lang.String id, java.lang.String label, java.lang.String sourceID, java.lang.String targetID, double length)
sourceID
is null the content type will be EventContentType.ROOT_EDGE and otherwise it will be
EventContentType.EDGE.id - the unique ID associated with the represented edge (Must be a valid
NCName.)label - an optional label associated with this edge (Maybe null.)sourceID - the ID of the source node of this edge (Maybe null if a root edge shall be created.)targetID - the ID of the target node of this edgelength - an optional lengths of this edge (Maybe Double.NaN if no length is given.)java.lang.NullPointerException - if id, sourceID or targetID are nulljava.lang.IllegalArgumentException - if id, sourceID or targetID are not a valid
NCNamespublic EdgeEvent(java.lang.String id, java.lang.String label, java.lang.String targetID, double length)
id - the unique ID associated with the represented edge (Must be a valid
NCName.)label - an optional label associated with this edge (Maybe null.)targetID - the ID of the target node of this edgelength - an optional lengths of this edge (Maybe Double.NaN if no length is given.)java.lang.NullPointerException - if id or targetID are nulljava.lang.IllegalArgumentException - if id or targetID are not a valid
NCNamespublic java.lang.String getSourceID()
null if this event represents a root edgehasSource()public boolean hasSource()
If this method returns true, getSourceID() will return null.
true if this edge has a source node or false otherwisepublic java.lang.String getTargetID()
null)public double getLength()
Additional information (e.g. on length confidence intervals) maybe given in upcoming nested metaevents.
Double.NaN if this edge does not have a defined lengthpublic boolean hasLength()
If this method returns false, getLength() will return Double#NaN.
true if this edge has a defined length or false otherwisepublic java.lang.String toString()
toString in class java.lang.Object