diff options
| author | Robert Griesemer <gri@golang.org> | 2009-11-06 14:24:38 -0800 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2009-11-06 14:24:38 -0800 |
| commit | 828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch) | |
| tree | fd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/container/vector/vector.go | |
| parent | eb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff) | |
| download | golang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz | |
- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)
R=r, rsc
CC=go-dev
http://go/go-review/1026006
Diffstat (limited to 'src/pkg/container/vector/vector.go')
| -rw-r--r-- | src/pkg/container/vector/vector.go | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/pkg/container/vector/vector.go b/src/pkg/container/vector/vector.go index 3746b422a..ee19997fb 100644 --- a/src/pkg/container/vector/vector.go +++ b/src/pkg/container/vector/vector.go @@ -79,9 +79,7 @@ func (p *Vector) Init(initial_len int) *Vector { // New returns an initialized new Vector with length at least len. -func New(len int) *Vector { - return new(Vector).Init(len); -} +func New(len int) *Vector { return new(Vector).Init(len) } // Len returns the number of elements in the vector. @@ -95,21 +93,15 @@ func (p *Vector) Len() int { // At returns the i'th element of the vector. -func (p *Vector) At(i int) Element { - return p.a[i]; -} +func (p *Vector) At(i int) Element { return p.a[i] } // Set sets the i'th element of the vector to value x. -func (p *Vector) Set(i int, x Element) { - p.a[i] = x; -} +func (p *Vector) Set(i int, x Element) { p.a[i] = x } // Last returns the element in the vector of highest index. -func (p *Vector) Last() Element { - return p.a[len(p.a)-1]; -} +func (p *Vector) Last() Element { return p.a[len(p.a)-1] } // Data returns all the elements as a slice. @@ -186,9 +178,7 @@ func (p *Vector) Do(f func(elem Element)) { // Convenience wrappers // Push appends x to the end of the vector. -func (p *Vector) Push(x Element) { - p.Insert(len(p.a), x); -} +func (p *Vector) Push(x Element) { p.Insert(len(p.a), x) } // Pop deletes the last element of the vector. @@ -202,9 +192,7 @@ func (p *Vector) Pop() Element { // AppendVector appends the entire Vector x to the end of this vector. -func (p *Vector) AppendVector(x *Vector) { - p.InsertVector(len(p.a), x); -} +func (p *Vector) AppendVector(x *Vector) { p.InsertVector(len(p.a), x) } // Partial sort.Interface support @@ -216,9 +204,7 @@ type LessInterface interface { // Less returns a boolean denoting whether the i'th element is less than the j'th element. -func (p *Vector) Less(i, j int) bool { - return p.a[i].(LessInterface).Less(p.a[j]); -} +func (p *Vector) Less(i, j int) bool { return p.a[i].(LessInterface).Less(p.a[j]) } // Swap exchanges the elements at indexes i and j. |
