// SetMed replace, add or subtraction med with new ones.
164653
func (path *Path) SetMed(med int64, doReplace bool) error {
	parseMed := func(orgMed uint32, med int64, doReplace bool) (*bgp.PathAttributeMultiExitDisc, error) {
		if doReplace {
			return bgp.NewPathAttributeMultiExitDisc(uint32(med)), nil
		}

		medVal := int64(orgMed) + med
		if medVal < 0 {
			return nil, fmt.Errorf("med value invalid. it's underflow threshold: %v", medVal)
		} else if medVal > int64(math.MaxUint32) {
			return nil, fmt.Errorf("med value invalid. it's overflow threshold: %v", medVal)
		}

		return bgp.NewPathAttributeMultiExitDisc(uint32(int64(orgMed) + med)), nil
	}

	m := uint32(0)
	if attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC); attr != nil {
		m = attr.(*bgp.PathAttributeMultiExitDisc).Value
	}
	newMed, err := parseMed(m, med, doReplace)
	if err != nil {
		return err
	}
	path.setPathAttr(newMed)
	return nil
}
1322851
func (s *EndpointSendConfiguration) SetSubstitutions(v map[string][]*string) *EndpointSendConfiguration {
	s.Substitutions = v
	return s
}
598648
func (s *GCMMessage) SetSubstitutions(v map[string][]*string) *GCMMessage {
	s.Substitutions = v
	return s
}
692818
func (s *PipelineActivity) SetMath(v *MathActivity) *PipelineActivity {
	s.Math = v
	return s
}
841268
func (s *DescribeSubscriptionOutput) SetSubscription(v *Subscription) *DescribeSubscriptionOutput {
	s.Subscription = v
	return s
}
1066052
func setTweak(tweak, expandedTweak []uint64) {
    if tweak != nil {
        expandedTweak[0] = tweak[0]
        expandedTweak[1] = tweak[1]
        expandedTweak[2] = tweak[0] ^ tweak[1]
    }
}
1036491
func (s *ListSubscriptionsOutput) SetSubscriptions(v []*Subscription) *ListSubscriptionsOutput {
	s.Subscriptions = v
	return s
}
326238
func (s *CommonPrefix) SetPrefix(v string) *CommonPrefix {
	s.Prefix = &v
	return s
}
96613
func (e *TextEdit) SetText(text string) {
	e.text.Set([]rune(text))
}
565516
func (t Term) Replace(arg interface{}, optArgs ...ReplaceOpts) Term {
	opts := map[string]interface{}{}
	if len(optArgs) >= 1 {
		opts = optArgs[0].toMap()
	}
	return constructMethodTerm(t, "Replace", p.Term_REPLACE, []interface{}{funcWrap(arg)}, opts)
}
81906
func (md mdReadWriter) Set(key string, value string) {
	key = strings.ToLower(key)
	md[key] = []string{value}
}
555769
func (m NiceMD) Set(key string, value string) NiceMD {
	k, v := encodeKeyValue(key, value)
	m[k] = []string{v}
	return m
}
1241995
func (h Handler) Replace(cmd common.SetRequest) error {
	return h.handleSetCommon(cmd, common.RequestReplace)
}
128856
func (s *Expression) SetAnd(v []*Expression) *Expression {
	s.And = v
	return s
}
889336
func (s *TagResourceInput) SetTagsToAdd(v map[string]*string) *TagResourceInput {
	s.TagsToAdd = v
	return s
}
969460
func (s *Options) SetMtime(v string) *Options {
	s.Mtime = &v
	return s
}
1249946
func (s *DescribeConfigurationOutput) SetCreated(v time.Time) *DescribeConfigurationOutput {
	s.Created = &v
	return s
}