// Returns a list of votes compressed to more readable strings.
543230
func (voteSet *VoteSet) VoteStrings() []string {
	voteSet.mtx.Lock()
	defer voteSet.mtx.Unlock()
	return voteSet.voteStrings()
}
968337
func (shard *ringShard) Vote(up bool) bool {
	if up {
		changed := shard.IsDown()
		atomic.StoreInt32(&shard.down, 0)
		return changed
	}

	if shard.IsDown() {
		return false
	}

	atomic.AddInt32(&shard.down, 1)
	return shard.IsDown()
}
651553
func (i *IssueStats) GetClosedIssues() int {
	if i == nil || i.ClosedIssues == nil {
		return 0
	}
	return *i.ClosedIssues
}
493219
func (set CompressedSet) String() string {
	b := bytes.Buffer{}
	b.WriteByte('[')
	set.writeTo(&b)
	b.WriteByte(']')
	return b.String()
}
1247731
func (f Flags) Strings() []string {
	flags := make([]string, 0, 6) // Up to 6 flags
	if f.HasFlags(FlagAnswered) {
		flags = append(flags, "\\Answered")
	}
	if f.HasFlags(FlagSeen) {
		flags = append(flags, "\\Seen")
	}
	if f.HasFlags(FlagRecent) {
		flags = append(flags, "\\Recent")
	}
	if f.HasFlags(FlagDeleted) {
		flags = append(flags, "\\Deleted")
	}
	if f.HasFlags(FlagDraft) {
		flags = append(flags, "\\Draft")
	}
	if f.HasFlags(FlagFlagged) {
		flags = append(flags, "\\Flagged")
	}
	return flags
}
1059661
func stringsFromByteSlice(buf []byte) (result []string) {
	offset := 0
	for index, b := range buf {
		if b == 0 {
			result = append(result, string(buf[offset:index]))
			offset = index + 1
		}
	}
	return
}
1055364
func FilterUniqueLastBlockVotes(txs []*TrimmedTxInfo) (votes []*TrimmedTxInfo) {
	seenVotes := make(map[string]struct{})
	for _, tx := range txs {
		if tx.VoteInfo != nil && tx.VoteInfo.ForLastBlock {
			// Do not append duplicates.
			if _, seen := seenVotes[tx.TxID]; seen {
				continue
			}
			votes = append(votes, tx)
			seenVotes[tx.TxID] = struct{}{}
		}
	}
	return votes
}
1198004
func (resp *RequestVoteResponse) Decode(r io.Reader) (int, error) {
	data, err := ioutil.ReadAll(r)

	if err != nil {
		return 0, err
	}

	totalBytes := len(data)

	pb := &protobuf.RequestVoteResponse{}
	if err = proto.Unmarshal(data, pb); err != nil {
		return -1, err
	}

	resp.Term = pb.GetTerm()
	resp.VoteGranted = pb.GetVoteGranted()

	return totalBytes, nil
}
448148
func NewStrings(less func(x, y string) bool, cap int) *Strings {
	h := &Strings{}

	if less != nil {
		h.less = func(i, j int) bool {
			return less(h.list[i], h.list[j])
		}
	}
	if cap > 0 {
		h.list = make([]string, 0, cap)
	}
	return h
}
40862
func Strings(data []string) []string {
	sort.Strings(data)
	n := Uniq(sort.StringSlice(data))
	return data[:n]
}
802937
func digests(summaries []archiver.IsolatedSummary) []string {
	var result []string
	for _, summary := range summaries {
		result = append(result, string(summary.Digest))
	}
	return result
}
742894
func DiffStringSlices(slice1 []string, slice2 []string) []string {
	diffStr := []string{}
	m := map[string]int{}

	for _, s1Val := range slice1 {
		m[s1Val] = 1
	}
	for _, s2Val := range slice2 {
		m[s2Val] = m[s2Val] + 1
	}

	for mKey, mVal := range m {
		if mVal == 1 {
			diffStr = append(diffStr, mKey)
		}
	}

	return diffStr
}
1293981
func ToStringKeys(keys KeyList, filter func(string) bool) StringKeys {
	if keys == nil {
		return nil
	}
	if strKeys, ok := keys.(StringKeys); ok {
		return strKeys
	}
	strs := make([]string, 0, keys.Len())
	for i := 0; i < keys.Len(); i++ {
		value := typeconv.ToString(keys.Key(i))
		if filter == nil || filter(value) {
			strs = append(strs, value)
		}
	}
	return StringKeys(strs)
}
148045
func getQueries(raw []string) []string {
	var res []string

	for _, q := range raw {
		for _, qs := range strings.Split(q, ";") {
			if nq := strings.TrimSpace(qs); len(nq) > 0 {
				res = append(res, nq+";")
			}
		}
	}

	return res
}
811169
func PostVotes() echo.HandlerFunc {

	// swagger:route GET /me/posts/{pid}/votes me post votes GetMePostVotes
	//
	// List the votes of the post
	//
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_messages:read
	//
	//	Responses:
	//		default: MePostsPidVotes

	return func(c echo.Context) error {
		return user.PostVotes()(c)
	}
}
913642
func (c *Client) GetCodeListEditions(codeListID string) (editions EditionsListResults, err error) {
	url := fmt.Sprintf("%s/code-lists/%s/editions", c.url, codeListID)
	resp, err := c.cli.Get(context.Background(), url)
	if err != nil {
		return
	}
	defer resp.Body.Close()

	b, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return
	}

	err = json.Unmarshal(b, &editions)
	if err != nil {
		return
	}
	return editions, nil
}
467606
func commonPrefixes(vs []string, minLength int) (result map[string]commonSs) {
	result = make(map[string]commonSs)
	for i := 0; i < len(vs)-1; i++ {
		j := i + 1
		k := 0
		for ; k < len(vs[i]) && k < len(vs[j]); k++ {
			if vs[i][k] != vs[j][k] {
				break
			}
		}
		if k < minLength {
			continue
		}
		prefix := vs[i][:k]
		if _, exists := result[prefix]; !exists {
			first := prefixStart(vs[:i], prefix)
			//debugf("prefixStart(%#q, %#q) == %v", vs[:i], prefix, first)
			// prefixEnd(vs, prefix) - first + 1
			// == prefixEnd(vs[first:], prefix) + 1
			// == prefixEnd(vs[first+1:], prefix) + 2
			end := first + 1 + prefixEnd(vs[first+1:], prefix)
			result[prefix] = commonSs{
				first, end,
			}
			//debugf("prefixEnd(%#q, %#q) == %v", vs, prefix, result[prefix].end)
		}
	}
	// debugf("# %v..", result)
	return result
}