File: sort.go

package info (click to toggle)
golang-github-olebedev-when 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 488 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 464 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package rules

type MatchByIndex []*Match

func (m MatchByIndex) Len() int {
	return len(m)
}

func (m MatchByIndex) Swap(i, j int) {
	m[i], m[j] = m[j], m[i]
}

func (m MatchByIndex) Less(i, j int) bool {
	return m[i].Left < m[j].Left
}

type MatchByOrder []*Match

func (m MatchByOrder) Len() int {
	return len(m)
}

func (m MatchByOrder) Swap(i, j int) {
	m[i], m[j] = m[j], m[i]
}

func (m MatchByOrder) Less(i, j int) bool {
	return m[i].Order < m[j].Order
}