Enum StatusMachineEvent

    • Enum Constant Detail

      • INVALID_EVENT

        public static final StatusMachineEvent INVALID_EVENT
        Invalid event: special event used to be returned by some methods to signal an error.
      • TO_NOT_CONNECTED_STATUS_EVENT

        public static final StatusMachineEvent TO_NOT_CONNECTED_STATUS_EVENT
        Event used when one wants the DS to enter the NOT_CONNECTED_STATUS.
      • TO_NORMAL_STATUS_EVENT

        public static final StatusMachineEvent TO_NORMAL_STATUS_EVENT
        Event used when one wants the DS to enter the NORMAL_STATUS.
      • TO_DEGRADED_STATUS_EVENT

        public static final StatusMachineEvent TO_DEGRADED_STATUS_EVENT
        Event used when one wants the DS to enter the DEGRADED_STATUS.
      • TO_FULL_UPDATE_STATUS_EVENT

        public static final StatusMachineEvent TO_FULL_UPDATE_STATUS_EVENT
        Event used when one wants the DS to enter the FULL_UPDATE_STATUS.
      • TO_BAD_GEN_ID_STATUS_EVENT

        public static final StatusMachineEvent TO_BAD_GEN_ID_STATUS_EVENT
        Event used when one wants the DS to enter the BAD_GEN_ID_STATUS.
    • Method Detail

      • values

        public static StatusMachineEvent[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (StatusMachineEvent c : StatusMachineEvent.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static StatusMachineEvent valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • valueOf

        public static StatusMachineEvent valueOf​(byte value)
                                          throws IllegalArgumentException
        Returns the StatusMachineEvent matching the passed event numeric representation.
        Parameters:
        value - The numeric value for the event to return
        Returns:
        The matching StatusMachineEvent
        Throws:
        IllegalArgumentException - If provided event value is wrong
      • statusToEvent

        public static StatusMachineEvent statusToEvent​(ServerStatus reqStatus)
        Returns the event matching the passed requested status. When an entity receives a request to enter a particular status, this order is translated into a state machine event according to what is requested. Then, according to the current status and the computed event, the state machine retruns the matching new status (StateMachine.computeNewStatus).
        Parameters:
        reqStatus - The status to translate to an event.
        Returns:
        The matching event.
      • getValue

        public byte getValue()
        Get a numeric representation of the event.
        Returns:
        The numeric representation of the event