Last active
July 24, 2021 18:48
-
-
Save alex-ber/435ca6207302c5cf2ed5eebb75e99425 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import java.util.Objects; | |
| public class Pizza implements Delivarable { | |
| private DelivarableStatus status = DelivarableStatus.IN_PROGRESS; | |
| private PizzaDeliveryStrategy strategy; | |
| public Pizza(PizzaDeliveryStrategy strategy){ | |
| this.strategy = Objects.requireNotNull(strategy); | |
| } | |
| public void getStatus(DelivarableStatus status){ | |
| return this.status; | |
| } | |
| public void setStatus(DelivarableStatus status){ | |
| this.status = status; | |
| } | |
| @Override | |
| public void deliver(){ | |
| if (isDeliverable()) { | |
| this.strategy.deliver(this); | |
| this.setStatus(DelivarableStatus.DELIVERED); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment