Checks if a transitions is registered in the FSM

        Args:
          source (str): the source state name
          dest (str): the destination state name

        Returns:
          bool: wether the transition is valid or not
180458
def is_valid_transition(self, source: str, dest: str) -> bool:
        
        if dest not in self._states or source not in self._states:
            raise NotValidState
        elif dest not in self._transitions[source]:
            raise NotValidTransition
        return True
315294
def _match_transition(self, transition):
        """"""
        return (self.names == '*'
                or transition in self.names
                or transition.name in self.names)
200469
def check_transition_id(self, transition_id):
        
        if transition_id is not None:
            if transition_id in self._transitions.keys():
                raise AttributeError("The transition id %s already exists. Cannot add transition!", transition_id)
        else:
            transition_id = generate_transition_id()
            while transition_id in self._transitions.keys():
                transition_id = generate_transition_id()
        return transition_id
1179276
def _state_invalid(self):
        
        for statemanager, conditions in self.statetransition.transitions.items():
            current_state = getattr(self.obj, statemanager.propname)
            if conditions['from'] is None:
                state_valid = True
            else:
                mstate = conditions['from'].get(current_state)
                state_valid = mstate and mstate(self.obj)
            if state_valid and conditions['if']:
                state_valid = all(v(self.obj) for v in conditions['if'])
            if not state_valid:
                return statemanager, current_state, statemanager.lenum.get(current_state)
750768
def transition_allowed(self, initial_state, target_state):
        # type: (str, str) -> bool
        """"""
        assert initial_state in self._allowed, \
            "%s is not in %s" % (initial_state, list(self._allowed))
        return target_state in self._allowed[initial_state]
553668
def _pre_transition_checks(self):
        """"""
        current_state = getattr(self.instance, self.field_name)
        if current_state not in self.transition.source:
            raise InvalidTransitionError(
                "Transition '%s' isn't available from state '%s'." %
                (self.transition.name, current_state.name))

        for check in self._filter_hooks(HOOK_CHECK):
            if not check(self.instance):
                raise ForbiddenTransition(
                    "Transition '%s' was forbidden by "
                    "custom pre-transition check." % self.transition.name)
308443
def transition(self, inputSymbol):
        
        outState, outputSymbols = self._automaton.outputForInput(self._state,
                                                                 inputSymbol)
        outTracer = None
        if self._tracer:
            outTracer = self._tracer(self._state._name(),
                                     inputSymbol._name(),
                                     outState._name())
        self._state = outState
        return (outputSymbols, outTracer)
1204992
def _copy_future_state(source, dest):
    
    assert source.done()
    if dest.cancelled():
        return
    assert not dest.done()
    if source.cancelled():
        dest.cancel()
    else:
        exception = source.exception()
        if exception is not None:
            dest.set_exception(exception)
        else:
            result = source.result()
            dest.set_result(result)
496472
public static boolean haveSameTransitions(MDAGNode node1, MDAGNode node2)
    {
        TreeMap<Character, MDAGNode> outgoingTransitionTreeMap1 = node1.outgoingTransitionTreeMap;
        TreeMap<Character, MDAGNode> outgoingTransitionTreeMap2 = node2.outgoingTransitionTreeMap;
        
        if(outgoingTransitionTreeMap1.size() == outgoingTransitionTreeMap2.size())
        {
            //For each _transition in outgoingTransitionTreeMap1, get the identically lableed _transition
            //in outgoingTransitionTreeMap2 (if present), and test the equality of the transitions' target nodes
            for(Entry<Character, MDAGNode> transitionKeyValuePair : outgoingTransitionTreeMap1.entrySet())
            {
                Character currentCharKey = transitionKeyValuePair.getKey();
                MDAGNode currentTargetNode = transitionKeyValuePair.getValue();
                
                if(!outgoingTransitionTreeMap2.containsKey(currentCharKey) || !outgoingTransitionTreeMap2.get(currentCharKey).equals(currentTargetNode))
                    return false;
            }
            /////
        }
        else
            return false;
        
        return true;
    }
406308
function isValidTransition (link, context) {
    var isValid = true;

    if (!(PromisePipe.envTransitions[context._env] && PromisePipe.envTransitions[context._env][link._env])) {
      if (!isSystemTransition(link._env)) {
        isValid = false;
      }
    }
    return isValid;
  }
1092321
def check(self):
        """"""
        has_term = False

        if self.START_STATE not in self.states:
            raise SyntaxError('Undefined start rule')

        for state in self.states:
            for rule in self.states[state]:
                if rule is not None:
                    if rule[2] == self.TERM_STATE:
                        has_term = True
                    elif rule[2] not in self.states:
                        raise SyntaxError('Unexpected state: ' + rule[2])

        if not has_term:
            raise SyntaxError('Missed terminate state')
209402
def validate_state_transition(self, user, start_state, end_state, **kwargs):
        
        if start_state == end_state:
            raise Return(True)

        transitions = self.state_transitions.get(start_state, [])

        approved_transitions = []
        can_approve = yield self.can_approve(user, **kwargs)
        if can_approve:
            approved_transitions = self.approval_state_transitions.get(start_state, [])

        if end_state not in transitions and end_state not in approved_transitions:
            raise Return(False)

        raise Return(True)
151159
def isTransitionAllowed(instance, transition_id):
    
    wf_tool = getToolByName(instance, "portal_workflow")
    for wf_id in wf_tool.getChainFor(instance):
        wf = wf_tool.getWorkflowById(wf_id)
        if wf and wf.isActionSupported(instance, transition_id):
            return True

    return False
676308
def _check_transition_validity(self, check_transition):
        
        valid, message = super(PreemptiveConcurrencyState, self)._check_transition_validity(check_transition)
        if not valid:
            return False, message

        # Only transitions to the parent state are allowed

        if check_transition.to_state != self.state_id:
            return False, "Only transitions to the parent state are allowed"

        return True, message
776293
public void finishTransitionImmediately() {
    mTransitionState = TRANSITION_NONE;
    for (int i = 0; i < mLayers.length; i++) {
      mAlphas[i] = mIsLayerOn[i] ? 255 : 0;
    }
    invalidateSelf();
  }
1108545
def is_transition_allowed(analyses, transition_id):
    
    if not analyses:
        return True
    if not isinstance(analyses, list):
        return is_transition_allowed([analyses], transition_id)
    for analysis in analyses:
        if not wf.isTransitionAllowed(analysis, transition_id):
            return False
    return True
335842
public ArrayList<Transition> possibleNextStates(Automaton source) {
        ArrayList<Transition> r = possibleTransitions.get(source);
        if (r == null) {
            throw new UnsupportedOperationException(
                    "Not transitions registered from " + source.getName()
                    + ", automaton " + this.getName());
        }
        ArrayList<Transition> activatedTransitions = new ArrayList<Transition>();
        for (Transition t : r) {
            if (t.evaluate()) {
                activatedTransitions.add(t);
            }
        }
        ;
        return activatedTransitions;

    }