Returns how many items are in the tree.
420918
function length(array)
{
	if (array.height === 0)
	{
		return array.table.length;
	}
	else
	{
		return array.lengths[array.lengths.length - 1];
	}
}
971043
def counts(A, parent, post):
    
    n = A.size[0]
    colcount = matrix(0,(n,1))
    ancestor = matrix(range(n),(n,1))
    maxfirst = matrix(-1,(n,1))
    prevleaf = matrix(-1,(n,1))
    first = matrix(-1,(n,1))
    
    for k in range(n):
        j = post[k]
        if first[j] == -1:
            colcount[j] = 1
        else:
            colcount[j] = 0
        while  j != -1 and first[j] == -1:
            first[j] = k;
            j = parent[j]

    cp,ri,_ = A.CCS
    for k in range(n):
        j = post[k]
        if parent[j] != j:
            colcount[parent[j]] -= 1
        for p in range(cp[j],cp[j+1]):
            i = ri[p]
            if i <= j: continue
            q, jleaf = __leaf(i, j, first, maxfirst, prevleaf, ancestor)
            if jleaf >= 1: colcount[j] += 1
            if jleaf == 2: colcount[q] -= 1
        if parent[j] != j: ancestor[j] = parent[j]
    for j in range(n):
        if parent[j] != j: colcount[parent[j]] += colcount[j]

    return colcount
1305655
def size(self):
        """"""
        if self.children:
            return sum( ( c.size() for c in self.children.values() ) ) + 1
        else:
            return 1
1193869
def count(self, Class, set=None, recursive=True,  ignore=True, node=None):
        
        return sum(1 for i in self.select(Class,set,recursive,ignore,node) )
217048
private int depth() {
        int i = 0;
        for (TreeString p = this; p != null; p = p.parent) {
            i++;
        }
        return i;
    }
237135
def get_count(self, prefix=''):
        """"""
        return sum([self.counters[key]
                    for key in self.messages if key.startswith(prefix)])
1188726
public function count()
    {
        $traversable = $this->optimizeUnwrap();

        if (is_array($traversable)) {
            return count($traversable);
        }

        return iterator_count($traversable);
    }
725606
public void countItems() {
    itemCounts = new ItemCounts();
    itemCounts.startTime = System.currentTimeMillis();
    itemCounts.numDirectories = 1; // count the current directory
    itemCounts.numFiles = 0;
    itemCounts.numBlocks = 0;
    if (children != null) {
      for (INode child : children) {
        countItemsRecursively(child);
      }
    }
    itemCounts.finishTime = System.currentTimeMillis();
  }
831312
function length(item) {
        if (!validateHelpers.isUndefined(item.length)) {
            return item.length;
        }

        if (validateHelpers.isObject(item)) {
            return Object.keys(item).length;
        }

        return 0;
    }
1298397
function(deep) {
			var cl = this.children,
				i,
				l,
				n;
			if (!cl) {
				return 0;
			}
			n = cl.length;
			if (deep !== false) {
				for (i = 0, l = n; i < l; i++) {
					n += cl[i].countChildren();
				}
			}
			return n;
		}
1221801
def count(self):
        ""
        if self._nodes is None:
            return 1
        return sum(i.count() for i in self._nodes)
253600
function countSubTreeDepth(scope) {
          var thisLevelDepth = 0,
              childNodes = scope.childNodes(),
              childNode,
              childDepth,
              i;
          if (!childNodes || childNodes.length === 0) {
            return 0;
          }
          for (i = childNodes.length - 1; i >= 0 ; i--) {
            childNode = childNodes[i],
            childDepth = 1 + countSubTreeDepth(childNode);
            thisLevelDepth = Math.max(thisLevelDepth, childDepth);
          }
          return thisLevelDepth;
        }
300675
def leaf_count(self):
        
        if not self._sub_categories:
            return 1
        return sum(category.leaf_count for category in self._sub_categories)
820698
def num_trees(self):
        
        num_trees = ctypes.c_int(0)
        _safe_call(_LIB.LGBM_BoosterNumberOfTotalModel(
            self.handle,
            ctypes.byref(num_trees)))
        return num_trees.value
672334
def count_leaves(x):
    
    if hasattr(x, 'keys'):
        x = list(x.values())
    if hasattr(x, '__getitem__'):
        return sum(map(count_leaves, x))

    return 1
1082333
def rowCount(self, parent):
        

        if parent.column() > 0:
            return 0

        if not parent.isValid():
            parentItem = self.root
        else:
            parentItem = parent.internalPointer()

        return parentItem.childCount()
829924
def getCountGT(self, item):
        """"""
        index = bisect.bisect_right(self._list, item)
        return len(self._list) - index