Add state to the state machine

@param integer|string $state
199653
public function addState($state)
    {
        $this->_states[$state] = $state;

        if ($this->_currentState === null) {
            $this->_currentState = $state;
        }
    }
595083
protected function addToLog($state, $return = NULL)
    {
        $data['name'] = $state;

        if (NULL !== $return) {
            $data['return'] = $return;
        }
        $this->log[] = $data;
    }
947738
public function setState($state)
    {
        $oldState = $this->getState();

        if ($oldState === $state) {
            return $this;
        }

        $this->getLogger()->debug('Changing state from: '.$oldState.' to: '.$state.'.');
        $this->state = $state;

        return $this;
    }
1232886
private function addCallback(string $method, $state) : void
    {
        $state = $this->makeCallable($state);
        $this->actions[$method] = $state;
    }
1178931
protected function setState($state)
    {
        if (!array_key_exists($state, $this->stateDirectives)) {
            throw new InvalidArgumentException("Invalid state {$state}");
        }
        $this->state = $state;
        return $this;
    }
1261352
public void addState(String name, S state)
    {
        AbstractState old = states.put(name, new StateWrapper(name, state));
        if (old != null)
        {
            throw new IllegalArgumentException("state "+name+" exists already");
        }
    }
706219
public function setValue(int $state): bool
    {
        if ($this->type == GPIO::IN) {
            throw new GPIOException('Setting the value of a GPIO input pin is not supported!');
        }
        return $this->adapter->write($this->pin, $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);
    }
1291569
public function setCurrentState(CurrentState $state)
    {
        $outputStream = $this->_outputChannel->getOutputStream($this->_endpoint);
        $this->_serializer->serialize($state, $outputStream);
        fclose($outputStream);
    }
864993
public void setState(String state)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "setState", state);

    this.state = state;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "setState");
  }
365576
def add(self, action):
        """"""
        self._state_machine.transition_to_add()
        self._actions.append(action)
1327702
protected void setState(State state) {
        if (DEBUG)
            LOG.debug("{} --> {}", _state, state);
        _state = state;
    }
356432
function setState($state) {
		if($state == (self::WINDOW_DOOR_SENSOR_STATE_OPEN or self::WINDOW_DOOR_SENSOR_STATE_CLOSED))
			$this->state = $state;
		else
			throw new \Exception('Invalid WindowDoorSensor state "'.$state.'"');
	}
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;
    }
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;
		}
422840
public function setState(int $state): ControllerInterface
    {
        switch ($state) {
            case self::STATE_PLAYING:
                return $this->play();
            case self::STATE_PAUSED:
                return $this->pause();
            case self::STATE_STOPPED:
                return $this->pause();
        }
        throw new \InvalidArgumentException("Unknown state: {$state})");
    }
860975
def addstate ( ps )
      raise TypeError, ps.class.to_s + ': Incorrectly types for \'<<\' method of <Parser>.' unless
	ps.instance_of? State
      @states << ps
    end