constructor for states so only curated states end up getting called
554855
function State(template, easyButton){

  this.title = template.title;
  this.stateName = template.stateName ? template.stateName : 'unnamed-state';

  // build the wrapper
  this.icon = L.DomUtil.create('span', '');

  L.DomUtil.addClass(this.icon, 'button-state state-' + this.stateName.replace(/(^\s*|\s*$)/g,''));
  this.icon.innerHTML = buildIcon(template.icon);
  this.onClick = L.Util.bind(template.onClick?template.onClick:function(){}, easyButton);
}
873553
def state_with_scope(*args)
      names = state_without_scope(*args)
      names.each { |name| create_scope(name) if create_scope?(name) }
    end
267333
def _process_new_state(cls, new_state, unprocessed, processed):
        """"""
        if isinstance(new_state, str):
            # an existing state
            if new_state == '#pop':
                return -1
            elif new_state in unprocessed:
                return (new_state,)
            elif new_state == '#push':
                return new_state
            elif new_state[:5] == '#pop:':
                return -int(new_state[5:])
            else:
                assert False, 'unknown new state %r' % new_state
        elif isinstance(new_state, combined):
            # combine a new state from existing ones
            tmp_state = '_tmp_%d' % cls._tmpname
            cls._tmpname += 1
            itokens = []
            for istate in new_state:
                assert istate != new_state, 'circular state ref %r' % istate
                itokens.extend(cls._process_state(unprocessed,
                                                  processed, istate))
            processed[tmp_state] = itokens
            return (tmp_state,)
        elif isinstance(new_state, tuple):
            # push more than one state
            for istate in new_state:
                assert (istate in unprocessed or
                        istate in ('#pop', '#push')), \
                    'unknown new state ' + istate
            return new_state
        else:
            assert False, 'unknown new state def %r' % new_state
1272137
public void collect(ExplorationStep state) {
		final int[] closed = state.pattern;
		final int[] tmp = new int[closed.length];
		final int supportCount = state.counters.transactionsCount;
		
		final LinkedList<Integer> extensions = new LinkedList<Integer>();
		final int newItemsLength = state.counters.closure.length;
		
		if (newItemsLength < closed.length) {
			
			extensions.add(closed[newItemsLength]);
			
			for (int i = 0; i < newItemsLength; i++) {
				// note that the following line uses internal item IDs
				if (state.parent.getFailedFPTest(state.counters.closure[i]) == state.core_item) {
					// but this line uses original item IDs
					extensions.add(closed[i]);
					// the trick is that they have the same indexes in both arrays
				}
			}
			
			enumerateExtensionSets(extensions, 0, closed, tmp, 0, supportCount);
		} else {
			enumerateBasePatternSets(0, closed, tmp, 0, extensions, supportCount);
		}
	}
1050605
def savestate(self, state, chain=-1):
        """"""
        cur_chain = self._chains[chain]
        if hasattr(cur_chain, '_state_'):
            cur_chain._state_[0] = state
        else:
            s = self._h5file.create_vlarray(
                cur_chain,
                '_state_',
                tables.ObjectAtom(),
                title='The saved state of the sampler',
                filters=self.filter)
            s.append(state)
        self._h5file.flush()
1251769
function createLoading(opts = {}) {
  const namespace = opts.namespace || NAMESPACE;

  const {
    only = [], except = []
  } = opts;
  if (only.length > 0 && except.length > 0) {
    throw Error('It is ambiguous to configurate `only` and `except` items at the same time.');
  }

  const initialState = {
    global: false,
    models: {},
    effects: {},
  };

  const extraReducers = {
    [namespace](state = initialState, {
      type,
      payload
    }) {
      const {
        namespace,
        actionType
      } = payload || {};
      let ret;
      switch (type) {
        case SHOW:
          ret = {
            ...state,
            global: true,
            models: { ...state.models,
              [namespace]: true
            },
            effects: { ...state.effects,
              [actionType]: true
            },
          };
          break;
        case HIDE: // eslint-disable-line
          const effects = { ...state.effects,
            [actionType]: false
          };
          const models = {
            ...state.models,
            [namespace]: Object.keys(effects).some((actionType) => {
              const _namespace = actionType.split('/')[0];
              if (_namespace !== namespace) return false;
              return effects[actionType];
            }),
          };
          const global = Object
            .keys(models)
            .some(namespace => models[namespace]);
          ret = {
            ...state,
            global,
            models,
            effects,
          };
          break;
        default:
          ret = state;
          break;
      }
      return ret;
    },
  };

  function onEffect(effect, {
    put
  }, model, actionType) {
    const {
      namespace
    } = model;
    if (
      (only.length === 0 && except.length === 0) ||
      (only.length > 0 && only.indexOf(actionType) !== -1) ||
      (except.length > 0 && except.indexOf(actionType) === -1)
    ) {
      return function* (...args) {
        yield put({
          type: SHOW,
          payload: {
            namespace,
            actionType
          }
        });
        yield effect(...args);
        yield put({
          type: HIDE,
          payload: {
            namespace,
            actionType
          }
        });
      };
    }

    return effect;
  }

  return {
    extraReducers,
    onEffect,
  };
}
660051
def init_checker_state(self, name, argument_names):
        """"""
        if 'checker_state' in argument_names:
            self.checker_state = self._checker_states.setdefault(name, {})
946951
function() {
    var finalState = this.finalState, initialState;

    while(true) {
      initialState = get(finalState, 'initialState') || 'start';
      finalState = get(finalState, 'states.' + initialState);

      if (!finalState) { break; }

      this.finalState = finalState;
      this.enterStates.push(finalState);
      this.contexts.push(undefined);
    }
  }
982489
function() {
    var self = this;
    var currentFilter = self.filterStateModel.getActiveFilter();
    var stateBeforeCancel = {
      name: currentFilter.get("name"),
      attributeFilters: currentFilter.get("attributeFilters") ? currentFilter.get("attributeFilters").toJSON() : null
    };

    currentFilter.cancelFilter();

    self.trigger("filter:cancel", currentFilter.cid, currentFilter, stateBeforeCancel);
  }
47256
function(name, data) {
        if (name === ANY_STATE)
          throw new Error('state name "' + ANY_STATE + '" is forbidden')

        data = _.clone(data)
        data.enter = this._collectMethods((data.enter || []))
        data.leave = this._collectMethods((data.leave || []))
        this._states[name] = data
      }
444055
function useResources(createQueries, queriesToSubscribe) {
  const states = createQueries.map(function (createQuery, index) {
    return queriesToSubscribe[index] ? // eslint-disable-next-line react-hooks/rules-of-hooks
    useRetrieveResourceAndSubscribe(createQuery) : // eslint-disable-next-line react-hooks/rules-of-hooks
    useRetrieveResource(createQuery);
  });
  const nonFetchedStates = states.filter(function (state) {
    return !state.fetched;
  });

  if (nonFetchedStates.length !== 0) {
    return [true, []];
  }

  return [false, states.map(function (state) {
    return state.result;
  })];
}
520466
@Override
	public void initializeState(FunctionInitializationContext context) throws Exception {
		final int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask();
		this.buckets = bucketsBuilder.createBuckets(subtaskIndex);

		final OperatorStateStore stateStore = context.getOperatorStateStore();
		bucketStates = stateStore.getListState(BUCKET_STATE_DESC);
		maxPartCountersState = stateStore.getUnionListState(MAX_PART_COUNTER_STATE_DESC);

		if (context.isRestored()) {
			buckets.initializeState(bucketStates, maxPartCountersState);
		}
	}
299156
void     flagTaggedStates() {
           List<RBBINode> tagNodes = new ArrayList<RBBINode>();
           RBBINode    tagNode;
           int     i;
           int     n;

           fRB.fTreeRoots[fRootIx].findNodes(tagNodes, RBBINode.tag);
           for (i=0; i<tagNodes.size(); i++) {                   // For each tag node t (all of 'em)
               tagNode = tagNodes.get(i);

               for (n=0; n<fDStates.size(); n++) {              //    For each state  s (row in the state table)
                   RBBIStateDescriptor sd = fDStates.get(n);
                   if (sd.fPositions.contains(tagNode)) {       //       if  s include the tag node t
                       sd.fTagVals.add(Integer.valueOf(tagNode.fVal));
                   }
               }
           }
       }
921970
function (state) {
        if (isObject(state)) {
            var current = state.before;
            delete state.before;
            this.fireEvent('pageChange',{
                type      : 'pageChange',
                prevValue : state.page,
                newValue  : current.page,
                prevState : state,
                newState  : current
            });
        }
    }
1223930
@Override
	public void snapshotState(FunctionSnapshotContext context) throws Exception {
		Preconditions.checkState(this.checkpointedState != null,
			"The " + getClass().getSimpleName() + " has not been properly initialized.");

		this.checkpointedState.clear();
		this.checkpointedState.add(this.numElementsEmitted);
	}
258591
function(name) {
    name = name || '';

    var state = null;

    // Only use valid state queries
    if(!_validateStateName(name)) {
      return null;
    
    // Use cache if exists
    } else if(_stateCache[name]) {
      return _stateCache[name];
    }

    var nameChain = _getNameChain(name);
    var stateChain = nameChain
      .map(function(name, i) {
        var item = angular.copy(_stateLibrary[name]);
        return item;
      })
      .filter(function(parent) {
        return !!parent;
      });

    // Walk up checking inheritance
    for(var i=stateChain.length-1; i>=0; i--) {
      if(stateChain[i]) {
        var nextState = stateChain[i];
        state = angular.merge(nextState, state || {});
      }

      if(state && state.inherit === false) break;
    }

    // Store in cache
    _stateCache[name] = state;

    return state;
  }
265833
private final int stateFirstInStruct()
    {
        int new_state;

        if (hasName()) {
            new_state = S_NAME;
        }
        else if (hasMaxId()) {
            new_state = S_MAX_ID;
        }
        else if (hasImports()) {
            new_state = S_IMPORT_LIST;
        }
        else if (hasLocalSymbols()) {
            new_state = S_SYMBOL_LIST;
        }
        else {
            new_state = S_STRUCT_CLOSE;
        }
        return new_state;
    }