保存输出

@param position
@param currentState
@param collectedEmits
192446
private void storeEmits(int position, int currentState, List<Hit<V>> collectedEmits)
    {
        int[] hitArray = output[currentState];
        if (hitArray != null)
        {
            for (int hit : hitArray)
            {
                collectedEmits.add(new Hit<V>(position - l[hit], position, v[hit]));
            }
        }
    }
656437
public void execute(Tuple input, BasicOutputCollector collector) {
        collector.emit(tuple(input.getValues().get(0), 1));
    }
837341
function _storeAndEmit(jid, status) {
    let jobSel = { 'jid': jid };
    logger.debug("Store&Emit");
    let jobObj = liveMemory.getJob(jobSel);
    if (jobObj) {
        liveMemory.removeJob(jobSel);
        if (liveMemory.size("notBound") < nWorker)
            jmServer.openBar();
        jobObj.jEmit("completed", jobObj);
        let serialJob = jobObj.getSerialIdentity();
        // add type 
        // Make some tests on the jobFootPrint literal?
        clientWH.storeJob(serialJob).on('addSuccess', (message) => {
            logger.log('success', `Job footprint stored in Warehouse`);
        });
        //warehouse.store(jobObj); // Only if genuine
    }
    else {
        logger.error('Error storing job is missing from pool');
    }
}
774990
void saveState(Bundle outState) {
        outState.putString(STATE_CURRENT_PATH, currentPath);
        outState.putSerializable(STATE_FOLDERS, folders);
        outState.putSerializable(STATE_NEXT_TOKENS, nextTokens);
    }
1349929
private void emit() throws TTIOException {
        // Emit pending end elements.
        if (mCloseElements) {
            if (!mStack.empty() && mStack.peek() != ((ITreeStructData)mRtx.getNode()).getLeftSiblingKey()) {
                mRtx.moveTo(mStack.pop());
                emitEndTag();
                mRtx.moveTo(mKey);
            } else if (!mStack.empty()) {
                mRtx.moveTo(mStack.pop());
                emitEndTag();
                mRtx.moveTo(mKey);
                mCloseElements = false;
                mCloseElementsEmitted = true;
            }
        } else {
            mCloseElementsEmitted = false;

            // Emit node.
            emitNode();

            final long nodeKey = mRtx.getNode().getDataKey();
            mLastKey = nodeKey;

            // Push end element to stack if we are a start element.
            if (mRtx.getNode().getKind() == ELEMENT) {
                mStack.push(nodeKey);
            }

            // Remember to emit all pending end elements from stack if
            // required.
            if (!((ITreeStructData)mRtx.getNode()).hasFirstChild()
                && !((ITreeStructData)mRtx.getNode()).hasRightSibling()) {
                mGoUp = true;
                moveToNextNode();
            } else if (mRtx.getNode().getKind() == ELEMENT && !((ElementNode)mRtx.getNode()).hasFirstChild()) {
                // Case: Empty elements with right siblings.
                mGoBack = true;
                moveToNextNode();
            }
        }
    }
521215
function saveRoot(msg, callback) {
            var persisted,
                numberOfPersistedObjects,
                wrappedCallback,
                callbacks;

            logger.debug('saveRoot msg', msg);

            if (!state.viewer && !state.readOnlyProject && state.nodes[ROOT_PATH]) {
                if (state.msg && msg) {
                    state.msg += '\n' + msg;
                } else {
                    state.msg = msg;
                }

                if (state.transactions.opened === 0) {
                    ASSERT(state.project && state.core && state.branchName);

                    callbacks = state.transactions.callbacks;
                    state.transactions.callbacks = [];

                    wrappedCallback = function (err, result) {
                        if (err) {
                            logger.error('saveRoot failure', err);
                        } else {
                            logger.debug('saveRoot', result);
                        }

                        callbacks.forEach(function (cb) {
                            cb(err, result);
                        });
                    };

                    logger.debug('is NOT in transaction - will persist.');
                    // console.time('persist');
                    persisted = state.core.persist(state.nodes[ROOT_PATH].node);
                    // console.timeEnd('persist');
                    logger.debug('persisted', persisted);
                    numberOfPersistedObjects = Object.keys(persisted.objects).length;
                    if (numberOfPersistedObjects === 0) {
                        logger.warn('No changes after persist will return from saveRoot.');
                        wrappedCallback(null);
                        return;
                    } else if (numberOfPersistedObjects > 200) {
                        //This is just for debugging
                        logger.warn('Lots of persisted objects', numberOfPersistedObjects);
                    }

                    // Make the commit on the storage (will emit hashUpdated)
                    storage.makeCommit(
                        state.project.projectId,
                        state.branchName,
                        [state.commitHash],
                        persisted.rootHash,
                        persisted.objects,
                        state.msg,
                        wrappedCallback
                    );

                    state.msg = '';
                } else {
                    logger.debug('is in transaction - will NOT persist.');

                }
            } else {
                //TODO: Why is this set to empty here?
                state.msg = '';
                callback && callback(null);
            }
        }
