code: public void addBlock(String blockName, boolean isOptional) throws BlockNotDefinedException {
          int blockNo = mtp.lookupBlockName(blockName);
          if (blockNo == -1) {
              if (isOptional) {
                  return;
              }
              throw new BlockNotDefinedException(blockName);
          }
          while (blockNo != -1) {
              addBlockByNo(blockNo);
              blockNo = mtp.blockTab[blockNo].nextWithSameName;
          }
      }
docs: Adds an instance of a template block.
  <p>
  If the block contains variables, these variables must be set before the block is added. If the block contains
  subblocks (nested blocks), the subblocks must be added before this block is added. If multiple blocks exist with
  the specified name, an instance is added for each block occurrence.
  
  @param blockName the name of the block to be added. Case-insensitive.
  @param isOptional specifies whether an exception should be thrown when the block does not exist in the template.
  If <code>isOptional</code> is <code>false</code> and the block does not exist, an exception is thrown.
  @throws BlockNotDefinedException when no block with the specified name exists in the template and
  <code>isOptional</code> is <code>false</code>.