MCPcopy Create free account
hub / github.com/Anchals24/Low-Level-Design / VendingMachine

Class VendingMachine

StateDesignPattern/VendingMachine.java:10–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import java.util.List;
9
10public class VendingMachine {
11
12 private States vendingMachineState;
13 private Inventory inventory;
14 private List<Coin> coinList;
15
16 public VendingMachine(){
17 vendingMachineState = new IdleState();
18 inventory = new Inventory(10);
19 coinList = new ArrayList<>();
20 }
21
22 public States getVendingMachineState() {
23 return vendingMachineState;
24 }
25
26 public void setVendingMachineState(States vendingMachineState) {
27 this.vendingMachineState = vendingMachineState;
28 }
29
30 public Inventory getInventory() {
31 return inventory;
32 }
33
34 public void setInventory(Inventory inventory) {
35 this.inventory = inventory;
36 }
37
38 public List<Coin> getCoinList() {
39 return coinList;
40 }
41
42 public void setCoinList(List<Coin> coinList) {
43 this.coinList = coinList;
44 }
45}
46

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected