Acknowledgment Number is the next sequence number that the receiver is expecting
761946
private void scheduleAcknowledgment(final String topic) {
    if (!acknowledgeScheduled.has(topic)) {
      acknowledgeScheduled.set(topic, true);
      Platform.scheduler().scheduleDelay(acknowledgeDelayMillis, new Handler<Void>() {
        @Override
        public void handle(Void event) {
          if (acknowledgeScheduled.has(topic)) {
            acknowledgeScheduled.remove(topic);
            // Check we're still out of date, and not already catching up.
            double knownHeadSequence = knownHeadSequences.getNumber(topic);
            double currentSequence = currentSequences.getNumber(topic);
            if (knownHeadSequence > currentSequence
                && (!acknowledgeNumbers.has(topic) || knownHeadSequence > acknowledgeNumbers
                    .getNumber(topic))) {
              acknowledgeNumbers.set(topic, knownHeadSequence);
              log.log(Level.CONFIG, "Catching up to " + knownHeadSequence);
              catchup(topic, currentSequence);
            } else {
              log.log(Level.FINE, "No need to catchup");
            }
          }
        }
      });
    }
  }
232843
def ack(self):
        
        if self.acknowledged:
            raise self.MessageStateError(
                "Message already acknowledged with state: %s" % self._state)
        self.backend.ack(self._frame)
        self._state = "ACK"
1204898
private int getNextStep(int currentStep) {
        int nextStep = -1;
        
        // we find the next available step.
        for (int i = currentStep + 1; i <= STEP_THANKS; i++) {
            if(isStepEnabled(i)) {
                nextStep = i;
                break;
            }
        }

        return nextStep;
    }
972676
protected String nextLetterNumber( int c ) throws IOException 
    {
        //StringBuilder isb = new StringBuilder();
        isb.clear();
        isb.append((char)c);
        int ch;
        while ( (ch = readNext()) != -1 ) {
            if ( StringUtil.isWhitespace(ch) ) {
                pushBack(ch);
                break;
            }
            
            if ( ! StringUtil.isLetterNumber( ch ) ) {
                pushBack(ch);
                break;
            } 
            
            isb.append((char)ch);
        }
        
        return isb.toString();
    }
270515
def computeAccuracyEnding(predictions, truths, iterations,
                    resets=None, randoms=None, num=None,
                    sequenceCounter=None):
  
  accuracy = []
  numIteration = []
  numSequences = []

  for i in xrange(len(predictions) - 1):
    if num is not None and i > num:
      continue

    if truths[i] is None:
      continue

    # identify the end of sequence
    if resets is not None or randoms is not None:
      if not (resets[i+1] or randoms[i+1]):
        continue

    correct = truths[i] is None or truths[i] in predictions[i]
    accuracy.append(correct)
    numSequences.append(sequenceCounter[i])
    numIteration.append(iterations[i])

  return (accuracy, numIteration, numSequences)
916969
public void acknowledgePages(long sequenceId)
    {
        checkArgument(sequenceId >= 0, "Invalid sequence id");

        List<SerializedPageReference> removedPages = new ArrayList<>();
        synchronized (this) {
            if (destroyed.get()) {
                return;
            }

            // if pages have already been acknowledged, just ignore this
            long oldCurrentSequenceId = currentSequenceId.get();
            if (sequenceId < oldCurrentSequenceId) {
                return;
            }

            int pagesToRemove = toIntExact(sequenceId - oldCurrentSequenceId);
            checkArgument(pagesToRemove <= pages.size(), "Invalid sequence id");

            long bytesRemoved = 0;
            for (int i = 0; i < pagesToRemove; i++) {
                SerializedPageReference removedPage = pages.removeFirst();
                removedPages.add(removedPage);
                bytesRemoved += removedPage.getRetainedSizeInBytes();
            }

            // update current sequence id
            verify(currentSequenceId.compareAndSet(oldCurrentSequenceId, oldCurrentSequenceId + pagesToRemove));

            // update memory tracking
            verify(bufferedBytes.addAndGet(-bytesRemoved) >= 0);
        }

        // dereference outside of synchronized to avoid making a callback while holding a lock
        removedPages.forEach(SerializedPageReference::dereferencePage);
    }
