Adds block annotations

@param docId
@param expandAbbrevs
357762
public static void extractText(JCas jcas, BDocument bDocument,
            String docId, boolean expandAbbrevs) {

        StringBuffer sb = new StringBuffer("");
        int currBegin = 0, currPageId = 0;

        DocumentPage currPage = new DocumentPage(jcas);
        currPage.setBegin(0);

        Set<Abbrev> abbrevs = null;
        if (expandAbbrevs) {
            // pass over the text to find abbrevs
            StringBuffer abbrevSb = new StringBuffer("");
            for (BBlock block : bDocument.getBlocks()) {
                abbrevSb.append(cleanupText(block, docId));
            }
            abbrevs = AbbreviationExpander.getAbbrevs(abbrevSb.toString());
        }

        for (BBlock block : bDocument.getBlocks()) {

            String text = cleanupText(block, docId);
            if (expandAbbrevs) {
                text = AbbreviationExpander.expand(text, abbrevs);
            }

            // add lines
            int currLineBegin = currBegin;
            for (BLine bLine : block.getLines()) {
                String lineText = bLine.getText();
                int lineLength = lineText.replaceAll(" +", " ").length();
                // LATER watch out: begin,end is ~approximate~
                // TODO especially because of abbrev expansion!
                DocumentLine annLine = new DocumentLine(jcas, currLineBegin,
                        currLineBegin + lineLength);
                currLineBegin += lineLength;
                annLine.setX(bLine.getRegion().x);
                annLine.setY(bLine.getRegion().y);
                annLine.setHeight(bLine.getRegion().height);
                annLine.setWidth(bLine.getRegion().width);
                annLine.setPageId(block.getPageId());
                annLine.setBlock(block.getId());
                annLine.setLineText(lineText); // LATER a workaround
                annLine.setBeginnings(new FloatArray(jcas, bLine
                        .getBeginnings().size()));
                for (int i = 0; i < bLine.getBeginnings().size(); i++) {
                    annLine.setBeginnings(i, bLine.getBeginnings().get(i));
                }
                annLine.setEndings(new FloatArray(jcas, bLine.getEndings()
                        .size()));
                for (int i = 0; i < bLine.getEndings().size(); i++) {
                    annLine.setEndings(i, bLine.getEndings().get(i));
                }
                annLine.addToIndexes();
            }

            // add block
            DocumentBlock annBlock = new DocumentBlock(jcas, currBegin,
                    currBegin + text.length());
            currBegin += text.length();
            sb.append(text);

            annBlock.setElementId(block.getId());
            annBlock.setX(block.getRegion().x);
            annBlock.setY(block.getRegion().y);
            annBlock.setHeight(block.getRegion().height);
            annBlock.setWidth(block.getRegion().width);
            annBlock.setHasBold(block.isHasBold());
            annBlock.setHasManyFontsizes(block.isHasManyFontsizes());
            annBlock.setMedianFontsize(block.getMedianFontsize());
            annBlock.setPageId(block.getPageId());
            annBlock.addToIndexes();

            // update page
            if (block.getPageId() > currPageId) {
                currPage.setEnd(currBegin);
                currPage.setPageId(currPageId);
                currPage.addToIndexes();

                currPage = new DocumentPage(jcas);
                currPage.setBegin(currBegin);
                currPageId = block.getPageId();
            }
        }

        jcas.setDocumentText(sb.toString());
    }
641991
protected List<ExpandDataTrunk> getExpansionBranches(final Collection<String> expansionNames) {
        if (expansionNames != null) {
            final List<ExpandDataTrunk> expandDataTrunks = new ArrayList<ExpandDataTrunk>();
            for (final String subExpansionName : expansionNames) {
                expandDataTrunks.add(new ExpandDataTrunk(new ExpandDataDetails(subExpansionName)));
            }

            return expandDataTrunks;
        }

        return null;
    }
915168
protected void addDocIterators(Collection<Iterator<Document>> docIters,
                                   String[] fileNames) throws IOException {
        // All the documents are listed in one file, with one document per line
        for (String s : fileNames)
            docIters.add(new DependencyFileDocumentIterator(s));
    }
758534
private <T extends Block> void addBlock(Block currentBlock, List<T> blocks)
    {
        if (currentBlock != null && this.matcher.match(currentBlock)) {
            blocks.add((T) currentBlock);
        }
    }
280481
def _expand_block(cls, block):
        
        cls._parse_header(BlockHeader, block)
        if 'batches' in block:
            block['batches'] = [cls._expand_batch(b) for b in block['batches']]
        return block
595258
private <T extends PackageDoc> void mapAnnotations(Map<String,List<T>> map, PackageDoc doc,
            T holder) {
        for (AnnotationDesc annotation : doc.annotations()) {
            AnnotationTypeDoc annotationDoc = annotation.annotationType();
            refList(map, annotationDoc).add(holder);
        }
    }
358181
private Action extractDocumentationAnnotations(
			ExtDirectMethodDocumentation documentation) {
		if (!documentation.value().isEmpty()) {
			ActionDoc actionDoc = new ActionDoc(getAction(), documentation.value(),
					documentation.author(), documentation.version(),
					documentation.deprecated());
			ExtDirectDocParameters docParameters = documentation.parameters();
			if (null != docParameters) {
				String[] params = docParameters.params();
				String[] descriptions = docParameters.descriptions() == null
						? new String[params.length]
						: docParameters.descriptions();
				if (params.length == descriptions.length) {
					for (int i = 0; i < params.length; i++) {
						actionDoc.getParameters().put(params[i],
								descriptions[i] == null ? "No description"
										: descriptions[i]);
					}
				}
				else {
					LogFactory.getLog(MethodInfo.class).info(
							"Documentation: skip generation of parameters, params size is different from descriptions size");
				}
			}
			ExtDirectDocReturn docReturn = documentation.returnMethod();
			if (null != docReturn) {
				String[] properties = docReturn.properties();
				String[] descriptions = docReturn.descriptions() == null
						? new String[properties.length]
						: docReturn.descriptions();
				if (properties.length == descriptions.length) {
					for (int i = 0; i < properties.length; i++) {
						actionDoc.getReturnMethod().put(properties[i],
								descriptions[i] == null ? "No description"
										: descriptions[i]);
					}
				}
				else {
					LogFactory.getLog(MethodInfo.class).info(
							"Documentation: skip generation of return method properties, properties size is different from descriptions size");
				}
			}
			return actionDoc;
		}
		return this.action;
	}
1210443
public void addBlock(String tierAlias, long blockId, long blockSize, long blockLastAccessTimeMs) {
    UIFileBlockInfo block =
        new UIFileBlockInfo(blockId, blockSize, blockLastAccessTimeMs, tierAlias,
            mAlluxioConfiguration);
    List<UIFileBlockInfo> blocksOnTier = mBlocksOnTier.get(tierAlias);
    if (blocksOnTier == null) {
      blocksOnTier = new ArrayList<>();
      mBlocksOnTier.put(tierAlias, blocksOnTier);
    }
    blocksOnTier.add(block);

    Long sizeOnTier = mSizeOnTier.get(tierAlias);
    mSizeOnTier.put(tierAlias, (sizeOnTier == null ? 0L : sizeOnTier) + blockSize);
  }
379959
def _docstring_getblocks(self):
        
        #If there are no lines to look at, we have nothing to do here.
        if self.ibuffer[0] == self.ibuffer[1]:
            return []

        lines = self.context.bufferstr[self.ibuffer[0]:self.ibuffer[1]]
        docblock = []
        result = []
        self._doclines = []

        #We need to keep track of the line number for the start of the
        #documentation strings.
        docline = 0
        doclength = 0

        first = self.docparser.RE_DOCS.match(lines[0])
        if first is not None:
            docblock.append(first.group("docstring"))
            docline = self.ibuffer[0]
            self._doclines.append(docline)
            doclength += len(lines[0]) + 1 # + 1 for \n removed by split.

            #We need to search backwards in the main buffer string for
            #additional tags to add to the block
            i = self.ibuffer[0] - 1
            while i > 0:
                current = self.context.bufferstr[i]
                docmatch = self.docparser.RE_DOCS.match(current)
                if docmatch is not None:
                    docblock.append(docmatch.group("docstring"))
                    docline = i
                    doclength += len(current) + 1
                else:
                    break
                i -= 1

        #Reverse the docblock list since we were going backwards and appending.
        if len(docblock) > 0:
            docblock.reverse()

        #Now handle the lines following the first line. Also handle the
        #possibility of multiple, separate blocks that are still valid XML.
        #We have to keep going until we have exceed the operational changes
        #or found the decorating element.
        i = self.ibuffer[0] + 1
        while (i < len(self.context.bufferstr) and 
               (i < self.ibuffer[1] or len(docblock) > 0)):
            line = self.context.bufferstr[i]
            docmatch = self.docparser.RE_DOCS.match(line)
            if docmatch is not None:
                docblock.append(docmatch.group("docstring"))
                doclength += len(line)
                if docline == 0:
                    docline = i
                #Only track actual documentation lines that are within the 
                #operations list of lines.
                if i < self.ibuffer[1]:
                    self._doclines.append(i)

            elif len(docblock) > 0:
                key = self._docstring_key(line)
                result.append((docblock, docline, doclength, key))
                docblock = []
                docline = 0
                doclength = 0

            #We need to exit the loop if we have exceeded the length of
            #the operational changes
            if len(docblock) == 0 and i > self.ibuffer[1]:
                break
            i += 1

        return result
