Returns true if the block height is either not a checkpoint, or is a checkpoint and the hash matches.
356674
public boolean passesCheckpoint(int height, Sha256Hash hash) {
        Sha256Hash checkpointHash = checkpoints.get(height);
        return checkpointHash == null || checkpointHash.equals(hash);
    }
1262509
def height(cls, path):
        
        if os.path.exists( path ):
            sb = os.stat( path )
            h = (sb.st_size / BLOCK_HEADER_SIZE) - 1
            return h
        else:
            return None
259106
private boolean continueBlock() throws IOException {
        byte lastByte = buffer[readPtr - 1];
        while(true) {
            if(maybeFlush()) return true;
            if(!hasFullBlock()) {
                refillBuffer();
                if(!hasFullBlock()) {
                    state = StateContinuePartialBlock;
                    return continueContinuePartialBlock(lastByte);
                }
            }
            int weakHash = rc.roll(lastByte, buffer[readPtr + blockSize - 1]);
            int blockNum = signatureTable.findBlock(weakHash, buffer, readPtr, blockSize);
            if(blockNum != -1) {
                writeBlock(blockNum, blockSize);
                state = StateNewBlock;
                return true;
            }
            lastByte = buffer[readPtr];
            readPtr += 1;
        }
    }
886785
def _sanity_check_every_location_is_marked(ir_blocks):
    """"""
    # Exactly one MarkLocation block is found between any block that starts an interval of blocks
    # that all affect the same query position, and the first subsequent block that affects a
    # different position in the query. Such intervals include the following examples:
    # - from Fold to Unfold
    # - from QueryRoot to Traverse/Recurse
    # - from one Traverse to the next Traverse
    # - from Traverse to Backtrack
    found_start_block = False
    mark_location_blocks_count = 0

    start_interval_types = (QueryRoot, Traverse, Recurse, Fold)
    end_interval_types = (Backtrack, ConstructResult, Recurse, Traverse, Unfold)

    for block in ir_blocks:
        # Terminate started intervals before opening new ones.
        if isinstance(block, end_interval_types) and found_start_block:
            found_start_block = False
            if mark_location_blocks_count != 1:
                raise AssertionError(u'Expected 1 MarkLocation block between traversals, found: '
                                     u'{} {}'.format(mark_location_blocks_count, ir_blocks))

        # Now consider opening new intervals or processing MarkLocation blocks.
        if isinstance(block, MarkLocation):
            mark_location_blocks_count += 1
        elif isinstance(block, start_interval_types):
            found_start_block = True
            mark_location_blocks_count = 0
1135396
function isBlockEndPoint(node, offset) {
	return (!node.parentNode && offset == getNodeLength(node))
		|| (offset < node.childNodes.length
		&& isVisible(node.childNodes[offset])
		&& isBlockNode(node.childNodes[offset]));
}
544232
public boolean isBlockMarked(long blockId) {
    for (StorageTierView tierView : mTierViews) {
      for (StorageDirView dirView : tierView.getDirViews()) {
        if (dirView.isMarkedToMoveOut(blockId)) {
          return true;
        }
      }
    }
    return false;
  }
1033574
private boolean checkBlockSize(Block block, INodeFile inode) {
    if (block.getNumBytes() < 0) {
      return false;
    }
    BlockInfo[] blocks = inode.getBlocks();
    if (blocks.length == 0) {
      return false;
    }
    return block.getNumBytes() <= inode.getPreferredBlockSize();
  }
1334433
def logs_blocks_sanity_check(from_block: BlockSpecification, to_block: BlockSpecification) -> None:
    """"""
    is_valid_from = isinstance(from_block, int) or isinstance(from_block, str)
    assert is_valid_from, 'event log from block can be integer or latest,pending, earliest'
    is_valid_to = isinstance(to_block, int) or isinstance(to_block, str)
    assert is_valid_to, 'event log to block can be integer or latest,pending, earliest'
