// BuildWithIDs constructs a double array from given keywords and ids.
425338
func BuildWithIDs(keywords []string, ids []int) (DoubleArray, error) {
	d := DoubleArray{}
	d.init()
	if len(keywords) != len(ids) {
		return d, fmt.Errorf("invalid arguments")
	}
	if len(keywords) == 0 {
		return d, nil
	}
	if !sort.StringsAreSorted(keywords) {
		h := make(map[string]int)
		for i, key := range keywords {
			h[key] = ids[i]
		}
		sort.Strings(keywords)
		ids = ids[:0]
		for _, key := range keywords {
			ids = append(ids, h[key])
		}
	}
	branches := make([]int, len(keywords))
	for i := range keywords {
		branches[i] = i
	}
	d.add(0, 0, branches, keywords, ids)
	d.truncate()
	return d, nil
}
1221106
func (o *DeleteTaskParams) WithID(id int64) *DeleteTaskParams {
	o.SetID(id)
	return o
}
515047
func (o *UpdateOAuth2ClientParams) WithID(id string) *UpdateOAuth2ClientParams {
	o.SetID(id)
	return o
}
859680
func WithID(id string) Opt {
	return func(l *Lease) error {
		l.ID = id
		return nil
	}
}
100152
func (o *ListTasksParams) WithTags(tags []string) *ListTasksParams {
	o.SetTags(tags)
	return o
}
1075065
func (d *DashboardsStore) AddIDs(ctx context.Context, boards []chronograf.Dashboard) error {
	for _, board := range boards {
		update := false
		for i, cell := range board.Cells {
			// If there are is no id set, we generate one and update the dashboard
			if cell.ID == "" {
				id, err := d.IDs.Generate()
				if err != nil {
					return err
				}
				cell.ID = id
				board.Cells[i] = cell
				update = true
			}
		}
		if !update {
			continue
		}
		if err := d.Update(ctx, board); err != nil {
			return err
		}
	}
	return nil
}
915074
func (o *GetEndpointIDParams) WithID(id string) *GetEndpointIDParams {
	o.SetID(id)
	return o
}
496146
func (s *SetStatusInput) SetObjectIds(v []*string) *SetStatusInput {
	s.ObjectIds = v
	return s
}
1001808
func (o *UpdateOneParams) WithID(id string) *UpdateOneParams {
	o.SetID(id)
	return o
}
922372
func GenerateIDWithAlg(customIDgenAlg string, payload []byte) (string, error) {
	if customIDgenAlg == "" {
		customIDgenAlg = defaultAlg
	}
	var alg = availableIDgenAlgs[customIDgenAlg]
	if alg.hashFun != nil {
		return alg.hashFun(payload), nil
	}
	return "", fmt.Errorf("Wrong ID generation algorithm was given: %s", customIDgenAlg)
}
101061
func (builder *Builder) With(a ...ANSI) *Builder {
	return NewBuilder(builder.ANSI.With(a...))
}
363302
func (ks KeyList) IDs() []string {
	keyIDs := make([]string, 0, len(ks))
	for _, k := range ks {
		keyIDs = append(keyIDs, k.ID())
	}
	return keyIDs
}
1085854
func BuildIndexTable(sortedKeywords []string) (IndexTable, error) {
	idx := IndexTable{Dup: map[int32]int32{}}
	if !sort.StringsAreSorted(sortedKeywords) {
		return idx, fmt.Errorf("unsorted keywords")
	}
	keys := make([]string, 0, len(sortedKeywords))
	ids := make([]int, 0, len(sortedKeywords))
	prev := struct {
		no   int
		word string
	}{}
	for i, key := range sortedKeywords {
		if key == prev.word {
			idx.Dup[int32(prev.no)]++
			continue
		}
		prev.no = i
		prev.word = key
		keys = append(keys, key)
		ids = append(ids, i)
	}
	d, err := da.BuildWithIDs(keys, ids)
	if err != nil {
		return idx, fmt.Errorf("build error, %v", err)
	}
	idx.Da = d
	return idx, nil
}
337246
func (builder *SearchCommandBuilder) WithNumRows(numRows uint32) *SearchCommandBuilder {
	builder.protobuf.Rows = &numRows
	return builder
}
746450
func (o *UploadTaskFileParams) WithID(id int64) *UploadTaskFileParams {
	o.SetID(id)
	return o
}
711291
func (offers Slice) IDs() []mesos.OfferID {
	ids := make([]mesos.OfferID, len(offers))
	for i := range offers {
		ids[i] = offers[i].ID
	}
	return ids
}
260647
func (o *GetIdentityIDParams) WithID(id string) *GetIdentityIDParams {
	o.SetID(id)
	return o
}