1326170
function expand_code(docset) {
  var results = [];

  if (docset["code"] && docset["code"]["members"]) {
    _.each(docset["code"]["members"], function(m) {
      if (! (constructor_found && m["name"] == "Constructor") )
        results.push(code_to_docset(m));
    });
  }

  return results;
}
313823
public void expandListParagraphs ()
  {
    if (m_eType != EBlockType.ORDERED_LIST && m_eType != EBlockType.UNORDERED_LIST)
    {
      return;
    }
    Block aOuter = m_aBlocks;
    Block aInner;
    boolean bHasParagraph = false;
    while (aOuter != null && !bHasParagraph)
    {
      if (aOuter.m_eType == EBlockType.LIST_ITEM)
      {
        aInner = aOuter.m_aBlocks;
        while (aInner != null && !bHasParagraph)
        {
          if (aInner.m_eType == EBlockType.PARAGRAPH)
            bHasParagraph = true;
          aInner = aInner.m_aNext;
        }
      }
      aOuter = aOuter.m_aNext;
    }
    if (bHasParagraph)
    {
      aOuter = m_aBlocks;
      while (aOuter != null)
      {
        if (aOuter.m_eType == EBlockType.LIST_ITEM)
        {
          aInner = aOuter.m_aBlocks;
          while (aInner != null)
          {
            if (aInner.m_eType == EBlockType.NONE)
              aInner.m_eType = EBlockType.PARAGRAPH;
            aInner = aInner.m_aNext;
          }
        }
        aOuter = aOuter.m_aNext;
      }
    }
  }
1211983
def expand_all(self):
        """"""
        block = self.editor.document().firstBlock()
        while block.isValid():
            TextBlockHelper.set_collapsed(block, False)
            block.setVisible(True)
            block = block.next()
        self._clear_block_deco()
        self._refresh_editor_and_scrollbars()
        self.expand_all_triggered.emit()
421194
private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(
          "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]",
          entityTypeNode.getEntityType().getId(),
          entityTypeNode.isSkip());
    }

    if (!entityTypeNode.isSkip()) {
      // get referenced entities excluding entities of mappedBy attributes
      EntityType entityType = entityTypeNode.getEntityType();
      Set<EntityTypeNode> refEntityMetaSet =
          stream(entityType.getOwnAllAttributes())
              .filter(attribute -> isProcessableAttribute(attribute, entityType))
              .flatMap(
                  attr -> {
                    EntityTypeNode nodeRef =
                        new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack());
                    Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
                    dependenciesRef.add(nodeRef);
                    return dependenciesRef.stream();
                  })
              .collect(toCollection(HashSet::new));

      EntityType extendsEntityMeta = entityType.getExtends();
      if (extendsEntityMeta != null) {
        EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack());

        // Add extended entity to set
        refEntityMetaSet.add(nodeRef);

        // Add dependencies of extended entity to set
        Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
        refEntityMetaSet.addAll(dependenciesRef);
      }
      return refEntityMetaSet;
    } else {
      return Sets.newHashSet();
    }
  }
753183
def expand_block(self, feat):
        
        chrom_end = self._ref_sizes.get(feat.chrom)
        if chrom_end:
            if feat.start < self._end_buffer:
                feat.start = 0
            if feat.stop >= chrom_end - self._end_buffer:
                feat.stop = chrom_end
        return feat
1351000
final public void addIdFromDoc(Integer docId, Long reference) {
    if (!closed && (docId != null)) {
      addSinglePoint(docId, 0, 0, docId, reference);
    }
  }
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;
	}
1039720
private List<Match> expandWithIgnoreItem(int docId, Match match) {
    List<Match> list = new ArrayList<>();
    try {
      Set<Integer> ignoreList = ignoreItem.getFullEndPositionList(docId,
          match.endPosition);
      if (ignoreList != null) {
        for (Integer endPosition : ignoreList) {
          list.add(new Match(match.startPosition, endPosition));
        }
      }
    } catch (IOException e) {
      log.debug(e);
    }
    return list;
  }