Class Event


  • public class Event
    extends Object
    MicroUI features int-based events, allowing for a rich event mechanism compatible with scare resources. This class provides EventGenerator classes with event constants and helper methods to build and analyse events.

    An event has a type, a 8-bit figure that forms the most significant byte of the int-event, followed by 8-bits which is the generator identifier quantity, and followed by 16-bit of data.

    event : type (8-bit) + generatorId (8-bit) + data (16-bit)

    The very first 16 types [0x00..0x0f], some of which are defined by constants in EventGenerator subclasses, are MicroUI reserved. An application may create as many as 240 different kind of events.

    See Also:
    EventGenerator
    • Constructor Detail

      • Event

        public Event()
    • Method Detail

      • buildEvent

        public static int buildEvent​(int type,
                                     EventGenerator gen,
                                     int data)
        Builds an event from a given type, an eventGenerator and data.

        type and data must respect the format (respectively 0x0 to 0xff and 0x0 to 0xffff). No check is performed at runtime, only a crop is performed.

        Parameters:
        type - the type of the event to build
        gen - the generator associated with the event
        data - the data of the event to build
        Returns:
        the event as an int
      • getType

        public static int getType​(int event)
        Returns the type of an event.
        Parameters:
        event - an event
        Returns:
        event's type as an int
      • getData

        public static int getData​(int event)
        Returns the event's data issued by a generator.
        Parameters:
        event - an event
        Returns:
        event's data as an int
      • getGeneratorId

        public static int getGeneratorId​(int event)
        Returns the event's generator identifier.
        Parameters:
        event - an event
        Returns:
        event's generator as an int