File: types.go

package info (click to toggle)
golang-github-xtgo-set 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 148 kB
  • sloc: makefile: 2
file content (18 lines) | stat: -rw-r--r-- 477 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2015 Kevin Gillette. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package set

import "sort"

type span struct{ i, j int }

type boundspan struct {
	data sort.Interface
	span
}

func (b boundspan) Len() int           { return b.j - b.i }
func (b boundspan) Less(i, j int) bool { return b.data.Less(b.i+i, b.i+j) }
func (b boundspan) Swap(i, j int)      { b.data.Swap(b.i+i, b.i+j) }