All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cmt.statemachine.Transition Maven / Gradle / Ivy

The newest version!
package com.cmt.statemachine;

import com.cmt.statemachine.impl.TransitionType;

/**
 * {@code Transition} is something what a state machine associates with a state
 * changes.
 *
 * @author Frank Zhang
 *
 * @param  the type of state
 * @param  the type of event
 *
 * @date 2020-02-07 2:20 PM
 */
public interface Transition{
    /**
     * Gets the source state of this transition.
     *
     * @return the source state
     */
    State getSource();

    void setSource(State state);

    E getEvent();

    void setEvent(E event);

    void setType(TransitionType type);
    /**
     * Gets the target state of this transition.
     *
     * @return the target state
     */
    State getTarget();

    void setTarget(State state);

    /**
     * Gets the guard of this transition.
     *
     * @return the guard
     */
     Condition getCondition();

     void setCondition(Condition condition);

     void setCondition(Condition condition, String conditionDesc);

     Action getAction();

     void setAction(Action action);

    /**
     * Do transition from source state to target state.
     *
     * @return the target state
     */

      State transit(C request);

     T transitWithResult(C request);

    /**
     * Verify transition correctness
     */
    void verify();

     T transitWithResult(C cond, R request);

    String getConditionDesc();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy