godoc: unexport InterfaceSlice and Comparer types

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11429043
This commit is contained in:
Andrew Gerrand 2013-07-17 17:31:24 +10:00
Родитель cd835f01af
Коммит 57f0a571b9
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -79,17 +79,13 @@ var (
// InterfaceSlice is a helper type for sorting interface
// slices according to some slice-specific sort criteria.
type Comparer func(x, y interface{}) bool
type comparer func(x, y interface{}) bool
type InterfaceSlice struct {
type interfaceSlice struct {
slice []interface{}
less Comparer
less comparer
}
func (p *InterfaceSlice) Len() int { return len(p.slice) }
func (p *InterfaceSlice) Less(i, j int) bool { return p.less(p.slice[i], p.slice[j]) }
func (p *InterfaceSlice) Swap(i, j int) { p.slice[i], p.slice[j] = p.slice[j], p.slice[i] }
// ----------------------------------------------------------------------------
// RunList
@ -101,13 +97,17 @@ func (p *InterfaceSlice) Swap(i, j int) { p.slice[i], p.slice[j] = p.slice[
// a list of y's with the same x.
type RunList []interface{}
func (h RunList) sort(less Comparer) {
sort.Sort(&InterfaceSlice{h, less})
func (h RunList) sort(less comparer) {
sort.Sort(&interfaceSlice{h, less})
}
func (p *interfaceSlice) Len() int { return len(p.slice) }
func (p *interfaceSlice) Less(i, j int) bool { return p.less(p.slice[i], p.slice[j]) }
func (p *interfaceSlice) Swap(i, j int) { p.slice[i], p.slice[j] = p.slice[j], p.slice[i] }
// Compress entries which are the same according to a sort criteria
// (specified by less) into "runs".
func (h RunList) reduce(less Comparer, newRun func(h RunList) interface{}) RunList {
func (h RunList) reduce(less comparer, newRun func(h RunList) interface{}) RunList {
if len(h) == 0 {
return nil
}