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

Class Store

ObserverDesignPattern/Store.java:9–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import BehaviouralDesignPatterns.ObserverDesignPattern.Observer.NotificationAlertObserver;
8
9public class Store {
10 public static void main(String[] args) {
11
12 StockStatusAmazonObservable iphoneStockObservable = new IphoneStockObservableImpl();
13
14 NotificationAlertObserver observer1 = new EmailAlertObserverImpl("ancss12@gmail.com", iphoneStockObservable);
15 NotificationAlertObserver observer2 = new MobileAlertObserverImpl("Anchal", iphoneStockObservable);
16 NotificationAlertObserver observer3 = new EmailAlertObserverImpl("ikshit701@gmail.com", iphoneStockObservable);
17
18 iphoneStockObservable.add(observer1);
19 iphoneStockObservable.add(observer2);
20 iphoneStockObservable.add(observer3);
21 iphoneStockObservable.getStockCount();
22 iphoneStockObservable.setStockCount(20);
23 iphoneStockObservable.getStockCount();
24 iphoneStockObservable.setStockCount(-20);
25
26
27
28
29 }
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected