Get the number of consecutive Slate nodes containing a given mark beginning
from the first received node.
966888
function getMarkLength(markType, nodes) {
  let length = 0;
  while (nodes[length] && nodes[length].marks.includes(markType)) {
    ++length;
  }
  return { markType, length };
}
529671
def mark_bl(self) -> int:
        
        counter = 0
        stringy_lines = find_stringy_lines(self.node, self.first_line_no)
        for relative_line_number, line in enumerate(self.lines):
            if relative_line_number not in stringy_lines and line.strip() == '':
                counter += 1
                self.line_markers[relative_line_number] = LineType.blank_line

        return counter
943621
NodeAVL getNextNode(NodeAVL n) {

        if (n == null) {
            n = nPrimaryNode;
        } else {
            n = n.nNext;
        }

        return n;
    }
410552
function getScanStartPosition(enclosingNode, originalRange, sourceFile) {
            var start = enclosingNode.getStart(sourceFile);
            if (start === originalRange.pos && enclosingNode.end === originalRange.end) {
                return start;
            }
            var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);
            if (!precedingToken) {
                // no preceding token found - start from the beginning of enclosing node
                return enclosingNode.pos;
            }
            // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)
            // start from the beginning of enclosingNode to handle the entire 'originalRange'
            if (precedingToken.end >= originalRange.pos) {
                return enclosingNode.pos;
            }
            return precedingToken.end;
        }
417526
function (domElt, count) {
            if (count == null) {
                count = 1;
            }
            while (domElt && count > 0) {
                domElt = domElt.previousSibling;
                if (domElt && domElt.nodeType == 1) {
                    count--;
                }
            }
            return domElt;
        }
821323
protected int getNextNode()
  {
    if (m_foundLast)
      return DTM.NULL;

    if (m_isFresh)
    {
      m_currentNode = m_traverser.first(m_root);
      m_isFresh = false;
    }
    // I shouldn't have to do this the check for current node, I think.
    // numbering\numbering24.xsl fails if I don't do this.  I think 
    // it occurs as the walkers are backing up. -sb
    else if(DTM.NULL != m_currentNode) 
    {
      m_currentNode = m_traverser.next(m_root, m_currentNode);
    }

    if (DTM.NULL == m_currentNode)
      this.m_foundLast = true;

    return m_currentNode;
  }
995438
function() {
        for (var i = 0, count = 0;i< this.children.length;i++) {
            count += this.children[i].getNodeCount();
        }
        return count + 1;
    }
93675
public int getNextNode(int elementHandle) {
		int element = m_lists.getElement(elementHandle);
		int ptr = m_lists.getNext(elementHandle);
		while (ptr != -1) {
			int e = m_lists.getElement(ptr);
			if (m_hash.equal(e, element)) {
				return ptr;
			}
			ptr = m_lists.getNext(ptr);
		}

		return -1;

	}
1224529
public int getSpanStart(Object what) {
        int count = mSpanCount;
        Object[] spans = mSpans;

        for (int i = count - 1; i >= 0; i--) {
            if (spans[i] == what) {
                int where = mSpanStarts[i];

                if (where > mGapStart)
                    where -= mGapLength;

                return where;
            }
        }

        return -1;
    }
722223
def get_first_edge_id_by_node_ids(self, node_a, node_b):
        """"""
        ret = self.get_edge_ids_by_node_ids(node_a, node_b)
        if not ret:
            return None
        else:
            return ret[0]
1018727
def getStartNodes(fdefs,calls):
    ''''''
    s=[]
    for source in fdefs:
        for fn in fdefs[source]:
            inboundEdges=False
            for call in calls:
                if call.target==fn:
                    inboundEdges=True
            if not inboundEdges:
                s.append(fn)
    return s
1232537
function listNext(node, pred) {
  pred = pred || func.fail;

  const nodes = [];
  while (node) {
    if (pred(node)) { break; }
    nodes.push(node);
    node = node.nextSibling;
  }
  return nodes;
}
458746
private static Node getFirstNonEmptyChild(Node n) {
    for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
      if (c.isBlock()) {
        Node result = getFirstNonEmptyChild(c);
        if (result != null) {
          return result;
        }
      } else if (!c.isEmpty()) {
        return c;
      }
    }
    return null;
  }
820605
@Nonnegative
  public static int getOccurrenceCount (@Nullable final String sText, final char cSearch)
  {
    int ret = 0;
    final int nTextLength = getLength (sText);
    if (nTextLength >= 1)
    {
      int nLastIndex = 0;
      int nIndex;
      do
      {
        // Start searching from the last result
        nIndex = getIndexOf (sText, nLastIndex, cSearch);
        if (nIndex != STRING_NOT_FOUND)
        {
          // Match found
          ++ret;

          // Identify the next starting position (relative index + number of
          // search strings)
          nLastIndex = nIndex + 1;
        }
      } while (nIndex != STRING_NOT_FOUND);
    }
    return ret;
  }
1232444
private Node getNextSibling(Node node) {

		if (node == null || node == root)
			return null;

		Node newNode = node.getNextSibling();
		if (newNode == null) {
			newNode = node.getParentNode();
			if (newNode == null || node == root)
				return null;
			int parentAccept = acceptNode(newNode);
			if (parentAccept == NodeFilter.FILTER_SKIP) {
				return getNextSibling(newNode);
			}
			return null;
		}

		int accept = acceptNode(newNode);

		if (accept == NodeFilter.FILTER_ACCEPT)
			return newNode;
		else if (accept == NodeFilter.FILTER_SKIP) {
			Node fChild = getFirstChild(newNode);
			if (fChild == null)
				return getNextSibling(newNode);

			return fChild;
		} else
			// if (accept == NodeFilter.REJECT_NODE)
			return getNextSibling(newNode);

	}
229124
private static Stream<Node> streamChildNodes(Node node) {
        int children = node.getChildNodes().getLength();
        Node firstChild = node.getFirstChild();
        if (firstChild == null) return Stream.empty();
        return Stream.iterate(firstChild, prev -> prev != null ? prev.getNextSibling() : null)
            .limit(children)
            .filter(n -> n != null);
    }
1309618
private static Node getNthSibling(Node first, int index) {
    Node sibling = first;
    while (index != 0 && sibling != null) {
      sibling = sibling.getNext();
      index--;
    }
    return sibling;
  }