/*
deleteNSRecursiveChildren deletes recursive children of any keyname.
*/
421152
func (delimited *Delimited) deleteNSRecursiveChildren(val string) bool {
	if val == "" {
		return true
	}
	status := true
	children := strings.Split(val, ",")
	for _, childKey := range children {
		childVal := "val::" + strings.Split(childKey, "key::")[1]
		status = status && delimited.deleteNSRecursiveChildren(delimited.db.GetVal(childKey))
		status = status && delimited.db.DelKey(childKey)
		status = status && delimited.db.DelKey(childVal)
	}
	return status
}
825173
func removeRedundantEdges(ns nodes) {
	// Walk the nodes and outgoing edges in reverse order to prefer
	// removing edges with the lowest weight.
	for i := len(ns); i > 0; i-- {
		n := ns[i-1]
		in := sortedEdges(n.in)
		for j := len(in); j > 0; j-- {
			if e := in[j-1]; e.residual && isRedundant(e) {
				delete(e.src.out, e.dest)
				delete(e.dest.in, e.src)
			}
		}
	}
}
911104
func (n *Node) RemoveChild(c *Node) {
	if c.Parent != n {
		panic("html: RemoveChild called for a non-child Node")
	}
	if n.FirstChild == c {
		n.FirstChild = c.NextSibling
	}
	if c.NextSibling != nil {
		c.NextSibling.PrevSibling = c.PrevSibling
	}
	if n.LastChild == c {
		n.LastChild = c.PrevSibling
	}
	if c.PrevSibling != nil {
		c.PrevSibling.NextSibling = c.NextSibling
	}
	c.Parent = nil
	c.PrevSibling = nil
	c.NextSibling = nil
}
125481
func (e *Element) addChildren(childNodes []*gcdapi.DOMNode) {
	for _, child := range childNodes {
		if child != nil {
			e.addChild(child)
		}
	}
}
477358
func (r *Route) getChildren() []*Route {

	// allocate once
	allRoutes := make([]*Route, 0, len(r.children)+2)

	// start with the normal routes
	allRoutes = append(allRoutes, r.children...)

	// then add the param child
	if r.paramChild != nil {
		allRoutes = append(allRoutes, r.paramChild)
	}

	// then add the wildcard child
	if r.wildcardChild != nil {
		allRoutes = append(allRoutes, r.wildcardChild)
	}

	return allRoutes
}
1053265
func (p *Session) GetAllChildren() []*Session {
	result := []*Session{}
	result = append(result, p.Children...)
	for _, child := range p.Children {
		result = append(result, child.GetAllChildren()...)
	}
	return result
}
759201
func (t *treeNoder) Children() ([]noder.Noder, error) {
	if t.mode != filemode.Dir {
		return noder.NoChildren, nil
	}

	// children are memoized for efficiency
	if t.children != nil {
		return t.children, nil
	}

	// the parent of the returned children will be ourself as a tree if
	// we are a not the root treenoder.  The root is special as it
	// is is own parent.
	parent := t.parent
	if !t.isRoot() {
		var err error
		if parent, err = t.parent.Tree(t.name); err != nil {
			return nil, err
		}
	}

	return transformChildren(parent)
}
717380
func (s *BatchListObjectChildrenResponse) SetChildren(v map[string]*string) *BatchListObjectChildrenResponse {
	s.Children = v
	return s
}
565541
func (w *Watcher) RemoveRecursive(name string) (err error) {
	w.mu.Lock()
	defer w.mu.Unlock()

	name, err = filepath.Abs(name)
	if err != nil {
		return err
	}

	// Remove the name from w's names list.
	delete(w.names, name)

	// If name is a single file, remove it and return.
	info, found := w.files[name]
	if !found {
		return nil // Doesn't exist, just return.
	}
	if !info.IsDir() {
		delete(w.files, name)
		return nil
	}

	// If it's a directory, delete all of it's contents recursively
	// from w.files.
	for path := range w.files {
		if strings.HasPrefix(path, name) {
			delete(w.files, path)
		}
	}
	return nil
}
486317
func deleteNested(m map[interface{}]interface{}, keys ...string) {
	switch len(keys) {
	case 0:
		return
	case 1:
		delete(m, keys[0])
	default:
		if v, ok := m[keys[0]].(map[interface{}]interface{}); ok {
			deleteNested(v, keys[1:]...)
		}
	}
}
472549
func (tree *MutableTree) deleteVersionsFrom(version int64) error {
	if version <= 0 {
		return cmn.NewError("version must be greater than 0")
	}
	newLatestVersion := version - 1
	lastestVersion := tree.ndb.getLatestVersion()
	for ; version <= lastestVersion; version++ {
		if version == tree.version {
			return cmn.NewError("cannot delete latest saved version (%d)", version)
		}
		if _, ok := tree.versions[version]; !ok {
			return cmn.ErrorWrap(ErrVersionDoesNotExist, "")
		}
		tree.ndb.DeleteVersion(version, false)
		delete(tree.versions, version)
	}
	tree.ndb.Commit()
	tree.ndb.resetLatestVersion(newLatestVersion)
	return nil
}
938937
func (m *GormIterationRepository) LoadChildren(ctx context.Context, parentIterationID uuid.UUID) ([]Iteration, error) {
	defer goa.MeasureSince([]string{"goa", "db", "iteration", "loadchildren"}, time.Now())
	parentIteration, err := m.Load(ctx, parentIterationID)
	if err != nil {
		return nil, errors.NewNotFoundError("iteration", parentIterationID.String())
	}
	var objs []Iteration

	err = m.db.Where(fmt.Sprintf("path ~ '%s.*{1,}'", parentIteration.Path.Convert())).Order("updated_at").Find(&objs).Error
	if err != nil {
		return nil, err
	}
	return objs, nil
}
893297
func (fs *FSLocalKeyStore) DeleteKeys() error {
	dirPath := filepath.Join(fs.KeyDir, sessionKeyDir)

	err := os.RemoveAll(dirPath)
	if err != nil {
		return trace.Wrap(err)
	}

	return nil
}
636954
func CleanAllTextNode(o *js.Object) {
	for _, to := range ChildNodeList(o) {
		if istx, isem := EmptyTextNode(to); istx {
			if !isem {
				// log.Printf("Cleaning Text Node: %s", to.Get("textContent").String())
				o.Call("removeChild", to)
			}
		}
	}
}
50093
func (tc *TreeCache) CurrentChildren(fullPath string) (map[string]*ChildData, error) {
	node, err := tc.findNode(fullPath)
	if err != nil {
		return nil, err
	}
	if node.state.Load() != NodeStateLIVE {
		return nil, ErrNodeNotLive
	}

	children := node.Children()
	m := make(map[string]*ChildData, len(children))
	for child, childNode := range children {
		// Double-check liveness after retreiving data.
		childData := childNode.ChildData()
		if childData != nil && childNode.state.Load() == NodeStateLIVE {
			m[child] = childData
		}
	}

	// Double-check liveness after retreiving children.
	if node.state.Load() != NodeStateLIVE {
		return nil, ErrNodeNotLive
	}
	return m, nil
}
319285
func gatherChildren(n node, children *[]common.Hash) {
	switch n := n.(type) {
	case *rawShortNode:
		gatherChildren(n.Val, children)

	case rawFullNode:
		for i := 0; i < 16; i++ {
			gatherChildren(n[i], children)
		}
	case hashNode:
		*children = append(*children, common.BytesToHash(n))

	case valueNode, nil:

	default:
		panic(fmt.Sprintf("unknown node type: %T", n))
	}
}
150903
func (mtt *mttNode) gatherChildren(name string) []*mttNode {
	var children []*mttNode
	switch name {
	case "*":
		// name of child is unspecified, so gather all children
		for _, child := range mtt.children {
			children = append(children, child)
		}
	default:
		// gather a single child with specified name
		child := mtt.children[name]

		if child == nil {
			// child with this name not exist; it might be specific instance of dynamic metric
			// so, take child named with an asterisk
			child = mtt.children["*"]

		}
		if child != nil {
			children = append(children, child)
		}
	}
	return children
}