// Collapse adds field collapsing.
551888
func (r *SearchRequest) Collapse(collapse *CollapseBuilder) *SearchRequest {
	r.searchSource = r.searchSource.Collapse(collapse)
	return r
}
285091
func (x *Index) Close() error {
	if cl, ok := x.s.(io.Closer); ok {
		return cl.Close()
	}
	return nil
}
1008955
func (s *APNSMessage) SetCollapseId(v string) *APNSMessage {
	s.CollapseId = &v
	return s
}
1111380
func (n *Node) Close() error {
	n.mu.Lock()
	defer n.mu.Unlock()
	// shutdown the raft, but do not handle the future error. :PPA:
	if n.raft != nil {
		n.raft.Shutdown().Error()
	}
	if n.trans != nil {
		n.trans.Close()
	}
	// close the raft database
	if n.store != nil {
		n.store.Close()
	}
	n.closed = true
	return nil
}
342815
func (l *Linearizer) Close() error {
	l.cancel()
	if c, ok := l.r.(io.Closer); ok {
		return c.Close()
	}
	return nil
}
795183
func (e *SelectionExec) Close() error {
	e.childResult = nil
	e.selected = nil
	return e.baseExecutor.Close()
}
390883
func (this *ExpressionTree) collapse() {
	ncs := make([]*ExpressionTree, 0)
	for _, c := range this.Children {
		c.collapse()
		if c.Name == "" && c.Value == -1 {
			for _, gc := range c.Children {
				ncs = append(ncs, gc)
			}
		} else {
			ncs = append(ncs, c)
		}
	}
	this.Children = ncs
}
1256070
func (s Style) Decompose() (fg Color, bg Color, attr AttrMask) {
	if s&styleFgSet != 0 {
		fg = Color(s>>32) & 0x1ffffff
	} else {
		fg = ColorDefault
	}
	if s&styleBgSet != 0 {
		bg = Color(s & 0x1ffffff)
	} else {
		bg = ColorDefault
	}
	attr = AttrMask(s) & attrAll

	return fg, bg, attr
}
1093762
func (l *Layer) Simplify(s orb.Simplifier) {
	count := 0
	for _, f := range l.Features {
		g := s.Simplify(f.Geometry)
		if g == nil {
			continue
		}

		f.Geometry = g
		l.Features[count] = f
		count++
	}

	l.Features = l.Features[:count]
}
706445
func (vs *VSphere) collapseZonesInRegion(ctx context.Context, zones []cloudprovider.Zone) ([]cloudprovider.Zone, error) {
	// first create a map of region -> list of zones in that region
	regionToZones := make(map[string][]string)
	for _, zone := range zones {
		fds, exists := regionToZones[zone.Region]
		if !exists {
			fds = make([]string, 0)
		}
		regionToZones[zone.Region] = append(fds, zone.FailureDomain)
	}

	// Join all fds in same region and return Zone instances
	collapsedZones := make([]cloudprovider.Zone, 0)
	for region, fds := range regionToZones {
		fdSet := sets.NewString(fds...)
		appendedZone := volumehelpers.ZonesSetToLabelValue(fdSet)
		collapsedZones = append(collapsedZones, cloudprovider.Zone{FailureDomain: appendedZone, Region: region})
	}
	return collapsedZones, nil
}
388966
func (c *closeHelper) Close(cl io.Closer) {
	if err := cl.Close(); c.err == nil {
		c.err = err
	}
}
653667
func (ch *Ch) Close() {
	close(ch.Err)
	close(ch.Size)
	close(ch.Done)
}
1340606
func (s *RadialSimplifier) Simplify(g orb.Geometry) orb.Geometry {
	return simplify(s, g)
}
855168
func CollapseHostPorts(serversHostPorts [][]HostPort) []HostPort {
	var collapsed []HostPort
	for _, hps := range serversHostPorts {
		collapsed = append(collapsed, hps...)
	}
	return collapsed
}
53815
func trimEmptyField(u *unstructured.Unstructured, fields ...string) {
	val, found, err := unstructured.NestedFieldNoCopy(u.Object, fields...)
	if err != nil || !found {
		return
	}
	remove := false
	switch typedVal := val.(type) {
	case map[string]interface{}:
		if len(typedVal) == 0 { // typed nil/empty map
			remove = true
		}
	case []interface{}:
		if len(typedVal) == 0 { // typed nil/empty slice
			remove = true
		}
	case nil: // untyped nil
		remove = true
	}
	if remove {
		unstructured.RemoveNestedField(u.Object, fields...)
	}
}
956100
func (f *gzipReader) Close() error {
	var errors []error
	if f.ReadCloser != nil {
		errors = append(errors, f.ReadCloser.Close())
		f.ReadCloser = nil
	}
	if f.file != nil {
		errors = append(errors, f.file.Close())
		f.file = nil
	}
	return trace.NewAggregate(errors...)
}
994166
func collapseAggregateErrors(errors []error) error {
	if len(errors) == 0 {
		return nil
	}
	if len(errors) == 1 {
		return errors[0]
	}

	allNoMatchErrors := true
	for _, err := range errors {
		allNoMatchErrors = allNoMatchErrors && IsNoMatchError(err)
	}
	if allNoMatchErrors {
		return errors[0]
	}

	return utilerrors.NewAggregate(errors)
}