1060832
public boolean hasBlockMeta(long blockId) {
    for (StorageTier tier : mTiers) {
      for (StorageDir dir : tier.getStorageDirs()) {
        if (dir.hasBlockMeta(blockId)) {
          return true;
        }
      }
    }
    return false;
  }
484334
private boolean blocksEquals(Block[] a1, Block[] a2, boolean closedFile) {
    if (a1 == a2)
      return true;
    if (a1 == null || a2 == null || a2.length != a1.length)
      return false;

    for (int i = 0; i < a1.length; i++) {
      Block b1 = a1[i];
      Block b2 = a2[i];

      if (b1 == b2)
        continue;
      if (b1 == null || b2 == null)
        return false;

      // compare ids and gen stamps
      if (!(b1.getBlockId() == b2.getBlockId() && b1.getGenerationStamp() == b2
          .getGenerationStamp()))
        return false;

      // for open files check len-2 blocks only
      if (!closedFile && i >= a1.length - 2)
        continue;

      // check block size
      if (b1.getNumBytes() != b2.getNumBytes())
        return false;
    }
    return true;
  }
1042397
function checkInBlock(mask) {
      var block = cc.block[last]
      if (block && block === (block & mask))
        return true
      emitError('Unexpected #' + key + ' in @')
      return false
    }
398573
private static void traverseAndBuild(int height, int pos, List<Sha256Hash> allLeafHashes, byte[] includeBits,
                                         List<Boolean> matchedChildBits, List<Sha256Hash> resultHashes) {
        boolean parentOfMatch = false;
        // Is this node a parent of at least one matched hash?
        for (int p = pos << height; p < (pos+1) << height && p < allLeafHashes.size(); p++) {
            if (Utils.checkBitLE(includeBits, p)) {
                parentOfMatch = true;
                break;
            }
        }
        // Store as a flag bit.
        matchedChildBits.add(parentOfMatch);
        if (height == 0 || !parentOfMatch) {
            // If at height 0, or nothing interesting below, store hash and stop.
            resultHashes.add(calcHash(height, pos, allLeafHashes));
        } else {
            // Otherwise descend into the subtrees.
            int h = height - 1;
            int p = pos * 2;
            traverseAndBuild(h, p, allLeafHashes, includeBits, matchedChildBits, resultHashes);
            if (p + 1 < getTreeWidth(allLeafHashes.size(), h))
                traverseAndBuild(h, p + 1, allLeafHashes, includeBits, matchedChildBits, resultHashes);
        }
    }
329476
def check
      return false unless @btree.check

      i = 0
      each do |k, v|
        i += 1
      end

      unless @entry_counter == i
        PEROBS.log.error "BigHash contains #{i} values but entry counter " +
          "is #{@entry_counter}"
        return false
      end

      true
    end
138034
function isBlockNode(node) {
        return node &&
            ((node.nodeType == 1 && !/^(inline(-block|-table)?|none)$/.test(getComputedDisplay(node))) ||
            node.nodeType == 9 || node.nodeType == 11);
    }
34066
public static boolean hashContains(String hash, double lat, double lon) {
        LatLong centre = decodeHash(hash);
        return Math.abs(centre.getLat() - lat) <= heightDegrees(hash.length()) / 2
                && Math.abs(to180(centre.getLon() - lon)) <= widthDegrees(hash.length()) / 2;
    }
295778
private boolean isLoneBlock(Node n) {
    Node parent = n.getParent();
    if (parent != null && (parent.isScript()
        || (parent.isBlock() && !parent.isSyntheticBlock() && !parent.isAddedBlock()))) {
      return !n.isSyntheticBlock() && !n.isAddedBlock();
    }
    return false;
  }
1284716
def is_top(self):
        
        return (self.stride == 1 and
                self.lower_bound == self._modular_add(self.upper_bound, 1, self.bits)
                )