Sets the state machine for this instance.

@since [*next-version*]

@param StateMachineInterface|null $stateMachine The state machine instance or null
162567
protected function _setStateMachine($stateMachine)
    {
        if ($stateMachine !== null && !($stateMachine instanceof StateMachineInterface)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state machine instance'),
                null,
                null,
                $stateMachine
            );
        }

        $this->stateMachine = $stateMachine;
    }
260180
public static function create(StateMachineInterface $sm, array $from = array(), array $to = array(), array $on = array(), $callable = null)
    {
        return new self($sm, $from, $to, $on, $callable);
    }
698502
public static void setState(ParseState state) {

    if (state == null) {
      System.err.println("Null state found");
      Environment.logInfo("Null state found");
    }

    persData.setProperty(state.filename, state.firstLine + SEPARATOR + state.offset);
  }
1237284
protected function addState(StateInterface $state)
    {
        if ($this->targetCollection instanceof StateCollection) {
            $this->targetCollection->addState($state);
        } else {
            throw new \InvalidArgumentException('TargetCollection has to be a StateCollection. Overwrite this method to implement a different type!');
        }
    }
1122264
public function setState($state)
		{
		$r = array_pop($this->states);
		array_push($this->states, $state);
		$this->state = $this->states[count($this->states) - 1];
		return $r;
		}
738758
protected function createLoggerContext(StatemachineInterface $stateMachine)
    {
        $context = array();
        $context[self::CONTEXT_SUBJECT] = $stateMachine->getSubject();
        $context[self::CONTEXT_CURRENT_STATE] = $stateMachine->getCurrentState();
        if ($stateMachine instanceof Statemachine) {
            $context[self::CONTEXT_LAST_STATE] = $stateMachine->getLastState();
            $context[self::CONTEXT_TRANSITION] = $stateMachine->getSelectedTransition();
        }

        return $context;
    }
999950
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      log.debug("State changed: {}", state);
    }
  }
140720
public static function activate_state($state)
    {
        foreach (self::variants() as $variant => $instance) {
            if (isset($state[$variant]) && $instance->appliesToEnvironment()) {
                $instance->activateState($state[$variant]);
            }
        }
    }
854428
public function setUnsetStatesOnly(array $stateValues)
    {
        foreach ($stateValues as $key => $value) {
            if (null === $this->getState($key, null)) {
                $this->setState($key, $value);
            }
        }
    }
