podman

Форк
0
24 строки · 729.0 Байт
1
package semver
2

3
// Collection is a collection of Version instances and implements the sort
4
// interface. See the sort package for more details.
5
// https://golang.org/pkg/sort/
6
type Collection []*Version
7

8
// Len returns the length of a collection. The number of Version instances
9
// on the slice.
10
func (c Collection) Len() int {
11
	return len(c)
12
}
13

14
// Less is needed for the sort interface to compare two Version objects on the
15
// slice. If checks if one is less than the other.
16
func (c Collection) Less(i, j int) bool {
17
	return c[i].LessThan(c[j])
18
}
19

20
// Swap is needed for the sort interface to replace the Version objects
21
// at two different positions in the slice.
22
func (c Collection) Swap(i, j int) {
23
	c[i], c[j] = c[j], c[i]
24
}
25

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.