Checks for gaps if we've reached to the top of the list.
<p/>
Intermediate gaps created by full span items are tracked via mLaidOutInvalidFullSpan field.
199659
private View hasGapsToFix(VirtualLayoutManager layoutManager, final int position, final int alignLine) {
        View view = layoutManager.findViewByPosition(position);

        if (view == null) {
            return null;
        }


        BitSet mSpansToCheck = new BitSet(mNumLanes);
        mSpansToCheck.set(0, mNumLanes, true);

        for (int i = 0, size = mSpans.length; i < size; i++) {
            Span span = mSpans[i];
            if (span.mViews.size() != 0 && checkSpanForGap(span, layoutManager, alignLine)) {
                return layoutManager.getReverseLayout() ? span.mViews.get(span.mViews.size() - 1) : span.mViews.get(0);
            }
        }

        // everything looks good
        return null;
    }
664922
def is_complete(self):
        
        return all(
            [node.route_allocation() is not None for node in list(self._nodes.values()) if node != self._problem.depot()]
        )
836157
private long traverseAndCheck() {
    long sum = 0;

    sum += topSize + TOP_FOOT_SIZE;

    long q = 0;
    long lastq = 0;
    if (!previousInUse(q))
      throw new AssertionError("Chunk before zeroth chunk is marked as free");
    while (q != top) {
      sum += chunkSize(q);
      if (isInUse(q)) {
        if (findFreeChunk(q))
          throw new AssertionError("Chunk marked as in-use appears in a free structure");
        checkInUseChunk(q);
      } else {
        if (q != designatedVictim && !findFreeChunk(q))
          throw new AssertionError("Chunk marked as free cannot be found in any free structure");
        if (lastq != 0 && !isInUse(lastq))
          throw new AssertionError("Chunk before free chunk is not in-use");
        checkFreeChunk(q);
      }
      lastq = q;
      q = nextChunk(q);
    }
    return sum;
  }
428483
private void verifyReplacementRange(SegmentWithRange replacedSegment, StreamSegmentsWithPredecessors replacementSegments) {
        log.debug("Verification of replacement segments {} with the current segments {}", replacementSegments, segments);
        Map<Long, List<SegmentWithRange>> replacementRanges = replacementSegments.getReplacementRanges();
        List<SegmentWithRange> replacements = replacementRanges.get(replacedSegment.getSegment().getSegmentId());
        Preconditions.checkArgument(replacements != null, "Replacement segments did not contain replacements for segment being replaced");
        if (replacementRanges.size() == 1) {
            //Simple split
            Preconditions.checkArgument(replacedSegment.getHigh() == getUpperBound(replacements));
            Preconditions.checkArgument(replacedSegment.getLow() == getLowerBound(replacements));
        } else {
            Preconditions.checkArgument(replacedSegment.getHigh() <= getUpperBound(replacements));
            Preconditions.checkArgument(replacedSegment.getLow() >= getLowerBound(replacements));
        }
        for (Entry<Long, List<SegmentWithRange>> ranges : replacementRanges.entrySet()) {
            Entry<Double, SegmentWithRange> upperReplacedSegment = segments.floorEntry(getUpperBound(ranges.getValue()));
            Entry<Double, SegmentWithRange> lowerReplacedSegment = segments.higherEntry(getLowerBound(ranges.getValue()));
            Preconditions.checkArgument(upperReplacedSegment != null, "Missing replaced replacement segments %s",
                                        replacementSegments);
            Preconditions.checkArgument(lowerReplacedSegment != null, "Missing replaced replacement segments %s",
                                        replacementSegments);
        }
    }
404706
def check_node_overlap!
      node_to_positions = {}
      each_node do |node|
        node.proper_range.each do |position|
          if node_to_positions[position]
            already = node_to_positions[position]
            puts "There is a proper_range overlap between #{node} and #{already}"
            puts "Overlapping: #{already.proper_range & node.proper_range}"
            binding.pry
          end
          node_to_positions[position] = node
        end
      end
    end
834747
public boolean reachEnd() throws IOException {
		// check if we have a read row that was not returned yet
		if (readRecord != null && !readRecordReturned) {
			return false;
		}
		// check if there are more rows to be read
		if (numReadRecords >= numTotalRecords) {
			return true;
		}
		// try to read next row
		return !readNextRecord();
	}
866098
private void checkMarkupLevel(final int markupLevel) {
        if (markupLevel >= this.matchedMarkupLevels.length) {
            final int newLen = Math.max(markupLevel + 1, this.matchedMarkupLevels.length + MATCHED_MARKUP_LEVELS_LEN);
            final boolean[] newMatchedMarkupLevels = new boolean[newLen];
            Arrays.fill(newMatchedMarkupLevels, false);
            System.arraycopy(this.matchedMarkupLevels, 0, newMatchedMarkupLevels, 0, this.matchedMarkupLevels.length);
            this.matchedMarkupLevels = newMatchedMarkupLevels;
        }
    }
1332727
@Override
    public boolean isEmpty() {
	final Segment<K, V>[] segments = this.segments;
	/*
	 * We keep track of per-segment modCounts to avoid ABA problems in which an element in one segment
	 * was added and in another removed during traversal, in which case the table was never actually
	 * empty at any point. Note the similar use of modCounts in the size() and containsValue() methods,
	 * which are the only other methods also susceptible to ABA problems.
	 */
	int[] mc = new int[segments.length];
	int mcsum = 0;
	for (int i = 0; i < segments.length; ++i) {
	    if (segments[i].count != 0) return false;
	    mcsum += mc[i] = segments[i].modCount;
	}
	// If mcsum happens to be zero, then we know we got a snapshot
	// before any modifications at all were made. This is
	// probably common enough to bother tracking.
	if (mcsum != 0) {
	    for (int i = 0; i < segments.length; ++i) {
		if (segments[i].count != 0 || mc[i] != segments[i].modCount) return false;
	    }
	}
	return true;
    }
