Get the density of links as a percentage of the content. This is the
amount of text that is inside a link divided by the total text in the
node.

@param e
@return
480643
private static float getLinkDensity(Element e) {
        Elements links = getElementsByTag(e, "a");
        int textLength = getInnerText(e, true).length();
        float linkLength = 0.0F;
        for (Element link : links) {
            linkLength += getInnerText(link, true).length();
        }
        return linkLength / textLength;
    }
825991
public static final int getW(Element e) {
        int ret = e.getOffsetWidth();
        ret -= MiscUtils.getComputedStyleInt(e, "paddingLeft");
        ret -= MiscUtils.getComputedStyleInt(e, "paddingRight");
        ret -= MiscUtils.getComputedStyleInt(e, "borderLeftWidth");
        ret -= MiscUtils.getComputedStyleInt(e, "borderRightWidth");
        return Math.max(ret, 0);
    }
10541
private static int getContentScore(Element node) {
        try {
            return Integer.parseInt(node.attr(CONTENT_SCORE));
        } catch (NumberFormatException e) {
            return 0;
        }
    }
620294
public function calculateDensities()
		{
			if ($this->numWordsInWrappedLines == 0)
			{
				$this->numWordsInWrappedLines = $this->numWords;
				$this->numWrappedLines = 1;
			}
			$this->textDensity = $this->numWordsInWrappedLines / $this->numWrappedLines;
			$this->linkDensity = $this->numWords == 0 ? 0 : $this->numWordsInAnchorText / $this->numWords;
			
			// Set full text words only if this block is past the threshold
			if($this->textDensity >= self::TEXT_DENSITY_THRESHOLD)
			{
				$this->numFullTextWords = $this->numWords;
			}
		}
254530
@Override
	public boolean add(E e) {
		if (capacity <= linkedBlockingDeque.size())
			linkedBlockingDeque.removeFirst();
		return linkedBlockingDeque.add(e);
	}
364746
function getPercentage() {
  const type = NodeType.PercentageType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const content = getNumberOrInterpolation();
  const end = getLastPosition(content, line, column, 1);

  // Skip `%`.
  pos++;

  return newNode(type, content, line, column, end);
}
670943
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) {
        return getDocLink(context, utils.getEnclosingTypeElement(element), element,
                new StringContent(label));
    }
759618
public double getColorPercentage(Area node)
    {
        int tlen = 0;
        double sum = 0;
        
    	for (Box box : node.getBoxes())
    	{
    		int len = letterLength(box.getText());
    		if (len > 0)
    		{
    			sum += getColorPercentage(box.getColor()) * len;
    			tlen += len;
    		}
    	}
        
        for (int i = 0; i < node.getChildCount(); i++)
        {
            Area child = node.getChildAt(i);
            int nlen = letterLength(child.getText());
            tlen += nlen;
            sum += getColorPercentage(child) * nlen;
        }
        if (tlen == 0)
            return 0;
        else
            return sum / tlen;
    }
920110
public FullTextLink getFullTextLinks(int i) {
    if (FullTextLinkList_Type.featOkTst && ((FullTextLinkList_Type)jcasType).casFeat_fullTextLinks == null)
      jcasType.jcas.throwFeatMissing("fullTextLinks", "de.julielab.jules.types.FullTextLinkList");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i);
    return (FullTextLink)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i)));}
1279039
@IntRange(from = -1)
    long getExactContentLengthRangeFrom0(@NonNull DownloadConnection.Connected connected) {
        final String contentRangeField = connected.getResponseHeaderField(CONTENT_RANGE);
        long contentLength = -1;
        if (!Util.isEmpty(contentRangeField)) {
            final long rightRange = getRangeRightFromContentRange(contentRangeField);
            // for the range from 0, the contentLength is just right-range +1.
            if (rightRange > 0) contentLength = rightRange + 1;
        }

        if (contentLength < 0) {
            // content-length
            final String contentLengthField = connected.getResponseHeaderField(CONTENT_LENGTH);
            if (!Util.isEmpty(contentLengthField)) {
                contentLength = Long.parseLong(contentLengthField);
            }
        }

        return contentLength;
    }
51633
public static String percentFrom(final double a, final double b)
	{

		double bVal = b;

		if (bVal == 0.) {
			bVal = 1.;
		}

		StringBuilder rep = new StringBuilder();
		double d = ((long) ((a / bVal) * 10000) / 100.);
		if (d < 10.0) {
			rep.append('0');
		}

		rep.append(d);
		while (rep.length() < 5) {
			rep.append('0');
		}

		return rep + "%";
	}
932025
private static String getInnerText(Element e, boolean normalizeSpaces) {
        String textContent = e.text().trim();

        if (normalizeSpaces) {
            textContent = textContent.replaceAll(Patterns.REGEX_NORMALIZE, "");
        }

        return textContent;
    }
1128159
function getContent(node) {
    var text = '', atom;
    for (var i = 0; i<node.childNodes.length; i++) {
      if (node.childNodes[i].nodeType === 1) {
        atom = node.childNodes[i]._bfs_text;
      } else if (node.childNodes[i].nodeType === 3) {
        atom = node.childNodes[i].data;
      } else
        continue;
      if (text.match(/[\t ]+$/) && atom.match(/^[\t ]+/)) {
        text = text.replace(/[\t ]+$/,'') + ' ' + atom.replace(/^[\t ]+/, '');
      } else {
        text = text + atom;
      }
    }
    return text;
  }
582061
public long getContentLength() {
		String value = getFirst(CONTENT_LENGTH);
		return (value != null ? Long.parseLong(value) : -1);
	}
360255
public Content getLink(LinkInfoImpl linkInfo) {
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
        return factory.getLink(linkInfo);
    }
1066661
protected Float getExpressionRatio(MediaExpression e)
    {
        if (e.size() == 2) //the ratio is two integer values
        {
            Term<?> term1 = e.get(0);
            Term<?> term2 = e.get(1);
            if (term1 instanceof TermInteger && term2 instanceof TermInteger
                    && (((TermInteger) term2).getOperator() == Operator.SLASH))
                return ((TermInteger) term1).getValue() / ((TermInteger) term2).getValue();
            else
                return null;
        }
        else
            return null;
    }
1251768
public int getSymLinkDepth() {
        int value = 0;
        try {
            value = Integer.parseInt(line.getOptionValue(ARGUMENT.SYM_LINK_DEPTH, "0"));
            if (value < 0) {
                value = 0;
            }
        } catch (NumberFormatException ex) {
            LOGGER.debug("Symbolic link was not a number");
        }
        return value;
    }