com.evelopers.unimod.validation
Class StateMachineValidator

java.lang.Object
  extended bycom.evelopers.unimod.validation.StateMachineValidator

public class StateMachineValidator
extends java.lang.Object

State machine structure validator.

Implements the following validation rules:

  • 1. Structure. Only one INITIAL state must present in every attainable composite state. StructureListener, validateStructure();
  • 2. Attainability. Path from the most upper INITAL state to every state must present. AttainabilityListener, #validateAttainability();
  • 3. Consistency. ConsistencyListener, validateConsistency();
  • 4. Completeness. CompletenessListener, validateCompleteness();


    Constructor Summary
    protected StateMachineValidator(StateMachine sm)
               
     
    Method Summary
     boolean addCompletenessListener(CompletenessListener listener)
               
     boolean addConsistencyListener(ConsistencyListener listener)
               
     boolean addStructureListener(StructureListener listener)
               
    static StateMachineValidator createValidator(StateMachine sm)
               
     java.util.Collection getAttainableStates()
               
    protected  StateMachine getStateMachine()
               
     boolean removeCompletenessListener(CompletenessListener listener)
               
     boolean removeConsistencyListener(ConsistencyListener listener)
               
     boolean removeStructureListener(StructureListener listener)
               
     void validateCompleteness()
              Validate completeness of top-state.
     void validateCompleteness(State state)
              Validates completeness of state and its lief-descedants os state.
     void validateConsistency()
              Validates consistency of top-state.
     void validateConsistency(State state)
              Validates consistency of state its descendants and ancestors.
     void validateStructure()
              Validates structure.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    StateMachineValidator

    protected StateMachineValidator(StateMachine sm)
    Method Detail

    createValidator

    public static StateMachineValidator createValidator(StateMachine sm)

    addStructureListener

    public boolean addStructureListener(StructureListener listener)

    removeStructureListener

    public boolean removeStructureListener(StructureListener listener)

    addConsistencyListener

    public boolean addConsistencyListener(ConsistencyListener listener)

    removeConsistencyListener

    public boolean removeConsistencyListener(ConsistencyListener listener)

    addCompletenessListener

    public boolean addCompletenessListener(CompletenessListener listener)

    removeCompletenessListener

    public boolean removeCompletenessListener(CompletenessListener listener)

    validateStructure

    public void validateStructure()
    Validates structure.

    See Also:
    StructureValidator.validateStructure(com.evelopers.unimod.core.stateworks.StateMachine)

    validateConsistency

    public void validateConsistency()
    Validates consistency of top-state.

    See Also:
    validateConsistency(State)

    validateConsistency

    public void validateConsistency(State state)
    Validates consistency of state its descendants and ancestors.

    Parameters:
    state - state consistency of what should be checked.
    See Also:
    ConsistencyValidator.validateConsistency(com.evelopers.unimod.core.stateworks.StateMachine, com.evelopers.unimod.core.stateworks.State)

    validateCompleteness

    public void validateCompleteness()
    Validate completeness of top-state.

    See Also:
    validateCompleteness(State)

    validateCompleteness

    public void validateCompleteness(State state)
    Validates completeness of state and its lief-descedants os state. Lief-descendants are descendents of state which are not composite. Note: completeness of state will be checked only if state isn't composite.

    Parameters:
    state - state completeness of what should be checked.
    See Also:
    CompletenessValidator.validateCompleteness(com.evelopers.unimod.core.stateworks.StateMachine, com.evelopers.unimod.core.stateworks.State)

    getAttainableStates

    public java.util.Collection getAttainableStates()

    getStateMachine

    protected StateMachine getStateMachine()