Skip to content

Instantly share code, notes, and snippets.

@mkock
Created August 20, 2020 19:17
Show Gist options
  • Select an option

  • Save mkock/daa21af2d20f4bb80245568fc9a5ebd5 to your computer and use it in GitHub Desktop.

Select an option

Save mkock/daa21af2d20f4bb80245568fc9a5ebd5 to your computer and use it in GitHub Desktop.
Bus Ride, code snippet 19
// NotifyBusArrival is called by Bus upon arrival.
func (b *BusStop) NotifyBusArrival(bus *Bus) {
for _, p := range b.prospects {
if bus.StopsAt(p.Destination) {
bus.Add(p.ToPassenger())
}
}
}
// Equals returns true if the given BusStop is the same as the receiver.
func (b *BusStop) Equals(busStop *BusStop) bool {
return b.Name == busStop.Name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment