Adds the newState and the edge between the currentState and the newState on the SFG.

@param newState  the new state.
@param eventable the clickable causing the new state.
@return the clone state iff newState is a clone, else returns null
778882
private StateVertex addStateToCurrentState(StateVertex newState, Eventable eventable) {
		LOGGER.debug("addStateToCurrentState currentState: {} newState {}",
				currentState.getName(), newState.getName());

		// Add the state to the stateFlowGraph. Store the result
		StateVertex cloneState = stateFlowGraph.putIfAbsent(newState);

		// Is there a clone detected?
		if (cloneState != null) {
			LOGGER.info("CLONE State detected: {} and {} are the same.", newState.getName(),
					cloneState.getName());
			LOGGER.debug("CLONE CURRENT STATE: {}", currentState.getName());
			LOGGER.debug("CLONE STATE: {}", cloneState.getName());
			LOGGER.debug("CLONE CLICKABLE: {}", eventable);
			boolean added = stateFlowGraph.addEdge(currentState, cloneState, eventable);
			if (!added) {
				LOGGER.debug("Clone edge !! Need to fix the crawlPath??");
			}
		} else {
			stateFlowGraph.addEdge(currentState, newState, eventable);
			LOGGER.info("State {} added to the StateMachine.", newState.getName());
		}

		return cloneState;
	}
1163032
function (newState, newMetaState, options) {
      var args = Util.resolveArgs(
        arguments,
        'newState', function (x) { return Imm.Map.isMap(x) ? 'newMetaState' : null; }, '?options'
      );

      var effectiveOptions = args.options || {};

      var tx = this.getBinding().atomically();
      tx.set(newState);

      if (args.newMetaState) tx.set(this.getMetaBinding(), args.newMetaState);

      tx.commit({ notify: effectiveOptions.notify });
    }
955558
@Nonnull
  @ReturnsMutableCopy
  public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final ELEMENTTYPE aValue)
  {
    final NonBlockingStack <ELEMENTTYPE> ret = newStack ();
    ret.push (aValue);
    return ret;
  }
1016421
public static WindowState getWindowState(String state) {
        if (state == null) {
            return null;
        }

        final WindowState windowState = WINDOW_STATES.get(state);
        if (windowState != null) {
            return windowState;
        }

        return new WindowState(state);
    }
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;
  }
689800
public Bundle saveInstanceState(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            savedInstanceState.putBoolean(BUNDLE_CROSS_FADED, mCrossFadeSlidingPaneLayout.isOpen());
        }
        return savedInstanceState;
    }
1021039
def setExpanded( self, state ):
        
        self._expanded = state
        self._widget.setVisible(state)
        
        if ( state ):
            ico = projexui.resources.find('img/treeview/triangle_down.png')
        else:
            ico = projexui.resources.find('img/treeview/triangle_right.png')
        
        self._titleButton.setIcon(QIcon(ico))
        
        # emit the signals for this widget
        rollout = self.rolloutWidget()
        if ( not rollout.signalsBlocked() ):
            index = rollout.widget().layout().indexOf(self)
            
            rollout.itemCollapsed.emit(index)
            rollout.itemExpanded.emit(index)
878898
def _add_new_state(self, *event, **kwargs):
        
        if react_to_event(self.view, self.view.editor, event):
            state_type = StateType.EXECUTION if 'state_type' not in kwargs else kwargs['state_type']
            return gui_helper_state_machine.add_new_state(self.model, state_type)
946726
protected S state(S newState) {
        S oldState = state;
        state = newState;
        return oldState;
    }
618198
protected void setAdminState(AdminStates newState) {
    if (newState == AdminStates.NORMAL) {
      adminState = null;
    }
    else {
      adminState = newState;
    }
  }
1128474
void gotoState(@Nonnull ConnectivityState newState) {
    checkNotNull(newState, "newState");
    if (state != newState && state != ConnectivityState.SHUTDOWN) {
      state = newState;
      if (listeners.isEmpty()) {
        return;
      }
      // Swap out callback list before calling them, because a callback may register new callbacks,
      // if run in direct executor, can cause ConcurrentModificationException.
      ArrayList<Listener> savedListeners = listeners;
      listeners = new ArrayList<>();
      for (Listener listener : savedListeners) {
        listener.runInExecutor();
      }
    }
  }
1045598
public void addState() {
        DiffHistoryDataState nextState = new DiffHistoryDataState(stateEngine, typeDiffInstructions);

        if(currentDataState != null)
            newHistoricalState(currentDataState, nextState);

        currentDataState = nextState;
    }
1029155
public boolean compareAndSet(T expectedState, T newState)
    {
        checkState(!Thread.holdsLock(lock), "Can not set state while holding the lock");
        requireNonNull(expectedState, "expectedState is null");
        requireNonNull(newState, "newState is null");

        FutureStateChange<T> futureStateChange;
        ImmutableList<StateChangeListener<T>> stateChangeListeners;
        synchronized (lock) {
            if (!state.equals(expectedState)) {
                return false;
            }

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

            checkState(!isTerminalState(state), "%s can not transition from %s to %s", name, state, newState);

            state = newState;

            futureStateChange = this.futureStateChange.getAndSet(new FutureStateChange<>());
            stateChangeListeners = ImmutableList.copyOf(this.stateChangeListeners);

            // if we are now in a terminal state, free the listeners since this will be the last notification
            if (isTerminalState(state)) {
                this.stateChangeListeners.clear();
            }
        }

        fireStateChanged(newState, futureStateChange, stateChangeListeners);
        return true;
    }
10227
public void appendBranchState(int start, int end, BranchCoverageState state) {
		this.passed.put(new Range(start, end), state);
	}
717979
@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		
		EVENT_CONFIGURATION = EventLinker.Configuration.newInstance(this);
	}
26692
private JButton getNewSessionButton() {
		if (newSessionButton == null) {
			newSessionButton = new JButton();
			newSessionButton.setText(Constant.messages.getString("httpsessions.toolbar.newsession.label"));
			newSessionButton.setIcon(DisplayUtils.getScaledIcon(new ImageIcon(HttpSessionsPanel.class.getResource("/resource/icon/16/103.png"))));
			newSessionButton.setToolTipText(Constant.messages.getString("httpsessions.toolbar.newsession.tooltip"));

			newSessionButton.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					HttpSessionsSite site = getCurrentHttpSessionSite();
					if (site != null) {
						site.createEmptySession();
					}
				}
			});

		}
		return newSessionButton;
	}
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();
		}
	}