com.evelopers.unimod.validation
Class ConsistencyValidator

java.lang.Object
  extended bycom.evelopers.unimod.validation.ConsistencyCheckVisitor
      extended bycom.evelopers.unimod.validation.ConsistencyValidator
All Implemented Interfaces:
ModelVisitor

class ConsistencyValidator
extends ConsistencyCheckVisitor

Validates consistency (every state has consistent system of transitions for every event).


Constructor Summary
(package private) ConsistencyValidator()
           
 
Method Summary
 boolean addConsistencyListener(ConsistencyListener listener)
          Adds listener to list of consistency listeners.
protected  void checkState(State s)
          Checks consistency of State s.
protected  void fireInconsistentGuardSet(StateMachine sm, Transition t1, Transition t2, Guard guard)
           
protected  void fireRedundantElseTransitions(StateMachine sm, State state, Event e, int elseTransitionsNumber)
           
 boolean removeConsistencyListener(ConsistencyListener listener)
          Removes listener from list of consistency listeners.
 void setSm(StateMachine sm)
           
 void validateConsistency(StateMachine sm)
          Checks if every state has consistent pairs of transitions, i.e. any combination of input actions and event will meet guard condition only on the one transition.
 void validateConsistency(StateMachine sm, State state)
           
 boolean visit(ModelElement e)
          Checks consistency of e and its descendants.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsistencyValidator

ConsistencyValidator()
Method Detail

addConsistencyListener

public boolean addConsistencyListener(ConsistencyListener listener)
Adds listener to list of consistency listeners.

Parameters:
listener - listener to add
Returns:
true (as List).
See Also:
ConsistencyListener

removeConsistencyListener

public boolean removeConsistencyListener(ConsistencyListener listener)
Removes listener from list of consistency listeners.

Parameters:
listener - listener to remove.
Returns:
true if list of listeners contained listener.
See Also:
ConsistencyListener

validateConsistency

public void validateConsistency(StateMachine sm)
Checks if every state has consistent pairs of transitions, i.e. any combination of input actions and event will meet guard condition only on the one transition. Will be checked all ancestors and all descendants of the state

Parameters:
sm - StateMachine to validate.

validateConsistency

public void validateConsistency(StateMachine sm,
                                State state)

fireInconsistentGuardSet

protected void fireInconsistentGuardSet(StateMachine sm,
                                        Transition t1,
                                        Transition t2,
                                        Guard guard)
Specified by:
fireInconsistentGuardSet in class ConsistencyCheckVisitor

fireRedundantElseTransitions

protected void fireRedundantElseTransitions(StateMachine sm,
                                            State state,
                                            Event e,
                                            int elseTransitionsNumber)
Specified by:
fireRedundantElseTransitions in class ConsistencyCheckVisitor

setSm

public void setSm(StateMachine sm)

visit

public boolean visit(ModelElement e)
              throws VisitorException
Checks consistency of e and its descendants. e should be instance of State.

Specified by:
visit in interface ModelVisitor
Parameters:
e - state to visit.
Returns:
Whether e is composite state and thus whether its descendants should be checked.
Throws:
VisitorException - if e or its descendants aren't instances of type State.

checkState

protected void checkState(State s)
                   throws VisitorException
Checks consistency of State s.

Parameters:
s - state, consistency of what should be checked.
Throws:
VisitorException - if any error occurs.