930342
private static void validateNoOverlaps(List<CodeReplacement> replacements) {
    checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements));
    if (containsOverlaps(replacements)) {
      throw new IllegalArgumentException(
          "Found overlap between code replacements!\n" + Joiner.on("\n\n").join(replacements));
    }
  }
1045603
function checkInfiniteBounds() {
    if (self.isLoading) return;
    var maxScroll = {};

    if (self.jsScrolling) {
      maxScroll = self.getJSMaxScroll();
      var scrollValues = self.scrollView.getValues();
      if ((maxScroll.left !== -1 && scrollValues.left >= maxScroll.left) ||
        (maxScroll.top !== -1 && scrollValues.top >= maxScroll.top)) {
        onInfinite();
      }
    } else {
      maxScroll = self.getNativeMaxScroll();
      if ((
        maxScroll.left !== -1 &&
        self.scrollEl.scrollLeft >= maxScroll.left - self.scrollEl.clientWidth
        ) || (
        maxScroll.top !== -1 &&
        self.scrollEl.scrollTop >= maxScroll.top - self.scrollEl.clientHeight
        )) {
        onInfinite();
      }
    }
  }
124256
private boolean isCompletelyCoveredBy(int[] isCovered, List<RuleInterval> intervals) {
    for (RuleInterval i : intervals) {
      for (int j = i.getStart(); j < i.getEnd(); j++) {
          if (isCovered[j] == 0) {
            return false;
          }
      }
    }
    return true;
  }
436640
private boolean goToNextStartPosition() throws IOException {
    int nextSpans1StartPosition;
    int nextSpans1EndPosition;
    int nextSpans2StartPosition;
    int nextSpans2EndPosition;
    // loop over span1
    while ((nextSpans1StartPosition = spans1.spans
        .nextStartPosition()) != NO_MORE_POSITIONS) {
      nextSpans1EndPosition = spans1.spans.endPosition();
      if (noMorePositionsSpan2
          && nextSpans1StartPosition > lastSpans2StartPosition) {
        noMorePositions = true;
        return false;
        // check if start/en span1 matches start/end span2 from last or previous
      } else if ((nextSpans1StartPosition == lastSpans2StartPosition
          && nextSpans1EndPosition == lastSpans2EndPosition)
          || (nextSpans1StartPosition == previousSpans2StartPosition
              && previousSpans2EndPositions.contains(nextSpans1EndPosition))) {
        return true;
      } else {
        // try to find matching span2
        while (!noMorePositionsSpan2
            && nextSpans1StartPosition >= lastSpans2StartPosition) {
          // get new span2
          nextSpans2StartPosition = spans2.spans.nextStartPosition();
          // check for finished span2
          if (nextSpans2StartPosition == NO_MORE_POSITIONS) {
            noMorePositionsSpan2 = true;
          } else {
            // get end for new span2
            nextSpans2EndPosition = spans2.spans.endPosition();
            // check for registering last span2 as previous
            if (nextSpans1StartPosition <= lastSpans2StartPosition) {
              if (previousSpans2StartPosition != lastSpans2StartPosition) {
                previousSpans2StartPosition = lastSpans2StartPosition;
                previousSpans2EndPositions.clear();
              }
              previousSpans2EndPositions.add(lastSpans2EndPosition);
            }
            // register span2 as last
            lastSpans2StartPosition = nextSpans2StartPosition;
            lastSpans2EndPosition = nextSpans2EndPosition;
            // check for match
            if (nextSpans1StartPosition == nextSpans2StartPosition
                && nextSpans1EndPosition == nextSpans2EndPosition) {
              return true;
            }
          }
        }

      }
    }
    noMorePositions = true;
    return false;
  }
914791
function (node) {
        if (node.properties.length === 0) {
          return
        }

        var first = context.getFirstToken(node)
        var second = context.getFirstToken(node, 1)
        var penultimate = context.getLastToken(node, 1)
        var last = context.getLastToken(node)

        validateBraceSpacing(node, first, second, penultimate, last)
      }
1118061
public final void validate() {
    this.accept(new TreeVisitor() {
      @Override
      public boolean preVisit(TreeNode node) {
        node.validateInner();
        return true;
      }
    });
  }
891083
private void checkRange(long index) {
    Assert.indexNot(isEmpty(), "segment is empty");
    Assert.indexNot(index < firstIndex(), index + " is less than the first index in the segment");
    Assert.indexNot(index > lastIndex(), index + " is greater than the last index in the segment");
  }
145976
private int endCheckIf()
    {
        Node th, el;
        int rv = END_UNREACHED;

        th = next;
        el = ((Jump)this).target;

        rv = th.endCheck();

        if (el != null)
            rv |= el.endCheck();
        else
            rv |= END_DROPS_OFF;

        return rv;
    }
861302
private static void validateLineBreaks(int[] linebreaks, int textLength) {
        int prev = 0;
        for (int i = 0; i < linebreaks.length; ++i) {
            int next = linebreaks[i];
            if (next <= prev) {
                throw new IllegalArgumentException("bad linebreak: " + next + " at index: " + i);
            }
            prev = next;
        }
        if (prev != textLength) {
            throw new IllegalArgumentException("last linebreak must be at " + textLength);
        }
    }