Object has been transitioned to an new state
435196
def ObjectTransitionedEventHandler(obj, event):
    

    # only snapshot supported objects
    if not supports_snapshots(obj):
        return

    # default transition entry
    entry = {
        "modified": DateTime().ISO(),
        "action": event.action,
    }

    # get the last history item
    history = api.get_review_history(obj, rev=True)
    if history:
        entry = history[0]
        # make transitions also a modification entry
        timestamp = entry.pop("time", DateTime())
        entry["modified"] = timestamp.ISO()
        entry["action"] = event.action

    # take a new snapshot
    take_snapshot(obj, **entry)

    # reindex the object in the auditlog catalog
    reindex_object(obj)
821391
@Override
    public void nextState(PHATInterface phatInterface) {
        switch (state) {
            case NOT_INIT:
                initState(phatInterface);
                setState(STATE.STARTED);
                break;
            case STARTED:
                if(isFinished(phatInterface)) {
                    setState(FINISHED);
                } else {
                    simpleNextState(phatInterface);
                }
                break;
            case FINISHED:
                break;
            case INTERRUPTED:
                if (finishCondition != null) {
                    finishCondition.automatonInterrupted(this);
                }
                interrupt(phatInterface);
                break;
            case RESUMED:
                if (finishCondition != null) {
                    finishCondition.automatonResumed(this);
                }
                resume(phatInterface);
                setState(STATE.STARTED);
                break;
        }    
    }
1007272
private void updateTransition(Collection<Tile> resolved,
                                  Collection<Tile> toResolve,
                                  Tile tile,
                                  Tile neighbor,
                                  String neighborGroup,
                                  Transition newTransition)
    {
        if (!neighborGroup.equals(newTransition.getIn()))
        {
            updateTile(resolved, toResolve, tile, neighbor, newTransition);
        }
    }
1334053
function () {
            /*  special case: just retrieve current state  */
            var state_old = _cs.states[this.__state].state;
            if (arguments.length === 0)
                return state_old;

            /*  determine parameters  */
            var params = $cs.params("state", arguments, {
                state:    { pos: 0, req: true,
                            valid: function (s) { return _cs.state_name2idx(s) !== -1; } },
                func:     { pos: 1, def: undefined },
                min:      {         def: undefined },
                max:      {         def: undefined },
                sync:     {         def: false     }
            });

            /*  if requested state is still not reached...  */
            var sOld = this.__state;
            var sNew = _cs.state_name2idx(params.state);
            if (   ( params.min === true && !params.max          && sNew  >  sOld)
                || (!params.min          &&  params.max === true && sNew  <  sOld)
                || ( params.min === true &&  params.max === true && sNew !== sOld)
                || (!params.min          && !params.max          && sNew !== sOld)) {
                var enqueue = true;
                var cid     = this.id();
                var request = {
                    comp:     this,
                    state:    params.state
                };

                /*  handle the params.func callback using await  */
                if (typeof params.func === "function" && _cs.states.length > 1) {
                    this.await({
                        state:     params.state,
                        direction: (sNew > sOld ? "upward" : "downward"),
                        func:      params.func,
                        spool:     _cs.states[1].state /* the first state after "dead" */
                    });
                }
                if (params.sync) {
                    /*  perform new state transition request (synchronously)  */
                    if (_cs.state_progression_single(request))
                        enqueue = false;

                    /*  delete any old transition request  */
                    if (_cs.state_requests[cid])
                        delete _cs.state_requests[cid];
                }
                if (enqueue) {
                    /*  enqueue new state transition request and trigger
                        state transition progression (asynchronously)  */
                    _cs.state_requests[cid] = request;
                    _cs.hook("ComponentJS:state-invalidate", "none", "requests");
                    _cs.state_progression();
                }
            }
            else {
                /*  still run its optional callback function  */
                if (typeof params.func === "function")
                    params.func.call(this, params.state);
            }

            /*  return old (and perhaps still current) state  */
            return state_old;
        }
1128915
public void transition(CopycatServer.State state) {
    checkThread();

    if (this.state != null && state == this.state.type()) {
      return;
    }

    LOGGER.info("{} - Transitioning to {}", cluster.member().address(), state);

    // Close the old state.
    try {
      this.state.close().get();
    } catch (InterruptedException | ExecutionException e) {
      throw new IllegalStateException("failed to close Raft state", e);
    }

    // Force state transitions to occur synchronously in order to prevent race conditions.
    try {
      this.state = createState(state);
      this.state.open().get();
    } catch (InterruptedException | ExecutionException e) {
      throw new IllegalStateException("failed to initialize Raft state", e);
    }

    stateChangeListeners.forEach(l -> l.accept(this.state.type()));
  }
1170106
function State(config) {
  this._ = require('lodash');

  this._name = config.name;
  this._isInitial = config.isInitial;
  this._isTerminal = config.isTerminal;
  this._outgoingTransitions = config.outgoingTransitions;

  this.accept = config.accept;

  this._validateConfig(config);

  // Transform any value-based transition criteria to be a function
  this._.forEach(this._outgoingTransitions, function (transition) {
    var criteria = transition.criteria;

    // Replace the value-based criteria with a simple comparison function
    if (typeof criteria !== 'function') {
      transition.criteria = function (input) {
        return (input === criteria);
      }
    }
  });
}
676240
private State nextState(State currentState, int i) {
        switch (currentState) {
            case FREE_TEXT:
                return jumpFromFreeText(str, i);
            case PARAM_START:
                return jumpFromParamStart(str, i);
            case PARAM:
                return jumpFromParam(str, i);
            case PARAM_END:
                return jumpFromParamEnd(str, i);
            case ESCAPE_CHAR:
                return State.FREE_TEXT;
            // Should never go here
            default:
                throw UncheckedTemplateException.invalidStateException(currentState);
        }
    }
