Delta Between Two Patch Sets: 2014/go4java/runner/embed.go
Issue 111050043 :
code review 111050043: go.talks: add "Go for Javaneros" (Closed)
Left Patch Set:
Right Patch Set: diff -r f10c43fe60f9 https://code.google.com/p/go.talks
Use n/p to move between diff chunks;
N/P to move between comments.
Please Sign in to add in-line comments.
Jump to:
2014/go4java.slide
2014/go4java/BadInheritance.java
2014/go4java/Composition.java
2014/go4java/battle.go
2014/go4java/chan.go
2014/go4java/conc1.go
2014/go4java/conc2.go
2014/go4java/conc3.go
2014/go4java/embedsample.go
2014/go4java/goodcounter.go
2014/go4java/goroutines.go
2014/go4java/img/baby.jpg
2014/go4java/img/badinheritance.png
2014/go4java/img/busy.jpg
2014/go4java/img/chain.jpg
2014/go4java/img/conc.jpg
2014/go4java/img/duck.jpg
2014/go4java/img/fast.jpg
2014/go4java/img/funcdraw.png
2014/go4java/img/funnelin.jpg
2014/go4java/img/gopher.jpg
2014/go4java/img/lego.jpg
2014/go4java/img/perfection.jpg
2014/go4java/img/piet.png
2014/go4java/img/trends.png
2014/go4java/loopback.go
2014/go4java/runner/embed.go
2014/go4java/runner/runner.go
2014/go4java/writecounter.go
LEFT RIGHT
(no file at all) 1 package runner
2
3 // RunCounter2 is completely equivalent to RunCounter,
4 // but uses struct embedding to avoid the boilerplate of redeclaring
5 // the Name method.
6 type RunCounter2 struct {
7 Runner // HL
8 count int
9 }
10
11 func NewRunCounter2(name string) *RunCounter2 {
12 return &RunCounter2{Runner{name}, 0}
13 }
14
15 func (r *RunCounter2) Run(t Task) {
16 r.count++
17 r.Runner.Run(t) // HL
18 }
19
20 func (r *RunCounter2) RunAll(ts []Task) {
21 r.count += len(ts)
22 r.Runner.RunAll(ts) // HL
23 }
24
25 func (r *RunCounter2) Count() int { return r.count }
LEFT RIGHT