Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chainOfResponsibility/cashier.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package main
import "fmt"

type Cashier struct {
next Department
DepartmentBase
}

func (c *Cashier) execute(p *Patient) {
if p.paymentDone {
fmt.Println("Payment Done")
}
fmt.Println("Cashier getting money from patient patient")
fmt.Println("Cashier getting money from patient:", p.name)
}

func (c *Cashier) setNext(next Department) {
Expand Down
2 changes: 1 addition & 1 deletion chainOfResponsibility/departmentBase.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package main

type DepartmentBase struct {
nextDepartment Department
next Department
}
4 changes: 2 additions & 2 deletions chainOfResponsibility/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import "fmt"

type Doctor struct {
next Department
DepartmentBase
}

func (d *Doctor) execute(p *Patient) {
Expand All @@ -12,7 +12,7 @@ func (d *Doctor) execute(p *Patient) {
d.next.execute(p)
return
}
fmt.Println("Doctor checking patient")
fmt.Println("Doctor checking patient:", p.name)
p.doctorCheckUpDone = true
d.next.execute(p)
}
Expand Down
6 changes: 3 additions & 3 deletions chainOfResponsibility/medical.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package main
import "fmt"

type Medical struct {
next Department
DepartmentBase
}

func (m *Medical) execute(p *Patient) {
if p.medicineDone {
fmt.Println("Medicine already given to patient")
fmt.Println("Medicine already given to patient:", p.name)
m.next.execute(p)
return
}
fmt.Println("Medical giving medicine to patient")
fmt.Println("Medical giving medicine to patient:", p.name)
p.medicineDone = true
m.next.execute(p)
}
Expand Down
4 changes: 2 additions & 2 deletions chainOfResponsibility/reception.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import "fmt"

type Reception struct {
next Department
DepartmentBase
}

func (r *Reception) execute(p *Patient) {
Expand All @@ -12,7 +12,7 @@ func (r *Reception) execute(p *Patient) {
r.next.execute(p)
return
}
fmt.Println("Reception registering patient")
fmt.Println("Reception registering patient:", p.name)
p.registrationDone = true
r.next.execute(p)
}
Expand Down