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/intvector.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/intvector.go')
| -rw-r--r-- | src/pkg/container/vector/intvector.go | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/pkg/container/vector/intvector.go b/src/pkg/container/vector/intvector.go index 9db252958..e17d619ad 100644 --- a/src/pkg/container/vector/intvector.go +++ b/src/pkg/container/vector/intvector.go @@ -21,27 +21,19 @@ func (p *IntVector) Init(len int) *IntVector { // NewIntVector returns an initialized new IntVector with length at least len. -func NewIntVector(len int) *IntVector { - return new(IntVector).Init(len); -} +func NewIntVector(len int) *IntVector { return new(IntVector).Init(len) } // At returns the i'th element of the vector. -func (p *IntVector) At(i int) int { - return p.Vector.At(i).(int); -} +func (p *IntVector) At(i int) int { return p.Vector.At(i).(int) } // Set sets the i'th element of the vector to value x. -func (p *IntVector) Set(i int, x int) { - p.a[i] = x; -} +func (p *IntVector) Set(i int, x int) { p.a[i] = x } // Last returns the element in the vector of highest index. -func (p *IntVector) Last() int { - return p.Vector.Last().(int); -} +func (p *IntVector) Last() int { return p.Vector.Last().(int) } // Data returns all the elements as a slice. @@ -56,9 +48,7 @@ func (p *IntVector) Data() []int { // Insert inserts into the vector an element of value x before // the current element at index i. -func (p *IntVector) Insert(i int, x int) { - p.Vector.Insert(i, x); -} +func (p *IntVector) Insert(i int, x int) { p.Vector.Insert(i, x) } // InsertVector inserts into the vector the contents of the Vector @@ -76,15 +66,11 @@ func (p *IntVector) Slice(i, j int) *IntVector { // Push appends x to the end of the vector. -func (p *IntVector) Push(x int) { - p.Vector.Push(x); -} +func (p *IntVector) Push(x int) { p.Vector.Push(x) } // Pop deletes and returns the last element of the vector. -func (p *IntVector) Pop() int { - return p.Vector.Pop().(int); -} +func (p *IntVector) Pop() int { return p.Vector.Pop().(int) } // AppendVector appends the entire IntVector x to the end of this vector. @@ -95,9 +81,7 @@ func (p *IntVector) AppendVector(x *IntVector) { // 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); -} +func (p *IntVector) Less(i, j int) bool { return p.At(i) < p.At(j) } // Iterate over all elements; driver for range |