1361201
def setup_statemachine(self):
        """"""

        machine = QtCore.QStateMachine()

        #  _______________
        # |               |
        # |               |
        # |               |
        # |_______________|
        #
        group = util.QState("group", QtCore.QState.ParallelStates, machine)

        #  _______________
        # | ____     ____ |
        # ||    |---|    ||
        # ||____|---|____||
        # |_______________| - Parallell State
        #
        visibility = util.QState("visibility", group)

        hidden = util.QState("hidden", visibility)
        visible = util.QState("visible", visibility)

        #  _______________
        # | ____     ____ |
        # ||    |---|    ||
        # ||____|---|____||
        # |_______________| - Parallell State
        #
        operation = util.QState("operation", group)

        ready = util.QState("ready", operation)

        collecting = util.QState("collecting", operation)
        validating = util.QState("validating", operation)
        extracting = util.QState("extracting", operation)
        integrating = util.QState("integrating", operation)

        finished = util.QState("finished", operation)
        repairing = util.QState("repairing", operation)
        initialising = util.QState("initialising", operation)
        stopping = util.QState("stopping", operation)
        stopped = util.QState("stopped", operation)
        saving = util.QState("saving", operation)

        #  _______________
        # | ____     ____ |
        # ||    |---|    ||
        # ||____|---|____||
        # |_______________| - Parallell State
        #
        errored = util.QState("errored", group)

        clean = util.QState("clean", errored)
        dirty = util.QState("dirty", errored)

        #  _______________
        # | ____     ____ |
        # ||    |---|    ||
        # ||____|---|____||
        # |_______________| - Parallell State

        # States that block the underlying GUI
        suspended = util.QState("suspended", group)

        alive = util.QState("alive", suspended)
        acting = util.QState("acting", suspended)
        acted = QtCore.QHistoryState(operation)
        acted.setDefaultState(ready)

        #  _______________
        # | ____     ____ |
        # ||    |---|    ||
        # ||____|---|____||
        # |_______________|
        # | ____     ____ |
        # ||    |---|    ||
        # ||____|---|____||
        # |_______________|
        #

        hidden.addTransition(self.show, visible)
        visible.addTransition(self.hide, hidden)

        ready.addTransition(self.acting, acting)
        ready.addTransition(self.validating, validating)
        ready.addTransition(self.initialising, initialising)
        ready.addTransition(self.repairing, repairing)
        ready.addTransition(self.saving, saving)
        saving.addTransition(self.saved, ready)

        collecting.addTransition(self.initialised, ready)
        collecting.addTransition(self.stopping, stopping)

        validating.addTransition(self.stopping, stopping)
        validating.addTransition(self.finished, finished)
        validating.addTransition(self.extracting, extracting)

        extracting.addTransition(self.stopping, stopping)
        extracting.addTransition(self.finished, finished)
        extracting.addTransition(self.integrating, integrating)

        integrating.addTransition(self.stopping, stopping)
        integrating.addTransition(self.finished, finished)

        finished.addTransition(self.initialising, initialising)
        finished.addTransition(self.acting, acting)
        initialising.addTransition(self.collecting, collecting)
        stopping.addTransition(self.acted, acted)
        stopping.addTransition(self.finished, finished)

        dirty.addTransition(self.initialising, clean)
        clean.addTransition(self.changed, dirty)

        alive.addTransition(self.acting, acting)
        acting.addTransition(self.acted, acted)

        # Set initial states
        for compound, state in {machine: group,
                                visibility: hidden,
                                operation: ready,
                                errored: clean,
                                suspended: alive}.items():
            compound.setInitialState(state)

        # Make connections
        for state in (hidden,
                      visible,
                      ready,
                      collecting,
                      validating,
                      extracting,
                      integrating,
                      finished,
                      repairing,
                      initialising,
                      stopping,
                      saving,
                      stopped,
                      dirty,
                      clean,
                      acting,
                      alive,
                      acted):
            state.entered.connect(
                lambda state=state: self.state_changed.emit(state.name))

        machine.start()
        return machine
16170
public function setSeriesState($series, $state = 10)
    {
        switch ($state) {
            case $this::SERIES_STATE_ALL_ACTIVE:
                $this->setState($series, true, true);
                break;
            case $this::SERIES_STATE_ALL_INACTIVE:
                $this->setState($series, false, false);
                break;
            case $this::SERIES_STATE_SERIES_ACTIVE_ONLY:
                $this->setState($series, true, false);
                break;
            case $this::SERIES_STATE_EPISODES_ACTIVE_ONLY:
                $this->setState($series, false, true);
                break;
            default:
                break;
        }
    }
1291569
public function setCurrentState(CurrentState $state)
    {
        $outputStream = $this->_outputChannel->getOutputStream($this->_endpoint);
        $this->_serializer->serialize($state, $outputStream);
        fclose($outputStream);
    }
481453
public function setModel(Model $model)
    {
        $this->model = $model;
        $this->fm = $this->model->loadFunctionMap();
    }
283942
protected function _setState($state)
    {
        if ($state !== null && !is_string($state) && !($state instanceof Stringable)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state'),
                null,
                null,
                $state
            );
        }

        $this->state = $state;
    }
512351
protected void setState(int newState) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setState", newState);

        synchronized (stateLock) {
            if ((newState == JmsInternalConstants.CLOSED)
                || (newState == JmsInternalConstants.STOPPED)
                || (newState == JmsInternalConstants.STARTED)) {
                state = newState;
                stateLock.notifyAll();
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setState");
    }
538
protected function setState($state)
    {
        if (!in_array($state, $this->config['states'])) {
            throw new SMException(sprintf(
                'Cannot set the state to "%s" to object "%s" with graph %s because it is not pre-defined.',
                $state,
                get_class($this->object),
                $this->config['graph']
            ));
        }

        $accessor = new PropertyAccessor();
        $accessor->setValue($this->object, $this->config['property_path'], $state);
    }
757956
public function setStartState($stateId)
    {
        $state = $this->stateMachine->getState(StateMachine::STATE_INITIAL);
        if ($state === null) {
            $state = new InitialState(StateMachine::STATE_INITIAL);
            $this->stateMachine->addState($state);
        }

        $this->addTransition(StateMachine::STATE_INITIAL, $stateId, StateMachine::EVENT_START);
    }