Example #1
0
func (n *Naive) SearchWithConverter(prefix []Action, converter func(actions []Action) []Action) []int {
	// FIXME: quite ineffective
	matched := make([]int, 0)
	for i := 0; i < n.info.NrCollectedTraces-1; i++ { // FIXME: need to - 1 because the latest trace isn't recorded yet
		history, err := n.GetStoredHistory(i)
		if err != nil {
			panic(log.Criticalf("failed to get history %i: %s", i, err))
		}
		if len(history.ActionSequence) < len(prefix) {
			continue
		}
		converted := converter(history.ActionSequence)
		if signalutil.AreActionsSliceEqual(prefix, converted) {
			matched = append(matched, i)
		}
	}
	return matched
}
Example #2
0
func (this *SingleTrace) Equals(o *SingleTrace) bool {
	return signalutil.AreActionsSliceEqual(this.ActionSequence, o.ActionSequence)
}