示例#1
0
func (db *Database) AddAllPositions(s set.Set) {
	for i, v := range db.FullSequence {
		if v != ZeroToken {
			s.Add(i)
		}
	}
}
示例#2
0
func (db *Database) MatchesOccs(s set.Set) (matches []int, occs []int) {
	matches = make([]int, len(db.Total))
	occs = make([]int, len(db.Total))

	prevseq := -1
	for _, p := range s.Iter() {
		seq := db.PosToSequence[p]
		occs[seq.Section] += int(seq.Count)
		if seq.Index == prevseq {
			continue
		}
		matches[seq.Section] += int(seq.Count)
		prevseq = seq.Index
	}

	return
}