732424
public synchronized void transition(State newState) throws IllegalStateException {
        if (transitions.containsEntry(currentState, newState)) {
            currentState = newState;
        } else {
            throw new IllegalStateException(String.format(Locale.US,
                    "Attempted invalid transition from %s to %s", currentState, newState));
        }
    }
971946
public void transition (Class<?> clazz, String name, Transition trans)
        throws PersistenceException
    {
        if (!isTransitionApplied(clazz, name) && noteTransition(clazz, name)) {
            try {
                trans.run();

            } catch (PersistenceException e) {
                try {
                    clearTransition(clazz, name);
                } catch (PersistenceException pe) {
                    log.warning("Failed to clear failed transition", "class", clazz, "name", name,
                                pe);
                }
                throw e;

            } catch (RuntimeException rte) {
                try {
                    clearTransition(clazz, name);
                } catch (PersistenceException pe) {
                    log.warning("Failed to clear failed transition", "class", clazz, "name", name,
                                pe);
                }
                throw rte;
            }
        }
    }
519134
function clear() {
        var that = this;
        var state = getInternalState(that);
        var data = state.index;
        var entry = state.first;
        while (entry) {
          entry.removed = true;
          if (entry.previous) entry.previous = entry.previous.next = undefined;
          delete data[entry.index];
          entry = entry.next;
        }
        state.first = state.last = undefined;
        if (DESCRIPTORS) state.size = 0;
        else that.size = 0;
      }
1161168
protected void changeHoverObject (Object newHover)
    {
        if (newHover == _hobject) {
            return;
        }
        Object oldHover = _hobject;
        _hobject = newHover;
        hoverObjectChanged(oldHover, newHover);
    }
1008549
function processInitState(state, action) {
    const { data, persistState, path } = action.payload;
    const pathItems = path.split("/");
    const doNotReplace = persistState;
    const hasData = objectPath.has(state, pathItems);
    if (hasData) {
        if (doNotReplace) {
            // --- has initialised
            // --- force component.state to refresh
            const existingData = objectPath.get(state, pathItems);
            return objectPathImmutable.merge(state, pathItems, existingData);
        }
    }
    return objectPathImmutable.merge(state, pathItems, data);
}
815403
private void resiftAffectedTransitions(final Set<ADTNode<ADTState<I, O>, I, O>> states,
                                           final ADTNode<ADTState<I, O>, I, O> finalizedADS) {

        for (final ADTNode<ADTState<I, O>, I, O> state : states) {

            final List<ADTTransition<I, O>> transitionsToRefine = state.getHypothesisState()
                                                                       .getIncomingTransitions()
                                                                       .stream()
                                                                       .filter(x -> !x.isSpanningTreeEdge())
                                                                       .collect(Collectors.toList());

            for (final ADTTransition<I, O> trans : transitionsToRefine) {
                trans.setTarget(null);
                trans.setSiftNode(finalizedADS);
                this.openTransitions.add(trans);
            }
        }
    }
1246650
private void doRunningStateChange(RunningState newState) {
    RunningState oldState = null;
    JobExecutionStateListener stateListener = null;
    this.changeLock.lock();
    try {
      // verify transition
      if (null == this.runningState) {
        Preconditions.checkState(RunningState.PENDING == newState);
      }
      else {
        Preconditions.checkState(EXPECTED_PRE_TRANSITION_STATES.get(newState).contains(this.runningState),
            "unexpected state transition " + this.runningState + " --> " + newState);
      }

      oldState = this.runningState;
      this.runningState = newState;
      if (this.listener.isPresent()) {
        stateListener = this.listener.get();
      }
      this.runningStateChanged.signalAll();
    }
    finally {
      this.changeLock.unlock();
    }
    if (null != stateListener) {
      stateListener.onStatusChange(this, oldState, newState);
    }
  }
391749
def on_state_changed(self, state):
        
        if state:
            self.editor.painted.connect(self._paint_margin)
            self.editor.repaint()
        else:
            self.editor.painted.disconnect(self._paint_margin)
            self.editor.repaint()
634301
def change_state_to(state_name, new_state, trigger = true)
      # use an instance variable for the state storage
      ivar_name = :"@#{state_name}"

      old_state = instance_variable_get(ivar_name)
      instance_variable_set(ivar_name, new_state)

      # Trigger changed on the 'state' method
      if old_state != new_state && trigger
        dep = state_dep_for(state_name, false)
        dep.changed! if dep
      end
    end
661327
def on_state_changed(self, state):
        
        if state:
            self.editor.painted.connect(self._paint_margins)
            self.editor.key_pressed.connect(self._on_key_pressed)
            self.editor.repaint()
        else:
            self.editor.painted.disconnect(self._paint_margins)
            self.editor.key_pressed.disconnect(self._on_key_pressed)
            self.editor.repaint()