| 1 | package bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ |
| 2 | |
| 3 | import "mathscip-go gomod github.com/golang/go/src go1.13 math/" |
| 4 | |
| 5 | // List is a slice of Buffers, it's the backing for NewPartition |
| 6 | type Listscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List# []Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer# |
| 7 | |
| 8 | // Len is the sum of the Len()'s of the Buffers in the List. |
| 9 | func (l *Listscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#) Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#Len().() (n int64) { |
| 10 | for _, buffer := range *l { |
| 11 | if n > mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64.-buffer.Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Len.() { |
| 12 | return mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64. |
| 13 | } |
| 14 | n += buffer.Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Len.() |
| 15 | } |
| 16 | return n |
| 17 | } |
| 18 | |
| 19 | // Cap is the sum of the Cap()'s of the Buffers in the List. |
| 20 | func (l *Listscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#) Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#Cap().() (n int64) { |
| 21 | for _, buffer := range *l { |
| 22 | if n > mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64.-buffer.Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() { |
| 23 | return mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64. |
| 24 | } |
| 25 | n += buffer.Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() |
| 26 | } |
| 27 | return n |
| 28 | } |
| 29 | |
| 30 | // Reset calls Reset() on each of the Buffers in the list. |
| 31 | func (l *Listscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#) Resetscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#Reset().() { |
| 32 | for _, buffer := range *l { |
| 33 | buffer.Resetscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Reset.() |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // Push adds a Buffer to the end of the List |
| 38 | func (l *Listscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#) Pushscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#Push().(b Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#) { |
| 39 | *l = append(*l, b) |
| 40 | } |
| 41 | |
| 42 | // Pop removes and returns a Buffer from the front of the List |
| 43 | func (l *Listscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#) Popscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/List#Pop().() (b Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#) { |
| 44 | b = (*l)[0] |
| 45 | *l = (*l)[1:] |
| 46 | return b |
| 47 | } |