github.com/biogo/biogo@v1.0.4/align/pals/dp/sort.go (about) 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 dp 6 7 // Sort DPHits on start position. 8 type starts Hits 9 10 func (s starts) Len() int { 11 return len(s) 12 } 13 14 func (s starts) Less(i, j int) bool { 15 return s[i].Abpos < s[j].Abpos 16 } 17 18 func (s starts) Swap(i, j int) { 19 s[i], s[j] = s[j], s[i] 20 } 21 22 // Sort DPHits on end position. 23 type ends Hits 24 25 func (e ends) Len() int { 26 return len(e) 27 } 28 29 func (e ends) Less(i, j int) bool { 30 return e[i].Aepos < e[j].Aepos 31 } 32 33 func (e ends) Swap(i, j int) { 34 e[i], e[j] = e[j], e[i] 35 }