Model takes our action streams and turns them into the stream of app states
178639
function model(inputValue$, messages$) {
    return Rx.Observable.combineLatest(
      inputValue$.startWith(null),
      messages$.startWith([]),
      (inputValue, messages) => ({ messages, inputValue })
    )
  }
329630
function UMLState() {
        UMLVertex.apply(this, arguments);

        /** @member {Array.<UMLRegion>} */
        this.regions = [];

        /** @member {Array.<UMLBehavior>} */
        this.entryActivities = [];

        /** @member {Array.<UMLBehavior>} */
        this.doActivities = [];

        /** @member {Array.<UMLBehavior>} */
        this.exitActivities = [];

        /** @member {UMLStateMachine} */
        this.submachine = null;

        /** @member {UMLConnectionPointReference} */
        this.connections = [];
    }
711144
protected void createServiceWarningViewState(final Flow flow) {
        val stateWarning = createViewState(flow, CasWebflowConstants.STATE_ID_SHOW_WARNING_VIEW, CasWebflowConstants.VIEW_ID_CONFIRM);
        createTransitionForState(stateWarning, CasWebflowConstants.TRANSITION_ID_SUCCESS, "finalizeWarning");
        val finalizeWarn = createActionState(flow, "finalizeWarning", createEvaluateAction("serviceWarningAction"));
        createTransitionForState(finalizeWarn, CasWebflowConstants.STATE_ID_REDIRECT, CasWebflowConstants.STATE_ID_REDIRECT);
    }
1062409
function makeReactive(componentDefinition, renderFn, ...stateStreamNames) {
  class ReactiveComponent extends PureComponent {
    constructor(props, context) {
      super(props, context);
      this.state = { childProps: {} }
      this.omnistream = this.context.omnistream;

      // Make the dispatch function accessible to be passed as a prop to child components.
      this.dispatch = this.omnistream.dispatch.bind(context.omnistream);
      this.dispatchObservableFn = this.omnistream.dispatchObservableFn.bind(context.omnistream);
    }

    componentDidMount() {
      // Creates a new substream for each action type based on the provided "streamNames"
      const stateStreams = stateStreamNames.map(name => this.omnistream.store[name]);
      const state$ = combineStreamsToState(stateStreams);
      // Subscribes to the props stream. This will trigger a re-render whenever a new action has been dispatched to 
      // any filtered stream passed down as props to a component.
      this.subscription = state$.subscribe((props) => {
        this.setState({ childProps: Object.assign({}, this.props, props) });
      });
    }

    componentWillUnmount() {
      this.subscription.unsubscribe();
    }

    render() {
      return renderFn.call(this, componentDefinition);
    }
  }
  ReactiveComponent.contextTypes = { omnistream: React.PropTypes.object.isRequired }
  return ReactiveComponent;
}
1286697
private void analyzeModels() {
        try {
            do {
                ExecutorService pool = Executors.newFixedThreadPool(context.getSettings().getNbThread());

                while (context.workToDo()) {
                    pool.execute(new ModelExecutor(context));
                }

                pool.shutdown();
                while (!pool.isTerminated()) {
                    pool.awaitTermination(TIMEOUT, TimeUnit.MILLISECONDS);
                }

            } while (context.workToDo());
        } catch (InterruptedException e) {
            throw new RuntimeException("Interrupted " + e.getMessage());
        }
    }
1339902
public void executeActivitiesConcurrent(List<PvmActivity> activityStack, PvmActivity targetActivity,
                                          PvmTransition targetTransition, Map<String, Object> variables, Map<String, Object> localVariables,
                                          boolean skipCustomListeners, boolean skipIoMappings) {


    ScopeImpl flowScope = null;
    if (!activityStack.isEmpty()) {
      flowScope = activityStack.get(0).getFlowScope();
    } else if (targetActivity != null) {
      flowScope = targetActivity.getFlowScope();
    } else if (targetTransition != null) {
      flowScope = targetTransition.getSource().getFlowScope();
    }

    PvmExecutionImpl propagatingExecution = null;
    if (flowScope.getActivityBehavior() instanceof ModificationObserverBehavior) {
      ModificationObserverBehavior flowScopeBehavior = (ModificationObserverBehavior) flowScope.getActivityBehavior();
      propagatingExecution = (PvmExecutionImpl) flowScopeBehavior.createInnerInstance(this);
    } else {
      propagatingExecution = createConcurrentExecution();
    }

    propagatingExecution.executeActivities(activityStack, targetActivity, targetTransition, variables, localVariables,
      skipCustomListeners, skipIoMappings);
  }
