/*
Serialize all update of state.  Ensure that the current state is the same State that
was evaluated. If not, throw an exception

(non-Javadoc)
@see org.fsm.Persister#setCurrent(org.fsm.model.State, org.fsm.model.State)
495672
@Override
	public void setCurrent(T stateful, State<T> current, State<T> next) throws StaleStateException {
		synchronized(stateful) {
			if (this.getCurrent(stateful).equals(current)) {
				this.setCurrent(stateful, next);
			} else {
				throw new StaleStateException();
			}
		}
	}
437207
private void setState(State newState) {
        m_logger.debug("Entering state: {}", newState.toString());
        synchronized (m_stateChangeLock) {
            m_state = newState;
            m_stateChangeLock.notifyAll();
        }
    }
428651
public GetOfferingStatusResult withCurrent(java.util.Map<String, OfferingStatus> current) {
        setCurrent(current);
        return this;
    }
609715
public function setCurrent(): void
	{
		$this->current = true;
		$parent = $this->parent;
		if ($parent instanceof Item) {
			$parent->setCurrent();
		}
	}
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");
  }
208574
function updateCurrentInput(input) {
    if (input !== currentInput) {
      body.classList.remove(`current-input-${currentInput}`);
      body.classList.add(`current-input-${input}`);
      currentInput = input;
    }
  }
1160293
protected function setNextState($current_state, $executed)
	{
		try
		{
			$next_state = $current_state->getNextState();
		}
		catch(ClassNotFoundException $e)
		{
			Session::put('Errors', new MessageBag( array("Class" => "Class not found") ) );
			return false;
		}

		if($executed)
		{
			// append next state
			$this->append($next_state);
		}
		else
		{
			// replace current state
			$this->replaceCurrent($next_state);
		}

		return true;
	}
572985
public static void setCurrent(SiteContext current) {
        threadLocal.set(current);

        MDC.put(SITE_NAME_MDC_KEY, current.getSiteName());
    }
326195
public boolean isCurrentState(String s) {
        if (currentState == null) {
            return false;
        }
        return currentState.name.equals(s);
    }
274682
private boolean toState(LifecycleState newState)
  {
    LifecycleState state;
    
    synchronized (this) {
      state = _state;
      _state = newState;

      _lastChangeTime = CurrentTime.currentTime();
    }

    if (_log != null && _log.isLoggable(_lowLevel)) {
      _log.log(_lowLevel, newState + " " + _name);
    }

    notifyListeners(state, newState);

    return true;
  }
202437
function setCurrent (state, type, value) {
  let dest
  if (type === 'file') {
    dest = utils.getRefFilePath(value)
  }

  if (dest) {
    state.current = dest
  }
}
10492
public void setStateBackend(StateBackend backend) {
		if (backend != null) {
			try {
				InstantiationUtil.writeObjectToConfig(backend, this.config, STATE_BACKEND);
			} catch (Exception e) {
				throw new StreamTaskException("Could not serialize stateHandle provider.", e);
			}
		}
	}
1077287
def setCurrent(self, state=True):
        
        if self._current == state:
            return False
        
        widget = self.viewWidget()
        if widget:
            for other in widget.findChildren(type(self)):
                if other.isCurrent():
                    other._current = False
                    if not other.signalsBlocked():
                        other.currentStateChanged.emit(state)
                        other.deactivated.emit()
        
        self._current = state
        
        if not self.signalsBlocked():
            self.currentStateChanged.emit(state)
            if state:
                self.activated.emit()
            else:
                self.deactivated.emit()
        return True
999950
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      log.debug("State changed: {}", state);
    }
  }
981718
private synchronized void changeState(PrimitiveState state) {
    if (this.state != state) {
      this.state = state;
      stateChangeListeners.forEach(l -> threadContext.execute(() -> l.accept(state)));
    }
  }
454020
protected function setCurrent($model)
    {
        $this->currentModel = get_class($model);
        $this->currentTable = $this->getTable($model);
    }
1112659
private void changeStateTo(int newState) {
    synchronized (lockObject) {
      int oldState = this.status.getRunState();
      if (oldState == newState) {
        return; //old and new states are same
      }
      this.status.setRunState(newState);
    }
  }