893902
private synchronized long catchUp(long nextSequenceNumber) {
    JournalReader journalReader = new UfsJournalReader(this, nextSequenceNumber, true);
    try {
      return catchUp(journalReader);
    } finally {
      try {
        journalReader.close();
      } catch (IOException e) {
        LOG.warn("Failed to close journal reader: {}", e.toString());
      }
    }
  }
220931
def _number_slash_end_handler(c, ctx, event):
    
    assert c == _SLASH
    c, self = yield
    next_ctx = ctx.derive_child_context(ctx.whence)
    comment = _comment_handler(_SLASH, next_ctx, next_ctx.whence)
    comment.send((c, comment))
    # If the previous line returns without error, it's a valid comment and the number may be emitted.
    yield _CompositeTransition(event, ctx, comment, next_ctx, initialize_handler=False)
657577
function postSequence(elems, fin) {
    // Treat the final value of a sequence as its return value
    var toReturn = elems[elems.length - 1];
    return fin(null, toReturn);
}
689376
@Override
    public void indicateProgress(int number) {
        verifySystemOut();
        progressIndicatorActive = true;
        String currMsg = lastMessage;
        try {
            if (isAnsiEnabled()) {
                updateStatus(currMsg + ' ' + number);
            } else {
                out.print("..");
                out.print(number);
            }
        } finally {
            lastMessage = currMsg;
        }
    }
920243
@Override
    protected void forwardNumCodePoints(int num) {
        while(num > 0 && pos != limit) {
            char c = seq.charAt(pos++);
            --num;
            if(Character.isHighSurrogate(c) && pos != limit &&
                    Character.isLowSurrogate(seq.charAt(pos))) {
                ++pos;
            }
        }
    }
323492
function SequentialParser(accumulators, callback) {
  var step = 0;
  var fields = {};
  return {
    fields: fields,
    addField: function(key, value) {
      this.fields[key] = value;
    },
    parseItem: function(item) {
      if (step >= accumulators.length) {
        return console.warn(
          "warning: skipping item, because SequentialParser is done."
        );
      }
      var current = accumulators[step];
      if (current.field) {
        this.addField(current.field, item);
        ++step;
      } else if (current.accumulator) {
        var doneAccumulating = current.accumulator(item, this);
        if (doneAccumulating) ++step;
      } // no action => skip item
      else ++step;
      if (!item || step >= accumulators.length) {
        callback && callback(null, this);
      }
    }
  };
}
1175545
public long getExpectedSequenceNumber()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getExpectedSequenceNumber");
      
    long expectedSeqNumber = aoBrowserSession.getExpectedSequenceNumber();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getExpectedSequenceNumber", new Long(expectedSeqNumber));
    return expectedSeqNumber;
  }
949052
def _call_next(self, handler_chain):
        

        def wrapped(*args, **kwargs):
            if len(handler_chain) == 1:
                return handler_chain[0](*args, **kwargs)
            else:
                return handler_chain[0](self._call_next(handler_chain[1:]),
                                        *args, **kwargs)

        return wrapped
1362818
def _nextCTRByte(self):
        """"""
        b = ord(self.ctr_cks[self.ctr_pos])
        self.ctr_pos += 1
        if self.ctr_pos >= len(self.ctr_cks):
            self._calcCTRBUF()
        return b
1292843
def get_next(self, num_bytes=None):
        """"""
        if num_bytes is None:
            return self._data[self._offset:]
        else:
            return self._data[self._offset:self._offset + num_bytes]
823087
function getDynamoDBSequenceNumber(record) {
  return record && record.dynamodb && record.dynamodb.SequenceNumber ? record.dynamodb.SequenceNumber : '';
}