67209
def stream(stream_id, update_max_id = true)
      raise ArgumentError, "stream_id can't be 0" if stream_id == 0

      stream = @streams[stream_id]
      if stream
        if stream.state == :idle && stream_id < @max_stream_ids[stream_id % 2]
          stream.set_state(:closed_implicitly)
        end
      elsif stream_id > @max_stream_ids[stream_id % 2]
        @max_stream_ids[stream_id % 2] = stream_id if update_max_id
        stream = Stream.new(self, stream_id, state: :idle)
        callback(:stream, stream)
        @streams[stream_id] = stream
      else
        stream = Stream.new(self, stream_id, state: :closed_implicitly)
        callback(:stream, stream)
      end

      stream
    end
1338434
def custom_action(sender, action,
                          instance,
                          user=None,
                          **kwargs):
    
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    distill_model_event(instance, model, action, user_override=user)
1183464
function generateTransitionHelpers(currentState, parsedStates) {
  const buildFnBody = state => (...args) => {
    return PossibleStatesContainer({current: state, data: zip(state.data, args), allStates: parsedStates})
  }

  return parsedStates.reduce(
    (transitions, state) => ({...transitions, [buildFnName('to', state.name)]: buildFnBody(state)}),
    {}
  )
}
113543
public KerasModelBuilder modelJsonInputStream(InputStream modelJsonInputStream) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        IOUtils.copy(modelJsonInputStream, byteArrayOutputStream);
        this.modelJson = new String(byteArrayOutputStream.toByteArray());
        return this;
    }
979708
def actions_to_reach_reduce(state_idx, target)
      rule = target.heads.map(&:rule).min_by do |r|
        r.symbols.flat_map(&:shortest_production).size
      end

      actions, cur_state = [], state_idx
      rule.symbols.each do |sym|
        if sym.terminal?
          actions << sym
        else
          actions.concat(actions_to_reach_reduce(cur_state, sym))
        end
        cur_state = transition_graph[cur_state][sym]
      end
      cur_state = transition_graph[state_idx][target]

      actions << ReduceStep.new(state_idx, cur_state, rule, target)
    end
493209
function (state, action) {
    if (state) {
      let initialValue = state.value || {}
      if (state.baseModel) {
        initialValue = recursiveClean(initialValue, state.baseModel)
        state.baseModel = getDereferencedModelSchema(state.baseModel)
        state.model = evaluateConditions(state.baseModel, initialValue, undefined, initialValue)
        // leave this undefined to force consumers to go through the proper CHANGE_VALUE channel
        // for value changes
        state.value = undefined
      }
      if (state.view && !state.baseView) {
        state.baseView = state.view
      }
      if (state.baseView) {
        state.view = evaluateViewConditions(state.baseView, initialValue)
      }
    }

    const newState = initialState(state || {})
    newState.lastAction = 'INIT'
    newState.value = immutable(newState.value)
    return newState
  }
499530
function transformAsyncBranch (action, parentAction, path, actions, isSync) {
  action = action.slice();
  isSync = !isSync;
  return action
    .map((subAction, index) => {
      path.push(index);
      var result = transformBranch(subAction, action, path, actions, isSync);
      path.pop();
      return result;
    })
    .filter(branch => !!branch);
}
492030
function reloadState(model, notify) {
    return function reload() {
        let { pathname, histories } = model,
            method = actionTypes.replace;

        // 更新监听
        return notify({
            pathname, method, histories, length: histories.length
        });
    };
}
336138
def model_actions(self):
        
        observations = self.get('rollout:observations')
        model_action = self.model.action(observations)
        return model_action
341688
def streamify(self, state, frame):
        """"""

        # Split the frame apart for stuffing...
        pieces = frame.split(self.prefix)

        return '%s%s%s%s%s' % (self.prefix, self.begin,
                               (self.prefix + self.nop).join(pieces),
                               self.prefix, self.end)
794382
def actions(self, s):
        ''''''
        # we try to generate every possible state and then filter those
        # states that are valid
        return [a for a in self._actions if self._is_valid(self.result(s, a))]