diff options
| author | Rob Pike <r@golang.org> | 2009-10-13 13:05:16 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2009-10-13 13:05:16 -0700 |
| commit | 8acb8fb7809ccbd1d0fba4c4d6661282f4645cef (patch) | |
| tree | d9221abc51e7c2e7fcc6487c2db429caca61d019 /src/pkg/container | |
| parent | fd4767f2c5328a14b50874ad3a25518c673ccd12 (diff) | |
| download | go-8acb8fb7809ccbd1d0fba4c4d6661282f4645cef.tar.xz | |
reduce stutter: sort.SortInterface -> sort.Interface.
ditto for heap.HeapInterface
R=gri,rsc
DELTA=31 (0 added, 1 deleted, 30 changed)
OCL=35665
CL=35673
Diffstat (limited to 'src/pkg/container')
| -rw-r--r-- | src/pkg/container/heap/heap.go | 20 | ||||
| -rw-r--r-- | src/pkg/container/vector/intvector.go | 2 | ||||
| -rw-r--r-- | src/pkg/container/vector/stringvector.go | 2 | ||||
| -rw-r--r-- | src/pkg/container/vector/vector.go | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/pkg/container/heap/heap.go b/src/pkg/container/heap/heap.go index 6b10872e1f..f78e3b3a5d 100644 --- a/src/pkg/container/heap/heap.go +++ b/src/pkg/container/heap/heap.go @@ -3,20 +3,20 @@ // license that can be found in the LICENSE file. // This package provides heap operations for any type that implements -// HeapInterface. +// heap.Interface. // package heap import "sort" -// Any type that implements HeapInterface may be used as a +// Any type that implements heap.Interface may be used as a // heap with the following invariants (established after Init // has been called): // // h.Less(i, j) for 0 <= i < h.Len() and j = 2*i+1 or 2*i+2 and j < h.Len() // -type HeapInterface interface { - sort.SortInterface; +type Interface interface { + sort.Interface; Push(x interface{}); Pop() interface{}; } @@ -27,7 +27,7 @@ type HeapInterface interface { // and may be called whenever the heap invariants may have been invalidated. // Its complexity is O(n*log(n)) where n = h.Len(). // -func Init(h HeapInterface) { +func Init(h Interface) { sort.Sort(h); } @@ -35,7 +35,7 @@ func Init(h HeapInterface) { // Push pushes the element x onto the heap. The complexity is // O(log(n)) where n = h.Len(). // -func Push(h HeapInterface, x interface{}) { +func Push(h Interface, x interface{}) { h.Push(x); up(h, h.Len() - 1); } @@ -44,7 +44,7 @@ func Push(h HeapInterface, x interface{}) { // Pop removes the minimum element (according to Less) from the heap // and returns it. The complexity is O(log(n)) where n = h.Len(). // -func Pop(h HeapInterface) interface{} { +func Pop(h Interface) interface{} { n := h.Len() - 1; h.Swap(0, n); down(h, 0, n); @@ -55,7 +55,7 @@ func Pop(h HeapInterface) interface{} { // Remove removes the element at index i from the heap. // The complexity is O(log(n)) where n = h.Len(). // -func Remove(h HeapInterface, i int) interface{} { +func Remove(h Interface, i int) interface{} { n := h.Len() - 1; if n != i { h.Swap(n, i); @@ -66,7 +66,7 @@ func Remove(h HeapInterface, i int) interface{} { } -func up(h HeapInterface, j int) { +func up(h Interface, j int) { for { i := (j-1)/2; if i == j || h.Less(i, j) { @@ -78,7 +78,7 @@ func up(h HeapInterface, j int) { } -func down(h HeapInterface, i, n int) { +func down(h Interface, i, n int) { for { j := 2*i + 1; if j >= n { diff --git a/src/pkg/container/vector/intvector.go b/src/pkg/container/vector/intvector.go index 0ae25b9822..9db2529580 100644 --- a/src/pkg/container/vector/intvector.go +++ b/src/pkg/container/vector/intvector.go @@ -93,7 +93,7 @@ func (p *IntVector) AppendVector(x *IntVector) { } -// SortInterface support +// sort.Interface support // Less returns a boolean denoting whether the i'th element is less than the j'th element. func (p *IntVector) Less(i, j int) bool { return p.At(i) < p.At(j); diff --git a/src/pkg/container/vector/stringvector.go b/src/pkg/container/vector/stringvector.go index 4949d06b75..4e54ea85c4 100644 --- a/src/pkg/container/vector/stringvector.go +++ b/src/pkg/container/vector/stringvector.go @@ -92,7 +92,7 @@ func (p *StringVector) AppendVector(x *StringVector) { } -// SortInterface support +// sort.Interface support // Less returns a boolean denoting whether the i'th element is less than the j'th element. func (p *StringVector) Less(i, j int) bool { return p.At(i) < p.At(j); diff --git a/src/pkg/container/vector/vector.go b/src/pkg/container/vector/vector.go index fc7cf64ae9..3746b422a7 100644 --- a/src/pkg/container/vector/vector.go +++ b/src/pkg/container/vector/vector.go @@ -207,9 +207,9 @@ func (p *Vector) AppendVector(x *Vector) { } -// Partial SortInterface support +// Partial sort.Interface support -// LessInterface provides partial support of the SortInterface. +// LessInterface provides partial support of the sort.Interface. type LessInterface interface { Less(y Element) bool; } |
