// setChild set p as topn's child.
556076
func (lt *LogicalTopN) setChild(p LogicalPlan) LogicalPlan {
	// Remove this TopN if its child is a TableDual.
	dual, isDual := p.(*LogicalTableDual)
	if isDual {
		numDualRows := uint64(dual.RowCount)
		if numDualRows < lt.Offset {
			dual.RowCount = 0
			return dual
		}
		dual.RowCount = int(mathutil.MinUint64(numDualRows-lt.Offset, lt.Count))
		return dual
	}

	if lt.isLimit() {
		limit := LogicalLimit{
			Count:  lt.Count,
			Offset: lt.Offset,
		}.Init(lt.ctx)
		limit.SetChildren(p)
		return limit
	}
	// Then lt must be topN.
	lt.SetChildren(p)
	return lt
}
1325189
func (s *BatchAttachObject) SetChildReference(v *ObjectReference) *BatchAttachObject {
	s.ChildReference = v
	return s
}
1345490
func (g *BuilderGroup) SetParent(v *BuilderGroup) {
	g.builder.ring.GroupToGroup[g.index] = v.index
}
1257750
func (n *node) addChild(c nodeContent) (*node, error) {
	if !n.isAllowed(c, false) {
		return nil, errors.New(ErrDuplicate, errorMessages)
	}
	child := &node{
		container: n.container,
		parent:    n,
		content:   c,
	}
	n.children = append(n.children, child)
	return child, nil
}
819257
func (t *Trace) SetParent(parent *Trace) {
	t.ParentID = parent.SpanID
	t.TraceID = parent.TraceID
	t.Resource = parent.Resource
}
289088
func RemoveChild(o *js.Object, co ...*js.Object) {
	for _, onode := range co {
		o.Get("parentNode").Call("removeChild", onode)
	}
}
526284
func (s *ListChildrenOutput) SetChildren(v []*Child) *ListChildrenOutput {
	s.Children = v
	return s
}
40846
func (nap *NapNap) SetRender(templateRootPath string) {
	sharedTemplatePath := path.Join(templateRootPath, "shares/*")
	tmpl, err := template.ParseGlob(sharedTemplatePath)
	template := template.Must(tmpl, err)
	if template == nil {
		_logger.debug("no template")
		template = template.New("")
	}
	nap.template = template
	nap.templateRootPath = templateRootPath
}
598614
func (c *keyValueChanger) SetKey(key string) (string, error) {
	if c.err != nil {
		return "", c.err
	}
	if !c.node.container.duplicates {
		if c.node.hasDuplicateSibling(key) {
			return "", errors.New(ErrDuplicate, errorMessages)
		}
	}
	current := c.node.content.key().(string)
	c.node.content = keyValue{key, c.node.content.value()}
	return current, nil
}
919184
func (s *StartChildWorkflowExecutionInitiatedEventAttributes) SetChildPolicy(v string) *StartChildWorkflowExecutionInitiatedEventAttributes {
	s.ChildPolicy = &v
	return s
}
899347
func (b *Builder) setNode(n *structs.Node) *Builder {
	b.nodeAttrs = make(map[string]string, 4+len(n.Attributes)+len(n.Meta))
	b.nodeAttrs[nodeIdKey] = n.ID
	b.nodeAttrs[nodeNameKey] = n.Name
	b.nodeAttrs[nodeClassKey] = n.NodeClass
	b.nodeAttrs[nodeDcKey] = n.Datacenter
	b.datacenter = n.Datacenter

	// Set up the attributes.
	for k, v := range n.Attributes {
		b.nodeAttrs[fmt.Sprintf("%s%s", nodeAttributePrefix, k)] = v
	}

	// Set up the meta.
	for k, v := range n.Meta {
		b.nodeAttrs[fmt.Sprintf("%s%s", nodeMetaPrefix, k)] = v
	}
	return b
}
1360478
func (writer *ConsoleWriter) SetLevel(level LevelType) {
	writer.lock.Lock()
	defer writer.lock.Unlock()

	writer.blog.SetLevel(level)
}
678933
func SetLevel(level Level) {
	globalLock.Lock()
	defer globalLock.Unlock()
	if globalLevel != level {
		globalLogger = globalLogger.AtLevel(level)
	}
	globalLevel = level
	globalLevelSet = true
}
545959
func (p *parser) addChild(n *Node) {
	if p.shouldFosterParent() {
		p.fosterParent(n)
	} else {
		p.top().AppendChild(n)
	}

	if n.Type == ElementNode {
		p.oe = append(p.oe, n)
	}
}
314874
func (n node) Child(name string) node {
	for _, c := range n.children {
		if c.name == name {
			return c
		}
	}
	return node{}
}
207220
func (s *WorkflowExecutionConfiguration) SetChildPolicy(v string) *WorkflowExecutionConfiguration {
	s.ChildPolicy = &v
	return s
}
358483
func (e *Element) addChild(child *gcdapi.DOMNode) {
	e.lock.Lock()
	defer e.lock.Unlock()

	if e.node == nil {
		return
	}

	if e.node.Children == nil {
		e.node.Children = make([]*gcdapi.DOMNode, 0)
	}
	e.node.Children = append(e.node.Children, child)
	e.childNodeCount++
}