| 1 | // Copyright ©2011-2012 The bíogo Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package filter |
| 6 | |
| 7 | // Type to store individual q-gram query filter hits. |
| 8 | type Hit struct { |
| 9 | From int |
| 10 | To int |
| 11 | Diagonal int |
| 12 | } |
| 13 | |
| 14 | // This is a direct translation of the qsort compar function used by PALS. |
| 15 | // However it results in a different sort order (with respect to the non-key |
| 16 | // fields) for Hits because of differences in the underlying sort algorithms |
| 17 | // and their respective sort stability. |
| 18 | // This appears to have some impact on Hit merging. |
| 19 | func (h Hit) Less(y interface{}) bool { |
| 20 | return h.From < y.(Hit).From |
| 21 | } |