634843
function _storeAndEmit(jid, status) {
    var jRef = jobsArray[jid];

    var jobObj = jRef.obj;
    delete jobsArray[jid];
    var stdout = jobObj.stdout();
    var stderr = jobObj.stderr();
    /*force emulated to dump stdout/err*/
    if (jobObj.emulated) {
        async.parallel([function(callback) {
                        var fOut = jobObj.workDir + '/' + jobObj.id + '.err';
                        var errStream = fs.createWriteStream(fOut);
                        stderr.pipe(errStream).on('close', function() {
                            callback(null, fOut);
                        });
                    }, function(callback) {
                        var fOut = jobObj.workDir + '/' + jobObj.id + '.out';
                        var outStream = fs.createWriteStream(fOut);
                        stdout.pipe(outStream).on('close', function() {
                            callback(null, fOut);
                        });
                    }], // Once all stream have been consumed, get filesnames
                    function(err,results) {
                        var _stdout = fs.createReadStream(results[1]);
                        var _stderr = fs.createReadStream(results[0]);
                         jobObj.emit("completed", _stdout, _stderr, jobObj);
                    });
    } else {
        if(!status) {
            warehouse.store(jobObj);
            jobObj.emit("completed",
                stdout, stderr, jobObj
            );
        } else {
            jobObj.emit("jobError",
                stdout, stderr, jobObj
            );
        }
    }
}
960555
protected  void emitWithBurstCheck(float[] particlePositions, float[] particleVelocities,
                         float[] particleTimeStamps)
    {
        if ( burstMode )
        {
            if ( executeOnce )
            {
                emit(particlePositions, particleVelocities, particleTimeStamps);
                executeOnce = false;
            }
        }
        else
        {
            emit(particlePositions, particleVelocities, particleTimeStamps);
        }

    }
495863
public void pause(int position) throws IllegalStateException {
        // allow pause if playing or stopped
        switch (subscriberStream.getState()) {
            case PLAYING:
            case STOPPED:
                subscriberStream.setState(StreamState.PAUSED);
                clearWaitJobs();
                sendPauseStatus(currentItem.get());
                sendClearPing();
                subscriberStream.onChange(StreamState.PAUSED, currentItem.get(), position);
                break;
            default:
                throw new IllegalStateException("Cannot pause in current state");
        }
    }
415036
public void removeStickyFooterItemAtPosition(int position) {
        if (mDrawerBuilder.mStickyDrawerItems != null && mDrawerBuilder.mStickyDrawerItems.size() > position) {
            mDrawerBuilder.mStickyDrawerItems.remove(position);
        }

        DrawerUtils.rebuildStickyFooterView(mDrawerBuilder);
    }
70476
public final void notifyFooterItemInserted(int position) {
        int newHeaderItemCount = getHeaderItemCount();
        int newContentItemCount = getContentItemCount();
        int newFooterItemCount = getFooterItemCount();
//        if (position < 0 || position >= newFooterItemCount) {
//            throw new IndexOutOfBoundsException("The given position " + position
//                    + " is not within the position bounds for footer items [0 - "
//                    + (newFooterItemCount - 1) + "].");
//        }
        notifyItemInserted(position + newHeaderItemCount + newContentItemCount);
    }
201328
function(node, state, leaving) {
        for (let i = 0; i < state.currentSegments.length; ++i) {
            const segInternal = state.currentSegments[i].internal;

            if (leaving) {
                segInternal.exitNodes.push(node);
            } else {
                segInternal.nodes.push(node);
            }
        }

        debug([
            `${state.currentSegments.map(getId).join(",")})`,
            `${node.type}${leaving ? ":exit" : ""}`
        ].join(" "));
    }
389291
function (position) {
                /** @type {?} */
                var positionChangeData = new PositionChangeData(position, this.limitRoles);
                /** @type {?} */
                var limitException = this.limitsService.exceedsLimit(positionChangeData);
                if (limitException.exceeds) {
                    // if exceeds limits, reposition
                    this.resetPosition = limitException.resetCoordinates;
                }
                else {
                    this.limitsService.positionChange(positionChangeData);
                    this._currentPosition = position;
                }
            }
664471
@Override
    public void saveState() {
        GUISaveState.getInstance().setSplitTop(topSPane.getDividerLocation());
        GUISaveState.getInstance().setSplitSummary(summarySPane.getDividerLocation());
        GUISaveState.getInstance().setSplitMain(mainSPane.getDividerLocation());
    }
1040668
protected void collect(Object key, TaggedMapOutput aRecord,
                         OutputCollector output, Reporter reporter) throws IOException {
    this.collected += 1;
    addLongValue("collectedCount", 1);
    if (aRecord != null) {
      output.collect(key, aRecord.getData());
      reporter.setStatus("key: " + key.toString() + " collected: " + collected);
      addLongValue("actuallyCollectedCount", 1);
    }
  }
603974
@Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List payloads) {
        if (shouldInsertItemAtPosition(position)) {
            getItem(position).bindView(holder, payloads);
        } else {
            mAdapter.onBindViewHolder(holder, position - itemInsertedBeforeCount(position), payloads);
        }
    }
532854
public void writeIntCurrentPosition(int v) throws IOException {
    int index = (int)(position - bufferOffset);
    if (index < maxBufferSize) {
      buffer[index] = v;
      isByte[index] = false;
      if (index + 1 > currentBufferSize) currentBufferSize = index + 1;
      if (index + 1 >= maxBufferSize) {
        writeBuffer();
        newBuffer(position + 1);
      }
    } else {
      aFile.write(v);
    }
    position++;
  }