@param iterable|int[] $blockIndexes
@param array          $blockList
@param int            $blockType

@return bool

@SuppressWarnings(PHPMD.StaticAccess)
426242
private static function debugCheckBlocksExist(iterable $blockIndexes, array $blockList, int $blockType): bool
    {
        $result = true;

        foreach ($blockIndexes as $index) {
            $result = $result &&
                array_key_exists($index, $blockList) === true &&
                static::getBlockType($blockList[$index]) === $blockType;
        }

        return $result;
    }
397713
private void logBlock(int blockIndex, int startIndex, int blockLength)
   {
      if (m_log != null)
      {
         m_log.println("Block Index: " + blockIndex);
         m_log.println("Length: " + blockLength + " (" + Integer.toHexString(blockLength) + ")");
         m_log.println();
         m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, blockLength, true, 16, ""));
         m_log.flush();
      }
   }
788802
func BlockType(block []byte) (byte, error) {
	blockType := block[0]
	switch blockType {
	case BlockFloat64, BlockInteger, BlockUnsigned, BlockBoolean, BlockString:
		return blockType, nil
	default:
		return 0, fmt.Errorf("unknown block type: %d", blockType)
	}
}
732841
protected static final int findSameIndexBlock(int index[], int indexLength,
                                                  int otherBlock) 
    {
        for (int block = BMP_INDEX_LENGTH_; block < indexLength; 
             block += SURROGATE_BLOCK_COUNT_) {
            if(equal_int(index, block, otherBlock, SURROGATE_BLOCK_COUNT_)) {
                return block;
            }
        }
        return indexLength;
    }
327347
function BlockData(index, buf, cb, count) {
  this.index = index;
  this.buf = buf;
  this.cb = cb;
  this.count = count | 0;
}
1048140
protected function _isInlineDocBlockRedundant(File $file, array $annotations, $docBlockCloseIndex) {
		$existingAnnotations = $this->_parseExistingAnnotations($file, $docBlockCloseIndex);

		foreach ($existingAnnotations as $existingAnnotation) {
			foreach ($annotations as $annotation) {
				if ($existingAnnotation->build() === $annotation->build()) {
					return true;
				}
			}
		}

		return false;
	}
365000
private function _getBlockTypeRecord($blockType): SuperTableBlockTypeRecord
    {
        if (is_string($blockType)) {
            $blockTypeRecord = SuperTableBlockTypeRecord::findOne(['uid' => $blockType]) ?? new SuperTableBlockTypeRecord();

            if (!$blockTypeRecord->getIsNewRecord()) {
                $this->_blockTypeRecordsById[$blockTypeRecord->id] = $blockTypeRecord;
            }

            return $blockTypeRecord;
        }

        if ($blockType->getIsNew()) {
            return new SuperTableBlockTypeRecord();
        }

        if (isset($this->_blockTypeRecordsById[$blockType->id])) {
            return $this->_blockTypeRecordsById[$blockType->id];
        }

        $blockTypeRecord = SuperTableBlockTypeRecord::findOne($blockType->id);

        if ($blockTypeRecord === null) {
            throw new SuperTableBlockTypeNotFoundException('Invalid block type ID: ' . $blockType->id);
        }

        return $this->_blockTypeRecordsById[$blockType->id] = $blockTypeRecord;
    }
778895
public function deleteBlockType(SuperTableBlockTypeModel $blockType): bool
    {
        Craft::$app->getProjectConfig()->remove(self::CONFIG_BLOCKTYPE_KEY . '.' . $blockType->uid);

        return true;
    }
744581
def _checkAndConvertIndex(self, index):
        
        if index < 0:
            index = len(self) + index
        if index < 0 or index >= self._doc.blockCount():
            raise IndexError('Invalid block index', index)
        return index
146263
public function getBlockTypes()
    {
        $result = [];
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $rs = $db->executeQuery('select btID from BlockTypeSetBlockTypes where btsID = ? order by displayOrder asc', [$this->getBlockTypeSetID()]);
        while (($btID = $rs->fetchColumn()) !== false) {
            $bt = BlockType::getByID($btID);
            if ($bt !== null) {
                $result[] = $bt;
            }
        }

        return $result;
    }
107258
private function resolveType(BlockTypeInterface $type)
    {
        $typeExtensions = [];
        $parentType = $type->getParent();
        $fqcn = \get_class($type);

        foreach ($this->extensions as $extension) {
            $typeExtensions = array_merge(
                $typeExtensions,
                $extension->getTypeExtensions($fqcn)
            );
        }

        return $this->resolvedTypeFactory->createResolvedType(
            $type,
            $typeExtensions,
            $parentType ? $this->getType($parentType) : null
        );
    }
