Compute the number of elements and sum of counts for every entry that
is strictly before <code>node</code>.
431487
@SuppressWarnings("WeakerAccess")
    public long headSum(int node) {
        final int left = tree.left(node);
        long sum = aggregatedCounts[left];
        for (int n = node, p = tree.parent(node); p != IntAVLTree.NIL; n = p, p = tree.parent(n)) {
            if (n == tree.right(p)) {
                final int leftP = tree.left(p);
                sum += counts[p] + aggregatedCounts[leftP];
            }
        }
        return sum;
    }
1351754
private int getNumberOfNeighborConnections(int node) {
        int numberOfConnections = 0;

        // get the set of neighbors
        Set<Integer> neighbors = getNeighbors(node);

        if (neighbors.size() > 0) {
            // for each pair of neighbors, test if there is a connection
            Object[] nodeArray = neighbors.toArray();
            // sort the Array so we can use a simple iteration with two for loops to access all pairs
            Arrays.sort(nodeArray);

            for (int i=0; i<neighbors.size(); i++) {
                int outerNode = (Integer) nodeArray[i];
                for (int j=i+1; j<neighbors.size(); j++) {
                    int innerNode = (Integer) nodeArray[j];
                    // in case of a connection - increade connection counter
                    // order of the nodes doesn't matter for undirected graphs
                    if (undirectedGraph.containsEdge(innerNode, outerNode)) {
                        numberOfConnections++;
                    }
                }
            }
        }

//        logger.info(neighbors.size() + " - " + numberOfConnections);

        return numberOfConnections;
    }
1064160
private int countOfMode(boolean data) {
        int count = 0;
        for (Node p = head; p != null; ) {
            if (!p.isMatched()) {
                if (p.isData != data)
                    return 0;
                if (++count == Integer.MAX_VALUE) // saturated
                    break;
            }
            Node n = p.next;
            if (n != p)
                p = n;
            else {
                count = 0;
                p = head;
            }
        }
        return count;
    }
998768
private function checkCount(){
        $cnt = (int) $this->getMaxEntries();
        if ($cnt !== NULL && count($this->values) !== $cnt){
            trigger_error("Wrong count of Elements. Expected are $cnt. But right now there are ". count($this->values));
        }

    }
220671
def read_counts(node):
  
  cfg.forward(node, cfg.ReachingDefinitions())

  rc = ReadCounts()
  rc.visit(node)
  return rc.n_read
103168
def count(self):
        ""
        if getattr(self, '_count', None) is None:
            self._count = getattr(self.node, 'count', 0)
        return self._count
1027826
public int numberOfElements() {
        int n = 0;
        for (SortedSet<Integer> cell : cells) {
            n += cell.size();
        }
        return n;
    }
775304
@Deprecated
	public int count() {
		int count = (clusteringFeature != null) ? 1 : 0;
		for (ClusteringTreeNode child : children) {
			count += child.count();
		}
		return count;
	}
691231
function count(predicate) {
  predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;

  let c = 0;

  for (let item of this) {
    if (predicate(item)) c++;
  }

  return c;
}
1348835
private int countLiveNodes(Block b, Iterator<DatanodeDescriptor> nodeIter) {
    int live = 0;
    Collection<DatanodeDescriptor> nodesCorrupt = null;
    if (corruptReplicas.size() != 0) {
      nodesCorrupt = corruptReplicas.getNodes(b);
    }
    while (nodeIter.hasNext()) {
      DatanodeDescriptor node = nodeIter.next();
      if (((nodesCorrupt != null) && (nodesCorrupt.contains(node))) ||
        node.isDecommissionInProgress() || node.isDecommissioned()) {
        // do nothing
      } else {
        live++;
      }
    }
    return live;
  }
208252
protected int getChildCount(){
		int num=0;
		LazyNode token=child;
		while(token!=null){
			num++;
			token=token.next;
		}
		return num;
	}
1170093
int traverseAndCountElements() {
		int num = 0;

		for (Entry<?, ?> entry : table) {
			while (entry != null) {
				num++;
				entry = entry.next;
			}
		}

		return num;
	}
383312
public int getNodeCount(String strKey)
    {
        int iCount = 0;
        Node node = this.getNode(null, strKey, CreateMode.DONT_CREATE, false);
        if (node != null)
        {
            String key = strKey;
            if (key.lastIndexOf('/') != -1)
                key = key.substring(key.lastIndexOf('/') + 1);
            Node nodeStart = node.getParentNode();
            NodeList nodeList = ((Element)nodeStart).getElementsByTagName(key);
            if (nodeList != null)
            {
                for (int i = 0; i < nodeList.getLength(); i++)
                {
                    if (nodeList.item(i).getParentNode() == nodeStart)
                        iCount++;    // Get the last child.
                }
            }
        }
        return iCount;   // Override this
    }
807344
@Override
    public int getChildCount(Object nodeObj) {
        if (debugger == null) {
            return 0;
        }
        VariableNode node = (VariableNode) nodeObj;
        return children(node).length;
    }
1336522
@Override
	public boolean preVisit(Operator<?> node) {
		// check if node was already visited
		if (!this.visitedNodes.add(node)) {
			return false;
		}

		// apply the appropriate check method
		if (node instanceof FileDataSinkBase) {
			checkFileDataSink((FileDataSinkBase<?>) node);
		} else if (node instanceof FileDataSourceBase) {
			checkFileDataSource((FileDataSourceBase<?>) node);
		} else if (node instanceof GenericDataSinkBase) {
			checkDataSink((GenericDataSinkBase<?>) node);
		} else if (node instanceof BulkIterationBase) {
			checkBulkIteration((BulkIterationBase<?>) node);
		} else if (node instanceof SingleInputOperator) {
			checkSingleInputContract((SingleInputOperator<?, ?, ?>) node);
		} else if (node instanceof DualInputOperator<?, ?, ?, ?>) {
			checkDualInputContract((DualInputOperator<?, ?, ?, ?>) node);
		}
		if(node instanceof Validatable) {
			((Validatable) node).check();
		}
		return true;
	}
122218
public static <T> int count(Iterable<T> iterable, Predicate<? super T> predicate, int batchSize, ForkJoinPool executor)
    {
        CountCombiner<T> combiner = new CountCombiner<>();
        CountProcedureFactory<T> procedureFactory = new CountProcedureFactory<>(predicate);
        FJIterate.forEach(iterable, procedureFactory, combiner, batchSize, executor);
        return combiner.getCount();
    }
1221286
function countIdentifiers (node) {
    if (!node.children) return 0;
    var count = 0, i = 0, len = node.children.length, type;
    for (; i < len; i++) {
      type = node.children[i].type;
      if (type === "identifier" || type === "binder" || type === "key") count += 1;
      else count += countIdentifiers(node.children[i]);
    }
    return count;
  }