info.bioinfweb.jphyloio.events

## Class SetElementEvent

- java.lang.Object
- - info.bioinfweb.jphyloio.events.ConcreteJPhyloIOEvent
  - - info.bioinfweb.jphyloio.events.SetElementEvent

- All Implemented Interfaces:
    JPhyloIOEvent, LinkedIDEvent

      public class SetElementEvent
      extends ConcreteJPhyloIOEvent
      implements LinkedIDEvent

  Event object that models an ID-based link to an object that is contained in set.

  Besides `getLinkedID()` this event additionally offers the property `getLinkedObjectType()`. Although IDs are document wide unique and therefore the linked ID would already sufficiently determine the type of linked object, the additional property is offered for convenience.

  Note that in contrast to other implementations of `LinkedIDEvent`, the linked ID may never be `null` in instances of this class.

  Since:
    0.0.0
  Author:
    Ben Stöver

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SetElementEvent(java.lang.String linkedID, EventContentType linkedObjectType)` Creates a new instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getLinkedID()` Returns the ID of the event modeling the member of the set this event is nested in.
    `EventContentType` | `getLinkedObjectType()` Returns the type of event that is linked to this set.
    `boolean` | `hasLink()` This method is present to fully implement `LinkedIDEvent`.

    - ### Methods inherited from class info.bioinfweb.jphyloio.events.ConcreteJPhyloIOEvent

      `asCharacterDefinitionEvent, asCharacterSetIntervalEvent, asCommentEvent, asEdgeEvent, asLabeledIDEvent, asLinkedLabeledIDEvent, asLiteralMetadataContentEvent, asLiteralMetadataEvent, asNodeEvent, asPartEndEvent, asResourceMetadataEvent, asSequenceTokensEvent, asSetElementEvent, asSingleSequenceTokenEvent, asSingleTokenDefinitionEvent, asTokenSetDefinitionEvent, asUnknownCommandEvent, createEndEvent, getType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.events.JPhyloIOEvent

      `asCharacterDefinitionEvent, asCharacterSetIntervalEvent, asCommentEvent, asEdgeEvent, asLabeledIDEvent, asLinkedLabeledIDEvent, asLiteralMetadataContentEvent, asLiteralMetadataEvent, asNodeEvent, asPartEndEvent, asResourceMetadataEvent, asSequenceTokensEvent, asSetElementEvent, asSingleSequenceTokenEvent, asSingleTokenDefinitionEvent, asTokenSetDefinitionEvent, asUnknownCommandEvent, getType`

- - ### Constructor Detail

    - #### SetElementEvent

          public SetElementEvent(java.lang.String linkedID,
                                 EventContentType linkedObjectType)

      Creates a new instance of this class.
      Parameters:
        `linkedID` - the ID of the event to be linked to this set
        `linkedObjectType` - the type of object (event) that is linked by this event
      Throws:
        `java.lang.NullPointerException` - if `linkedID` or `linkedObjectType` is `null`

  - ### Method Detail

    - #### getLinkedID

          public java.lang.String getLinkedID()

      Returns the ID of the event modeling the member of the set this event is nested in.
      Specified by:
        `getLinkedID` in interface `LinkedIDEvent`
      Returns:
        the linked event (Note that links can never be null is instance of this class.)

    - #### hasLink

          public boolean hasLink()

      This method is present to fully implement `LinkedIDEvent`. In instances of this class, it will always return `true` since set elements not linking any element are not allowed.
      Specified by:
        `hasLink` in interface `LinkedIDEvent`
      Returns:
        always `true` in instances of this class

    - #### getLinkedObjectType

          public EventContentType getLinkedObjectType()

      Returns the type of event that is linked to this set. Some sets may contain different types of objects, e.g. a `EventContentType.TREE_NETWORK_SET` may contain links to trees and networks. This property determines which object is linked here.
      Returns:
        the content type of the linked object