// compareSegmentType ranks the segments by their type specificity
5681
func compareSegmentType(a, b segment) int {
	segs := []segment{a, b}
	ranks := make([]int, 2)
	for i, seg := range segs {
		switch seg.(type) {
		case literal:
			ranks[i] = 3
		case glob:
			ranks[i] = 2
		case alternation:
			ranks[i] = 1
		case fullglob:
			ranks[i] = 0
		default:
			panic("Bad type for segment!")
		}
	}

	switch {
	case ranks[0] < ranks[1]:
		return -1
	case ranks[0] > ranks[1]:
		return 1
	default:
		return 0
	}
}
1368359
func sliceElementType(slices ...[]interface{}) (reflect.Type, error) {
	var prevType reflect.Type
	for _, s := range slices {
		// Go through elements of all given slices and make sure they are all the same type.
		for _, v := range s {
			currentType := reflect.TypeOf(v)
			if prevType == nil {
				prevType = currentType
				// We don't support lists of lists yet.
				if prevType.Kind() == reflect.Slice {
					return nil, mergepatch.ErrNoListOfLists
				}
			} else {
				if prevType != currentType {
					return nil, fmt.Errorf("list element types are not identical: %v", fmt.Sprint(slices))
				}
				prevType = currentType
			}
		}
	}

	if prevType == nil {
		return nil, fmt.Errorf("no elements in any of the given slices")
	}

	return prevType, nil
}
989053
func (v *Version) Segments64() []int64 {
	result := make([]int64, len(v.segments))
	copy(result, v.segments)
	return result
}
646599
func (x duration) CompareSameType(op syntax.Token, y starlark.Value, depth int) (bool, error) {
	return x.Int.CompareSameType(op, y.(duration).Int, depth)
}
14128
func (s *CmafPackageCreateOrUpdateParameters) SetSegmentPrefix(v string) *CmafPackageCreateOrUpdateParameters {
	s.SegmentPrefix = &v
	return s
}
810827
func compareType(d1 dosa.FieldValue, d2 dosa.FieldValue) int8 {
	switch d1 := d1.(type) {
	case dosa.UUID:
		u1 := uuid.FromStringOrNil(string(d1))
		u2 := uuid.FromStringOrNil(string(d2.(dosa.UUID)))
		if u1.Version() != u2.Version() {
			if u1.Version() < u2.Version() {
				return -1
			}
			return 1
		}
		if u1.Version() == 1 {
			// compare time UUIDs
			t1, _ := uuid.TimestampFromV1(u1)
			t2, _ := uuid.TimestampFromV1(u2)
			if t1 == t2 {
				return 0
			}
			if t1 < t2 {
				return -1
			}
			return 1
		}

		// version
		if string(d1) == string(d2.(dosa.UUID)) {
			return 0
		}
		if string(d1) < string(d2.(dosa.UUID)) {
			return -1
		}
		return 1
	case string:
		if d1 == d2.(string) {
			return 0
		}
		if d1 < d2.(string) {
			return -1
		}
		return 1
	case int64:
		if d1 == d2.(int64) {
			return 0
		}
		if d1 < d2.(int64) {
			return -1
		}
		return 1
	case int32:
		if d1 == d2.(int32) {
			return 0
		}
		if d1 < d2.(int32) {
			return -1
		}
		return 1
	case float64:
		if d1 == d2.(float64) {
			return 0
		}
		if d1 < d2.(float64) {
			return -1
		}
		return 1
	case []byte:
		c := bytes.Compare(d1, d2.([]byte))
		if c == 0 {
			return 0
		}
		if c < 0 {
			return -1
		}
		return 1
	case time.Time:
		if d1.Equal(d2.(time.Time)) {
			return 0
		}
		if d1.Before(d2.(time.Time)) {
			return -1
		}
		return 1
	case bool:
		if d1 == d2.(bool) {
			return 0
		}
		if d1 == false {
			return -1
		}
		return 1
	}
	panic(d1)
}
1362936
func (s *Segment) SetSegmentNumber(v int64) *Segment {
	s.SegmentNumber = &v
	return s
}
518626
func NewSegmenter(r io.Reader) *Segmenter {
	return &Segmenter{
		r:            r,
		segment:      SegmentWords,
		maxTokenSize: MaxScanTokenSize,
		buf:          make([]byte, 4096), // Plausible starting size; needn't be large.
	}
}
607306
func (s *CampaignResponse) SetSegmentId(v string) *CampaignResponse {
	s.SegmentId = &v
	return s
}
615819
func (tmp *TieredMergePolicy) SetSegmentsPerTier(v float64) *TieredMergePolicy {
	assert2(v >= 2, fmt.Sprintf("segmentsPerTier must be >= 2 (got %v)", v))
	tmp.segsPerTier = v
	return tmp
}
770364
func (f *Footer) segmentLocs() (SegmentLocs, *segmentStack) {
	f.m.Lock()

	f.refs++

	slocs, ss := f.SegmentLocs, f.ss

	f.m.Unlock()

	return slocs, ss
}
1296121
func (s *CreateSegmentOutput) SetSegmentResponse(v *SegmentResponse) *CreateSegmentOutput {
	s.SegmentResponse = v
	return s
}
1244454
func NewSegmenterDirect(buf []byte) *Segmenter {
	return &Segmenter{
		segment:      SegmentWords,
		maxTokenSize: MaxScanTokenSize,
		buf:          buf,
		start:        0,
		end:          len(buf),
		err:          io.EOF,
	}
}
791145
func (l *Client) GetSegmentSizes(segments []string) ([]SegmentSize, error) {
	params := url.Values{}
	res := ApiResp{}
	data := []SegmentSize{}

	// if we have specific segments to filter by add those to the params as comma separated string
	if len(segments) > 0 {
		params.Add("ids", strings.Join(segments, ","))
	}

	// make the request
	err := l.Get(segmentSizesEndpoint, params, nil, &res, &data)
	if err != nil {
		return data, err
	}

	return data, nil
}
806343
func (s *ImportJobRequest) SetSegmentId(v string) *ImportJobRequest {
	s.SegmentId = &v
	return s
}
1325486
func (s *Scte35SegmentationDescriptor) SetSegmentNum(v int64) *Scte35SegmentationDescriptor {
	s.SegmentNum = &v
	return s
}
91106
func (s *WriteCampaignRequest) SetSegmentId(v string) *WriteCampaignRequest {
	s.SegmentId = &v
	return s
}