258912
public function getMinedBlocks($address, $blockType = EtherscanAPIConf::BLOCK_TYPE_BLOCKS, $page = null, $offset = null) {
        if (!in_array($blockType, EtherscanAPIConf::$blockTypes)) {
            throw new \Exception("Invalid block type");
        }

        $params = [
            'module' => "account",
            'action' => "getminedblocks",
            'address' => $address,
            'blocktype' => $blockType,
        ];

        if (!is_null($page)) {
            $params['page'] = (int)$page;
        }

        if (!is_null($offset)) {
            $params['offset'] = (int)$offset;
        }

        return $this->request->exec($params);
    }
70854
private static function debugCheckLooksLikeBlocksArray(iterable $blocks): bool
    {
        $result = true;

        foreach ($blocks as $index => $block) {
            $result = $result &&
                is_int($index) === true &&
                is_array($block) === true &&
                static::debugHasKnownBlockType($block) === true;
        }

        return $result;
    }
445014
public static function matrixFieldsOfType(MatrixBlock $matrixBlock, string $fieldType): array
    {
        $foundFields = [];

        try {
            $matrixBlockTypeModel = $matrixBlock->getType();
        } catch (InvalidConfigException $e) {
            $matrixBlockTypeModel = null;
        }
        if ($matrixBlockTypeModel) {
            $fields = $matrixBlockTypeModel->getFields();
            /** @var  $field BaseField */
            foreach ($fields as $field) {
                if ($field instanceof $fieldType) {
                    $foundFields[] = $field->handle;
                }
            }
        }

        return $foundFields;
    }
491130
public function sanitizeBlock($blockType, $blockData)
    {
        $rule = $this->rules->tools[$blockType];

        return [
            'type' => $blockType,
            'data' => $this->sanitize($rule, $blockData)
        ];
    }
653677
function(changeIndex) {
			var count = 0;
			var blockIndex = 0;
			
			if (0 <= changeIndex) {
				// iterate through blocks looking for the one that contains 
				// the change with the specified changeIndex
				while (blockIndex < this._root.children.length) {
					var numChangesInCurrentBlock = this._root.children[blockIndex].children.length;
					if (((count + numChangesInCurrentBlock) - 1) < changeIndex) {
						count += numChangesInCurrentBlock; //keep going
					} else {
						// found block, go to change in block
						var changeIndexInBlock = changeIndex - count;
						return this.gotoBlock(blockIndex, changeIndexInBlock);
					}
					blockIndex++;
				}
			}
		}
1119379
protected function getDisplayLogicPrototypes(BlockInterface $block)
    {
        $collection = new PrototypeCollection([
            new OrXPrototype(),
            new AndXPrototype(),
            new EventPrototype('click_event', 'Click Event', 'event.type.click'),
            new TextPrototype('dom_node_id', 'DOM Node Id', 'node.id')
        ]);

        $owner = $block->getOwner();
        if ($owner) {
            // Avoid trying to add display logic for blocks when the current block has no owner (e.g. shared blocks)
            $blockChoices = [];
            foreach ($owner->getBlocks() as $member) {
                try {
                    $properties = $member->getProperties();

                    if ($member instanceof ChoiceFieldBlock) {
                        if (empty($member->getName())) {
                            continue;
                        }
                        if (!isset($properties['options'])) {
                            continue;
                        }
                        $choices = [];
                        foreach ($properties['options'] as $option) {
                            if (empty($option['key'])) {
                                continue;
                            }
                            $choices[] = new Choice($option['key'], $option['value']);
                        }
                        $collection->add(new SelectPrototype($member->getName(), $properties['label'], $member->getName(), $choices));
                    } elseif ($member instanceof NumberFieldBlock || $member instanceof RangeFieldBlock) {
                        if (empty($member->getName())) {
                            continue;
                        }

                        $collection->add(new NumberPrototype($member->getName(), $properties['label'], $member->getName()));
                    }

                    if (!empty($member->getName())) {
                        $blockChoices[] = new Choice($member->getName(), $member->getName());
                    }
                } catch (\Exception $e) {
                    // Avoid throwing exceptions here for now, since e.g. duplicate namesthis will cause all blocks to be uneditable.
                }
            }

            $collection->add(new SelectPrototype('block_name', 'Block Name', 'block.name', $blockChoices));
        }

        return $collection->all();
    }