Last active
February 24, 2019 08:16
-
-
Save AlexPinhasov/344ade7ca956dcb684ac69b985cf799a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: Vehicle { | |
// Informer Functions | |
override func engineStarted() { | |
super.engineStarted() | |
handleCarStarted() | |
} | |
// Management Functions | |
private func handleCarStarted() { | |
turnLights(on: true) | |
turnAC(on: true) | |
} | |
// Router Functions | |
private func turnLights(on shouldTurnLightsOn: Bool) { | |
if shouldTurnLightsOn { | |
turnExteriorLightsOn() | |
checkForBurnedBulbs() | |
} else { | |
turnExteriorLightsOff() | |
} | |
} | |
private func handleTurnAC(on shouldTurnACOn: Bool) { | |
if shouldTurnACOn { | |
let tempeture = currentTemptureSelected() | |
let toggleFocus = currentACToggleFocus() | |
startAC(with: tempeture, aimedTo: toggleFocus) | |
} else { | |
turnACOff() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment