sortutil

package
v0.0.0-...-bf5c1f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2016 License: BSD-3-Clause Imports: 4 Imported by: 7

Documentation

Overview

Package sortutil sorts and searches common slice types (and helps sort floats).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(a [][]byte)

Bytes sorts a slice of byte slices in increasing order.

func BytesAreSorted

func BytesAreSorted(a [][]byte) bool

BytesAreSorted tests whether a slice of byte slices is sorted in increasing order.

func Float32Key

func Float32Key(f float32) uint64

Float32Key generates a uint64 key from a float32. Use with Float32Less.

func Float32Less

func Float32Less(f, g float32) bool

Float32Less compares float32s, treating NaN as greater than all numbers.

func Float32s

func Float32s(a []float32)

Float32s sorts a slice of uint64s in increasing order, NaNs last.

func Float32sAreSorted

func Float32sAreSorted(a []float32) bool

Float32sAreSorted tests whether a slice of float32s is sorted in increasing order, NaNs last.

func Float64Key

func Float64Key(f float64) uint64

Float64Key generates a uint64 key from a float64. Use with Float64Less.

func Float64Less

func Float64Less(f, g float64) bool

Float64Less compares float64s, treating NaN as greater than all numbers.

func Float64s

func Float64s(a []float64)

Float64s sorts a slice of uint64s in increasing order, NaNs last.

func Float64sAreSorted

func Float64sAreSorted(a []float64) bool

Float64sAreSorted tests whether a slice of float64s is sorted in increasing order, NaNs last.

func Int32s

func Int32s(a []int32)

Int32s sorts a slice of int32s in increasing order.

func Int32sAreSorted

func Int32sAreSorted(a []int32) bool

Int32sAreSorted tests whether a slice of int32s is sorted in increasing order.

func Int64s

func Int64s(a []int64)

Int64s sorts a slice of int64s in increasing order.

func Int64sAreSorted

func Int64sAreSorted(a []int64) bool

Int64sAreSorted tests whether a slice of int64s is sorted in increasing order.

func Ints

func Ints(a []int)

Ints sorts a slice of ints in increasing order.

func IntsAreSorted

func IntsAreSorted(a []int) bool

IntsAreSorted tests whether a slice of ints is sorted in increasing order.

func SearchBytes

func SearchBytes(a [][]byte, x []byte) int

SearchBytes searches []bytes; read about sort.Search for more.

func SearchFloat32s

func SearchFloat32s(a []float32, x float32) int

SearchFloat32s searches float32s; read about sort.Search for more.

func SearchFloat64s

func SearchFloat64s(a []float64, x float64) int

SearchFloat64s searches float64s; read about sort.Search for more.

func SearchInt32s

func SearchInt32s(a []int32, x int32) int

SearchInt32s searches int32s; read about sort.Search for more.

func SearchInt64s

func SearchInt64s(a []int64, x int64) int

SearchInt64s searches int64s; read about sort.Search for more.

func SearchInts

func SearchInts(a []int, x int) int

SearchInts searches ints; read about sort.Search for more.

func SearchStrings

func SearchStrings(a []string, x string) int

SearchStrings searches strings; read about sort.Search for more.

func SearchUint32s

func SearchUint32s(a []uint32, x uint32) int

SearchUint32s searches uint32s; read about sort.Search for more.

func SearchUint64s

func SearchUint64s(a []uint64, x uint64) int

SearchUint64s searches uint64s; read about sort.Search for more.

func SearchUints

func SearchUints(a []uint, x uint) int

SearchUints searches uints; read about sort.Search for more.

func Strings

func Strings(a []string)

Strings sorts a slice of strings in increasing order.

func StringsAreSorted

func StringsAreSorted(a []string) bool

StringsAreSorted tests whether a slice of strings is sorted in increasing order.

func Uint32s

func Uint32s(a []uint32)

Uint32s sorts a slice of uint64s in increasing order.

func Uint32sAreSorted

func Uint32sAreSorted(a []uint32) bool

Uint32sAreSorted tests whether a slice of uint32s is sorted in increasing order.

func Uint64s

func Uint64s(a []uint64)

Uint64s sorts a slice of uint64s in increasing order.

func Uint64sAreSorted

func Uint64sAreSorted(a []uint64) bool

Uint64sAreSorted tests whether a slice of uint64s is sorted in increasing order.

func Uints

func Uints(a []uint)

Uints sorts a slice of ints in increasing order.

func UintsAreSorted

func UintsAreSorted(a []uint) bool

UintsAreSorted tests whether a slice of ints is sorted in increasing order.

Types

type BytesSlice

type BytesSlice [][]byte

BytesSlice attaches the methods of BytesInterface to [][]byte, sorting in increasing order.

func (BytesSlice) Key

func (p BytesSlice) Key(i int) []byte

Key returns a []byte item in a collection.

func (BytesSlice) Len

func (p BytesSlice) Len() int

func (BytesSlice) Less

func (p BytesSlice) Less(i, j int) bool

func (BytesSlice) Search

func (p BytesSlice) Search(x []byte) int

Search returns the result of applying SearchBytes to the receiver and x.

func (BytesSlice) Sort

func (p BytesSlice) Sort()

Sort is a convenience method.

func (BytesSlice) Swap

func (p BytesSlice) Swap(i, j int)

type Float32Slice

type Float32Slice []float32

Float32Slice attaches the methods of Uint64Interface to []uint32, sorting in increasing order, NaNs last.

func (Float32Slice) Key

func (p Float32Slice) Key(i int) uint64

Key produces a radix sort key for a floating-point value.

func (Float32Slice) Len

func (p Float32Slice) Len() int

func (Float32Slice) Less

func (p Float32Slice) Less(i, j int) bool

func (Float32Slice) Search

func (p Float32Slice) Search(x float32) int

Search returns the result of applying SearchFloat32s to the receiver and x.

func (Float32Slice) Sort

func (p Float32Slice) Sort()

Sort is a convenience method.

func (Float32Slice) Swap

func (p Float32Slice) Swap(i, j int)

type Float64Slice

type Float64Slice []float64

Float64Slice attaches the methods of Uint64Interface to []float64, sorting in increasing order, NaNs last.

func (Float64Slice) Key

func (p Float64Slice) Key(i int) uint64

Key produces a radix sort key for a floating-point value.

func (Float64Slice) Len

func (p Float64Slice) Len() int

func (Float64Slice) Less

func (p Float64Slice) Less(i, j int) bool

func (Float64Slice) Search

func (p Float64Slice) Search(x float64) int

Search returns the result of applying SearchFloat64s to the receiver and x.

func (Float64Slice) Sort

func (p Float64Slice) Sort()

Sort is a convenience method.

func (Float64Slice) Swap

func (p Float64Slice) Swap(i, j int)

type Int32Slice

type Int32Slice []int32

Int32Slice attaches the methods of Uint64Interface to []int32, sorting in increasing order.

func (Int32Slice) Key

func (p Int32Slice) Key(i int) int64

Key produces a radix sort key for an integer item.

func (Int32Slice) Len

func (p Int32Slice) Len() int

func (Int32Slice) Less

func (p Int32Slice) Less(i, j int) bool

func (Int32Slice) Search

func (p Int32Slice) Search(x int32) int

Search returns the result of applying SearchInt32s to the receiver and x.

func (Int32Slice) Sort

func (p Int32Slice) Sort()

Sort is a convenience method.

func (Int32Slice) Swap

func (p Int32Slice) Swap(i, j int)

type Int64Slice

type Int64Slice []int64

Int64Slice attaches the methods of Uint64Interface to []int64, sorting in increasing order.

func (Int64Slice) Key

func (p Int64Slice) Key(i int) int64

Key produces a radix sort key for an integer item.

func (Int64Slice) Len

func (p Int64Slice) Len() int

func (Int64Slice) Less

func (p Int64Slice) Less(i, j int) bool

func (Int64Slice) Search

func (p Int64Slice) Search(x int64) int

Search returns the result of applying SearchInt64s to the receiver and x.

func (Int64Slice) Sort

func (p Int64Slice) Sort()

Sort is a convenience method.

func (Int64Slice) Swap

func (p Int64Slice) Swap(i, j int)

type IntSlice

type IntSlice []int

IntSlice attaches the methods of Int64Interface to []int, sorting in increasing order.

func (IntSlice) Key

func (p IntSlice) Key(i int) int64

Key produces a radix sort key for an integer item.

func (IntSlice) Len

func (p IntSlice) Len() int

func (IntSlice) Less

func (p IntSlice) Less(i, j int) bool

func (IntSlice) Search

func (p IntSlice) Search(x int) int

Search returns the result of applying SearchInts to the receiver and x.

func (IntSlice) Sort

func (p IntSlice) Sort()

Sort is a convenience method.

func (IntSlice) Swap

func (p IntSlice) Swap(i, j int)

type StringSlice

type StringSlice []string

StringSlice attaches the methods of StringInterface to []string, sorting in increasing order.

func (StringSlice) Key

func (p StringSlice) Key(i int) string

Key returns a string item in a collection.

func (StringSlice) Len

func (p StringSlice) Len() int

func (StringSlice) Less

func (p StringSlice) Less(i, j int) bool

func (StringSlice) Search

func (p StringSlice) Search(x string) int

Search returns the result of applying SearchStrings to the receiver and x.

func (StringSlice) Sort

func (p StringSlice) Sort()

Sort is a convenience method.

func (StringSlice) Swap

func (p StringSlice) Swap(i, j int)

type Uint32Slice

type Uint32Slice []uint32

Uint32Slice attaches the methods of Uint64Interface to []int32, sorting in increasing order.

func (Uint32Slice) Key

func (p Uint32Slice) Key(i int) uint64

Key produces a radix sort key for an unsigned integer item.

func (Uint32Slice) Len

func (p Uint32Slice) Len() int

func (Uint32Slice) Less

func (p Uint32Slice) Less(i, j int) bool

func (Uint32Slice) Search

func (p Uint32Slice) Search(x uint32) int

Search returns the result of applying SearchUint32s to the receiver and x.

func (Uint32Slice) Sort

func (p Uint32Slice) Sort()

Sort is a convenience method.

func (Uint32Slice) Swap

func (p Uint32Slice) Swap(i, j int)

type Uint64Slice

type Uint64Slice []uint64

Uint64Slice attaches the methods of Uint64Interface to []uint64, sorting in increasing order.

func (Uint64Slice) Key

func (p Uint64Slice) Key(i int) uint64

Key produces a radix sort key for an unsigned integer item.

func (Uint64Slice) Len

func (p Uint64Slice) Len() int

func (Uint64Slice) Less

func (p Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Search

func (p Uint64Slice) Search(x uint64) int

Search returns the result of applying SearchUint64s to the receiver and x.

func (Uint64Slice) Sort

func (p Uint64Slice) Sort()

Sort is a convenience method.

func (Uint64Slice) Swap

func (p Uint64Slice) Swap(i, j int)

type UintSlice

type UintSlice []uint

UintSlice attaches the methods of Uint64Interface to []uint, sorting in increasing order.

func (UintSlice) Key

func (p UintSlice) Key(i int) uint64

Key produces a radix sort key for an unsigned integer item.

func (UintSlice) Len

func (p UintSlice) Len() int

func (UintSlice) Less

func (p UintSlice) Less(i, j int) bool

func (UintSlice) Search

func (p UintSlice) Search(x uint) int

Search returns the result of applying SearchUints to the receiver and x.

func (UintSlice) Sort

func (p UintSlice) Sort()

Sort is a convenience method.

func (UintSlice) Swap

func (p UintSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL