blob: aef71d711e60ffe81baaf18f5f2c3aa37a5938d8 [file] [log] [blame]
Francesc Campoy7aeee3b2014-07-15 14:58:11 -07001package runner
2
3// RunCounter2 is completely equivalent to RunCounter,
4// but uses struct embedding to avoid the boilerplate of redeclaring
5// the Name method.
6type RunCounter2 struct {
7 Runner // HL
8 count int
9}
10
11func NewRunCounter2(name string) *RunCounter2 {
12 return &RunCounter2{Runner{name}, 0}
13}
14
15func (r *RunCounter2) Run(t Task) {
16 r.count++
17 r.Runner.Run(t) // HL
18}
19
20func (r *RunCounter2) RunAll(ts []Task) {
21 r.count += len(ts)
22 r.Runner.RunAll(ts) // HL
23}
24
25func (r *RunCounter2) Count() int { return r.count }