Utility method to update named state
774503
function (name, state) {
        if (!module.exports.operations.validateState || module.exports.operations.validateState(state)) {
            module.exports.config.states[name] = state;
        } else {
            log.error('Unable to update invalid state:', state, 'with name:', name);
        }
    }
383582
public StateMachine newStateMachine(String name) {
        StateMachine stateMachine = new StateMachine(name);
        stateMachines.add(stateMachine);
        return stateMachine;
    }
1159655
def _setState(self, name, value):
        ""
        d = self.getObjectId()

        @d.addCallback
        def set(objectid):
            return self.db.state.setState(objectid, name, value)
        return d
425805
def update(self, name):
        

        if name is None:
            return

        if name not in self._names:
            # add the name if it isn't already tracked
            self._names[name] = len(self._names)

        result = self._names[name] - self._current
        self._current = self._names[name]
        return result
877893
public static void updateState(String filename, String firstLine, long offset) {

    ParseState ps = getState(filename);

    if (firstLine != null)
      ps.firstLine = firstLine;

    ps.offset = offset;

    setState(ps);
  }
1153030
@Override
    protected void updateState(final String name, final InstallationModificationImpl modification, final InstallationModificationImpl.InstallationState state) {
        final PatchableTarget.TargetInfo identityInfo = modification.getModifiedState();
        this.identity = new Identity() {
            @Override
            public String getVersion() {
                return modification.getVersion();
            }

            @Override
            public String getName() {
                return name;
            }

            @Override
            public TargetInfo loadTargetInfo() throws IOException {
                return identityInfo;
            }

            @Override
            public DirectoryStructure getDirectoryStructure() {
                return modification.getDirectoryStructure();
            }
        };

        this.allPatches = Collections.unmodifiableList(modification.getAllPatches());
        this.layers.clear();
        for (final Map.Entry<String, MutableTargetImpl> entry : state.getLayers().entrySet()) {
            final String layerName = entry.getKey();
            final MutableTargetImpl target = entry.getValue();
            putLayer(layerName, new LayerInfo(layerName, target.getModifiedState(), target.getDirectoryStructure()));
        }
        this.addOns.clear();
        for (final Map.Entry<String, MutableTargetImpl> entry : state.getAddOns().entrySet()) {
            final String addOnName = entry.getKey();
            final MutableTargetImpl target = entry.getValue();
            putAddOn(addOnName, new LayerInfo(addOnName, target.getModifiedState(), target.getDirectoryStructure()));
        }
    }
77820
def PushState(self, **unused_kwargs):
    """"""
    logging.debug('Storing state {0:s}'.format(repr(self.state)))
    self.state_stack.append(self.state)
266418
function (event) {
      var target = event.target;
      var key = target.getAttribute('name');
      var nextState = {};
      nextState[key] = target.value;
      this.setState(nextState);
    }
546423
def update_state_changes(self, state_changes_data: List[Tuple[str, int]]) -> None:
        """"""
        cursor = self.conn.cursor()
        cursor.executemany(
            'UPDATE state_changes SET data=? WHERE identifier=?',
            state_changes_data,
        )
        self.maybe_commit()
1289294
function(name) {
        if (!this._states.hasOwnProperty(name))
          throw new Error('unknown state "'+name+'"')

        var extraArgs = _.toArray(arguments).slice(1)
        this.currentState = name
        this._callCallbacks(this._states[name].enter, extraArgs)
      }
275530
function syncSetState (newState) {
  // Mutation is faster and should be safe here.
  this.state = assign(
    this.state,
    isFunction(newState) ?
      newState(this.state, this.props) :
      newState
  );
}
1352804
def update(self, name, modifiers):
        """"""
        self.update_name(name)
        self.modifiers = modifiers
279417
def _initilize(self, state: State) -> State:
        """"""

        targets = {}
        for pc, instr in enumerate(self):
            if isinstance(instr, Label):
                targets[instr.target] = pc

        state = state.update({PC: 0,
                              TARGETS: targets,
                              NAMEDGATES: STDGATES.copy()})
        return state
856054
private void setState(int[] nextState)
                    throws StateErrorException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "setState",
                        new Object[] { nextState,
                                      new Integer(state),
                                      stateNames[state] });

        synchronized (stateLock) {
            previousState = state; // Capture the previous state for dump. 
            state = nextState[state]; // Make the state change.       
        } // synchronized (stateLock)  

        if (state == stateError) {
            StateErrorException stateErrorException = new StateErrorException(this, previousState, stateNames[previousState]);
            ObjectManager.ffdc.processException(this, cclass, "setState", stateErrorException, "1:2016:1.34");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           "setState",
                           new Object[] { stateErrorException,
                                         new Integer(state),
                                         stateNames[state] });
            throw stateErrorException;
        } // if (state == stateError).  

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this
                       , cclass
                       , "setState"
                       , "state=" + state + "(int) " + stateNames[state] + "(String)"
                            );
    }
399857
function state(list, sortMethod)
{
  var isNamedList = !Array.isArray(list)
    , initState =
    {
      index    : 0,
      keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
      jobs     : {},
      results  : isNamedList ? {} : [],
      size     : isNamedList ? Object.keys(list).length : list.length
    }
    ;

  if (sortMethod)
  {
    // sort array keys based on it's values
    // sort object's keys just on own merit
    initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
    {
      return sortMethod(list[a], list[b]);
    });
  }

  return initState;
}
880671
function _updateCheckedState(name) {
        var mapping = _optionMapping[name];
        if (!mapping) {
            return;
        }
        CommandManager.get(mapping).setChecked(PreferencesManager.get(name));
    }
1023969
function State(state) {
    if ( state === void 0 ) state = {};

    Object.defineProperty(this, "_", {
        value: new Subscriber()
    });
    this.update(state);
}