See L{MethodicalState.upon}.
161152
def _oneTransition(self, startState, inputToken, endState, outputTokens,
                       collector):
        
        # FIXME: tests for all of this (some of it is wrong)
        # if not isinstance(startState, MethodicalState):
        #     raise NotImplementedError("start state {} isn't a state"
        #                               .format(startState))
        # if not isinstance(inputToken, MethodicalInput):
        #     raise NotImplementedError("start state {} isn't an input"
        #                               .format(inputToken))
        # if not isinstance(endState, MethodicalState):
        #     raise NotImplementedError("end state {} isn't a state"
        #                               .format(startState))
        # for output in outputTokens:
        #     if not isinstance(endState, MethodicalState):
        #         raise NotImplementedError("output state {} isn't a state"
        #                                   .format(endState))
        self._automaton.addTransition(startState, inputToken, endState,
                                      tuple(outputTokens))
        inputToken.collectors[startState] = collector
1170959
def on(self, event, new_state):
        
        if self.name == new_state.name:
            raise RuntimeError("Use loop method to define {} -> {} -> {}".format(self.name, event.name, new_state.name))
        self._register_transition(event, new_state)
472968
def PushState(self, **_):
    """"""
    if self.verbose:
      logging.debug("Storing state %r", self.state)
    self.state_stack.append(self.state)
471787
private void onStateChange(Session.State state) {
    switch (state) {
      // When the session is opened, transition the state to CONNECTED.
      case OPEN:
        setState(State.CONNECTED);
        break;
      // When the session becomes unstable, transition the state to SUSPENDED.
      case UNSTABLE:
        setState(State.SUSPENDED);
        break;
      case STALE:
        setState(State.SUSPENDED);
        this.close();
        break;
      // When the session is expired, transition the state to SUSPENDED if necessary. The recovery strategy
      // must determine whether to attempt to recover the client.
      case EXPIRED:
        setState(State.SUSPENDED);
        recoveryStrategy.recover(this);
        break;
      case CLOSED:
        setState(State.CLOSED);
        break;
      default:
        break;
    }
  }
8585
function on (route, methods) {
    assert.equal(typeof route, 'string')
    methods = methods || {}

    // mount subrouter
    if (methods[sym]) return router.on(route, methods)

    assert.equal(typeof methods, 'object')

    // mount http methods
    router.on(route, function (args) {
      demuxSsa(args, function (req, res, params) {
        const meth = methodist(req, defaultFn, methods)
        meth(req, res, params)

        // default function to call if methods don't match
        // null -> null
        function defaultFn () {
          router._default(args)
        }
      })
    })
    return emit
  }
1351317
function (state) {
            scrollDirection = util.sign(state.page - layoutState.page);
            layoutState = state;
        }
1089819
function mainViewStateSet(mode, recursive) {
    mainView.state.mode = mode;
    mainView.state.recursive = recursive;
  }
986983
private void advanceRunState(int targetState) {
        // assert targetState == SHUTDOWN || targetState == STOP;
        for (;;) {
            int c = ctl.get();
            if (runStateAtLeast(c, targetState) ||
                ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
                break;
        }
    }
399857
function state(list, sortMethod)
{
  var isNamedList = !Array.isArray(list)
    , initState =
    {
      index    : 0,
      keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
      jobs     : {},
      results  : isNamedList ? {} : [],
      size     : isNamedList ? Object.keys(list).length : list.length
    }
    ;

  if (sortMethod)
  {
    // sort array keys based on it's values
    // sort object's keys just on own merit
    initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
    {
      return sortMethod(list[a], list[b]);
    });
  }

  return initState;
}
1041600
function(stateOnDefined) {
      const onDefinitionError = (err) => {
        this.failedWith = err;
        this.transition('failed');
      };
      const onDefined = () => {
        this.transition(stateOnDefined);
      };
      this.channel.define()
        .then(onDefined, onDefinitionError);
    }
133990
def setAutoRaise(self, state):
        
        self._autoRaise = state
        self.setMouseTracking(state)
        try:
            self.lineEdit().setVisible(not state)
        except AttributeError:
            pass
1243852
private void pushState(boolean isStatic) {
        stateStack.add(new StateStackElement());
        currentScope = new VariableScope(currentScope);
        currentScope.setInStaticContext(isStatic);
    }
224538
private Context translateWhile(WyilFile.Stmt.While stmt, Context context) {
		WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
				.getParent().enclosingDeclaration;
		// Translate the loop invariant and generate appropriate macro
		translateLoopInvariantMacros(stmt, declaration, context.wyalFile);
		// Rule 1. Check loop invariant on entry
		checkLoopInvariant("loop invariant may not hold on entry", stmt, context);
		// Rule 2. Check loop invariant preserved. On entry to the loop body we
		// must havoc all modified variables. This is necessary as such
		// variables should retain their values from before the loop.
		LoopScope scope = new LoopScope();
		Context beforeBodyContext = context.newLoopScope(scope).havoc(stmt.getModified());
		beforeBodyContext = assumeLoopInvariant(stmt, beforeBodyContext);
		Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, beforeBodyContext);
		Expr trueCondition = p.first();
		beforeBodyContext = p.second().assume(trueCondition);
		Context afterBodyContext = translateStatementBlock(stmt.getBody(), beforeBodyContext);
		// Join continue contexts together since they must also preserve the
		// loop invariant
		afterBodyContext = joinDescendants(beforeBodyContext, afterBodyContext, scope.continueContexts);
		checkLoopInvariant("loop invariant may not be restored", stmt, afterBodyContext);
		// Rule 3. Assume loop invariant holds.
		Context exitContext = context.havoc(stmt.getModified());
		exitContext = assumeLoopInvariant(stmt, exitContext);
		Expr falseCondition = invertCondition(
				translateExpression(stmt.getCondition(), null, exitContext.getEnvironment()), stmt.getCondition());
		exitContext = exitContext.assume(falseCondition);
		//
		// Finally, need to join any break contexts
		exitContext = joinDescendants(context, exitContext, scope.breakContexts);
		//
		return exitContext;
	}
1181459
function ToDate(amount, unit, method) {
  this.amount = amount;
  this.method = method;
  this.unit = unit;
}
997475
function( required, startFunc ) {
		var self = this;

		if ( required !== self.state ) {
			self._stateError( startFunc || self.requireState );
		}

		return self;
	}
487898
def set_until(self, frame, lineno=None):
        """"""
        self.state = Until(frame, frame.f_lineno)
229358
def set_state(self, onoff, channel=None):
        """"""
        try:
            onoff = bool(onoff)
        except Exception as err:
            LOG.debug("HelperActorState.set_state: Exception %s" % (err,))
            return False

        self.writeNodeData("STATE", onoff, channel)