This method is called for shift actions.

@param newState
is the new state id after shift.
@param token
is the current token in token stream.
@throws ParserException
177068
private final void shift(ParserAction action) {
	stateStack.push(action.getParameter());
	actionStack.add(action);
	streamPosition++;
	shiftIgnoredTokens();
    }
1156297
void setState(final WorldState state) {
		if (this.ready) {
			throw new IllegalStateException(
					"Cannot reassign the world state of a response.");
		}
		this.state = state;
		this.ready = true;
		// Notify any blocking/waiting threads
		synchronized (this) {
			this.notifyAll();
		}
	}
824836
public final void mTRUE() throws RecognitionException {
        try {
            int _type = TRUE;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // MessageFilter.g:51:6: ( 'true' )
            // MessageFilter.g:51:8: 'true'
            {
            match("true"); 



            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        	// do for sure before leaving
        }
    }
325021
protected final void setState(final int newState)
	{
		if (closing < 2) {
			//  detect and ignore order of arrival inversion for tunneling.ack/cEMI.con
			if (internalState == OK && newState == ClientConnection.CEMI_CON_PENDING)
				return;
			internalState = newState;
			if (updateState)
				state = newState;
		}
		else
			state = internalState = CLOSED;
	}
1320653
public void setState(S state){
		Integer id = definition.getStateId(state);
		currentStateId.set(id);
	}
1298858
protected final synchronized void transitionState(OperationState newState) {
    getLogger().debug("Transitioned state from %s to %s", state, newState);
    state = newState;
    // Discard our buffer when we no longer need it.
    if(state != OperationState.WRITE_QUEUED
        && state != OperationState.WRITING) {
      cmd = null;
    }
    if (state == OperationState.COMPLETE) {
      callback.complete();
    }
  }
595393
protected final void setStateNotify(final int newState)
	{
		synchronized (lock) {
			setState(newState);
			if (newState == OK && !inBlockingSend)
				this.sendWaitQueue.release(false);
			// worst case: we notify 2 threads, the closing one and 1 sending
			lock.notifyAll();
		}
	}
770543
private void handleToken(String token) throws OptionParserException {
        currentToken = token;
        if (!"--".equals(token)) {
            if (currentOption != null && currentOption.acceptsValue() &&
                    !currentOption.isWithEqualSign() && isArgument(token)) {
                String t = OptionUtils.stripLeadingAndTrailingQuotes(token);
                currentOption.addValue(t);
            } else if (token.startsWith("--")) {
                String t = OptionUtils.stripLeadingHyphens(token);
                handleLongOption(t);
            } else if (token.startsWith("-") && token.length() > 1) {
                String t = OptionUtils.stripLeadingHyphens(token);
                handleShortAndLongOption(t);
            } else {
                handleUnknownToken(token);
            }
        }
        if (currentOption != null && !currentOption.acceptsValue()) {
            currentOption = null;
        }
    }
343063
void changeState(State state) {

        m_state = state;
        switch (state) {
            case validationRunning:
                m_cancelButton.setEnabled(false);
                m_okButton.setEnabled(false);
                clearValidationError();
                break;
            case validationFailed:
                m_okButton.setEnabled(false);
                m_cancelButton.setEnabled(true);
                break;
            case validationUnknown:
            default:
                m_cancelButton.setEnabled(true);
                m_okButton.setEnabled(true);
                clearValidationError();
                break;

        }
    }
524286
protected void changeState(final State newState) {
        if (state.compareAndSet(newState.oppositeState(), newState)) {
            changeSupport.firePropertyChange(PROPERTY_NAME, !isOpen(newState), isOpen(newState));
        }
    }
322735
public final void shiftOp() throws RecognitionException {
		int shiftOp_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 121) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1183:5: ( ( '<' '<' | '>' '>' '>' | '>' '>' ) )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1183:7: ( '<' '<' | '>' '>' '>' | '>' '>' )
			{
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1183:7: ( '<' '<' | '>' '>' '>' | '>' '>' )
			int alt153=3;
			int LA153_0 = input.LA(1);
			if ( (LA153_0==53) ) {
				alt153=1;
			}
			else if ( (LA153_0==56) ) {
				int LA153_2 = input.LA(2);
				if ( (LA153_2==56) ) {
					int LA153_3 = input.LA(3);
					if ( (synpred228_Java()) ) {
						alt153=2;
					}
					else if ( (true) ) {
						alt153=3;
					}

				}

				else {
					if (state.backtracking>0) {state.failed=true; return;}
					int nvaeMark = input.mark();
					try {
						input.consume();
						NoViableAltException nvae =
							new NoViableAltException("", 153, 2, input);
						throw nvae;
					} finally {
						input.rewind(nvaeMark);
					}
				}

			}

			else {
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 153, 0, input);
				throw nvae;
			}

			switch (alt153) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1183:8: '<' '<'
					{
					match(input,53,FOLLOW_53_in_shiftOp5373); if (state.failed) return;
					match(input,53,FOLLOW_53_in_shiftOp5375); if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1183:18: '>' '>' '>'
					{
					match(input,56,FOLLOW_56_in_shiftOp5379); if (state.failed) return;
					match(input,56,FOLLOW_56_in_shiftOp5381); if (state.failed) return;
					match(input,56,FOLLOW_56_in_shiftOp5383); if (state.failed) return;
					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1183:32: '>' '>'
					{
					match(input,56,FOLLOW_56_in_shiftOp5387); if (state.failed) return;
					match(input,56,FOLLOW_56_in_shiftOp5389); if (state.failed) return;
					}
					break;

			}

			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 121, shiftOp_StartIndex); }

		}
	}
1150864
public final void nextState (final IState newState) throws InternetSCSIException {

        this.state = newState;
        if (this.state != null) {
            do {
                this.state.execute();
                LOGGER.info("State is following: " + this.state.nextStateFollowing());
            } while (this.state.nextStateFollowing());
        }

    }
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);
    }
  }
913815
protected void setState(FieldState state) {
        if (DEBUG)
            LOG.debug("{}:{} --> {}", _state, _field != null ? _field : _headerString != null ? _headerString : _string, state);
        _fieldState = state;
    }
504226
public boolean setIf(T newState, Predicate<T> predicate)
    {
        checkState(!Thread.holdsLock(lock), "Can not set state while holding the lock");
        requireNonNull(newState, "newState is null");

        while (true) {
            // check if the current state passes the predicate
            T currentState = get();

            // change to same state is not a change, and does not notify the notify listeners
            if (currentState.equals(newState)) {
                return false;
            }

            // do not call predicate while holding the lock
            if (!predicate.test(currentState)) {
                return false;
            }

            // if state did not change while, checking the predicate, apply the new state
            if (compareAndSet(currentState, newState)) {
                return true;
            }
        }
    }
3248
function ContentDialog_setState(NewState, arg0) {
                    if (!this._disposed) {
                        this._state && this._state.exit();
                        this._state = new NewState();
                        this._state.dialog = this;
                        this._state.enter(arg0);
                    }
                }
437207
private void setState(State newState) {
        m_logger.debug("Entering state: {}", newState.toString());
        synchronized (m_stateChangeLock) {
            m_state = newState;
            m_stateChangeLock.notifyAll();
        }
    }