Class XEventImpl

  • All Implemented Interfaces:
    java.lang.Cloneable, XAttributable, XElement, XEvent

    public class XEventImpl
    extends java.lang.Object
    implements XEvent
    Implementation for the XEvent interface.
    Author:
    Christian W. Guenther (christian@deckfour.org)
    • Constructor Detail

      • XEventImpl

        public XEventImpl()
        Creates a new event.
      • XEventImpl

        public XEventImpl​(XID id)
        Creates a new event with a given ID.
        Parameters:
        id - the id for this event
      • XEventImpl

        public XEventImpl​(XAttributeMap attributes)
        Creates a new event.
        Parameters:
        attributes - Map of attribute for the event.
      • XEventImpl

        public XEventImpl​(XID id,
                          XAttributeMap attributes)
        Creates a new event with the given id and attributed
        Parameters:
        id - the id for this event
        attributes - Map of attribute for the event.
    • Method Detail

      • setAttributes

        public void setAttributes​(XAttributeMap attributes)
        Description copied from interface: XAttributable
        Sets the map of attributes for this element.
        Specified by:
        setAttributes in interface XAttributable
        Parameters:
        attributes - A map of attributes.
      • hasAttributes

        public boolean hasAttributes()
        Description copied from interface: XAttributable
        Checks for the existence of attributes. This method can be a more efficient way of checking for the existance of attributes than using XAttributable.getAttributes() in certain situations.
        Specified by:
        hasAttributes in interface XAttributable
        Returns:
        whether this element has any attributes
      • getExtensions

        public java.util.Set<XExtension> getExtensions()
        Description copied from interface: XAttributable
        Retrieves the extensions used by this element, i.e. the extensions used by all attributes of this element, and the element itself.
        Specified by:
        getExtensions in interface XAttributable
        Returns:
        A set of extensions.
      • clone

        public java.lang.Object clone()
        Clones this event, i.e. creates a deep copy, but with a new ID, so equals does not hold between this and the clone
        Specified by:
        clone in interface XElement
        Overrides:
        clone in class java.lang.Object
        Returns:
        An identical clone.
      • equals

        public boolean equals​(java.lang.Object o)
        Tests for equality of IDs
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns the hashCode of the id
        Overrides:
        hashCode in class java.lang.Object
      • getID

        public XID getID()
        Description copied from interface: XEvent
        Returns the id of the event
        Specified by:
        getID in interface XEvent
        Returns:
        the ID of this event
      • setID

        public void setID​(XID id)
        Sets the ID. Should only be used for deserialization purposes
        Parameters:
        id - the new id.