Class AbstractEvent

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.lang.Object>, BladeEvent
    Direct Known Subclasses:
    ActionEvent, AlarmEvent, LifeCycleEvent, ProbeEvent

    public abstract class AbstractEvent
    extends java.lang.Object
    implements BladeEvent
    Abstract implementation of a blade event. All events managed by CLIF shall derive from this class. Each event type shall have a unique label, which must be registered using the static registerEventFieldLabels method (typically in the a static section of the event class). Events are "Comparable" on their dates.
    Author:
    Bruno Dillenseger
    See Also:
    registerEventFieldLabels(String, String[], EventFactory), Serialized Form
    • Field Detail

      • DEFAULT_SEPARATOR

        public static final java.lang.String DEFAULT_SEPARATOR
        See Also:
        Constant Field Values
      • date

        protected long date
    • Constructor Detail

      • AbstractEvent

        public AbstractEvent()
      • AbstractEvent

        public AbstractEvent​(long date)
    • Method Detail

      • registerEventFieldLabels

        protected static void registerEventFieldLabels​(java.lang.String event_label,
                                                       java.lang.String[] field_labels,
                                                       EventFactory factory)
        Registers the given event type label (which must be unique) and associates the fields labels for this event type.
        Parameters:
        event_label - the unique label designating this event type
        field_labels - the array of field labels, describing the content of each field this type of event holds. These labels must be in the same order as the fields are printed when the toString() method is called on this type of event.
        See Also:
        BladeEvent.toString(long, String)
      • getEventFieldLabels

        public static java.lang.String[] getEventFieldLabels​(java.lang.String event_label)
        Get field labels of a given event type.
        Parameters:
        event_label - label of the event type
        Returns:
        the field labels of the given event type.
      • getEventFactory

        public static EventFactory getEventFactory​(java.lang.String event_label)
      • getDate

        public long getDate()
        Specified by:
        getDate in interface BladeEvent
        Returns:
        the date of this event
      • setDate

        public void setDate​(long date)
      • compareTo

        public int compareTo​(java.lang.Object obj)
                      throws java.lang.ClassCastException
        The order is based on dates. In case dates are the same, an arbitrary order is applied based on hashcodes.
        Specified by:
        compareTo in interface java.lang.Comparable<java.lang.Object>
        Throws:
        java.lang.ClassCastException