// Return the number of nodes for the given level.
337508
func (l *level) numNodes() int {
	num := len(l.nodes)
	if l.pwc != nil {
		num++
	}
	if l.fwc != nil {
		num++
	}
	return num
}
570274
func maxEntriesForLevel(level uint8) int {
	numEntries := level0MaxEntries
	for l := level; l > 0; l-- {
		numEntries *= 2
	}
	return numEntries
}
135262
func (e *Element) GetChildNodeIds() ([]int, error) {
	e.lock.RLock()
	defer e.lock.RUnlock()

	if !e.ready {
		return nil, &ElementNotReadyErr{}
	}

	if e.node == nil || e.node.Children == nil {
		return nil, &ElementHasNoChildrenErr{}
	}

	ids := make([]int, len(e.node.Children))
	for k, child := range e.node.Children {
		ids[k] = child.NodeId
	}
	return ids, nil
}
745992
func (t *treeNoder) NumChildren() (int, error) {
	children, err := t.Children()
	if err != nil {
		return 0, err
	}

	return len(children), nil
}
1084444
func (n *Node) getChild(key string) *Node {
	if strings.Contains(key, "::") {
		key = strings.Replace(key, "::", ":", -1)
	}
	if v, ok := n.children[key]; ok {
		return v
	}
	for _, c := range n.segChildren {
		if c.segment == key {
			return c
		}
	}
	for _, c := range n.optionChildren {
		if c.segment == key {
			return c
		}
	}
	for _, c := range n.varyChildren {
		if c.segment == key {
			return c
		}
	}
	return nil
}
424460
func (d *DecisionTreeNode) getNestedString(level int) string {
	buf := bytes.NewBuffer(nil)
	tmp := bytes.NewBuffer(nil)
	for i := 0; i < level; i++ {
		tmp.WriteString("\t")
	}
	buf.WriteString(tmp.String())
	if d.Children == nil {
		buf.WriteString(fmt.Sprintf("Leaf(%s)", d.Class))
	} else {
		var keys []string
		buf.WriteString(fmt.Sprintf("Rule(%s)", d.SplitRule))
		for k := range d.Children {
			keys = append(keys, k)
		}
		sort.Strings(keys)
		for _, k := range keys {
			buf.WriteString("\n")
			buf.WriteString(tmp.String())
			buf.WriteString("\t")
			buf.WriteString(k)
			buf.WriteString("\n")
			buf.WriteString(d.Children[k].getNestedString(level + 1))
		}
	}
	return buf.String()
}
544343
func (nm nodeMap) get(p Pather) *node {
	n, ok := nm[p]
	if !ok {
		n = &node{
			pather: p,
		}
		nm[p] = n
	}
	return n
}
1155864
func (l Logger) Level(lvl Level) Logger {
	l.level = lvl
	return l
}
1076257
func SetHookLevel(level LevelType) {
	singltonLock.RLock()
	defer singltonLock.RUnlock()

	blog.SetHookLevel(level)
}
861827
func (n *node) Count(data interface{}) (int, error) {
	return n.Select().Count(data)
}
314874
func (n node) Child(name string) node {
	for _, c := range n.children {
		if c.name == name {
			return c
		}
	}
	return node{}
}
1171779
func (writer *baseFileWriter) Level() LevelType {
	writer.lock.RLock()
	defer writer.lock.RUnlock()
	return writer.blog.Level()
}
524394
func (t *Tab) requestChildNodes(nodeId, depth int) {
	_, err := t.DOM.RequestChildNodes(nodeId, depth, false)
	if err != nil {
		t.debugf("error requesting child nodes: %s\n", err)
	}
}
1046221
func (l *Logger) GetLevel() Level {
	l.mu.Lock()
	defer l.mu.Unlock()
	return l.l
}
293995
func (l *ModuleLevels) GetLevel(module string) api.Level {
	level, exists := l.levels[module]
	if !exists {
		level, exists = l.levels[""]
		// no configuration exists, default to info
		if !exists {
			level = api.INFO
		}
	}
	return level
}
730048
func calculateNodeCount(height, size uint64) uint64 {
	if isPowerOfTwo(size) {
		return 2*size - 1
	}
	count := size
	prev := size
	i := uint64(1)
	for ; i < height; i++ {
		next := (prev + (prev % 2)) / 2
		count += next
		prev = next
	}
	return count
}
699416
func (n *NodeInfo) Node() *v1.Node {
	if n == nil {
		return nil
	}
	return n.node
}