Exemple #1
0
class CurrentCondition(Observer, Display):
    def __init__(self):
        self.data = Data()

    def update(self, data):
        self.data = data

    def display(self):
        print(self.data.print_display())
Exemple #2
0
class ThirdParty(Observer, Display):
    def __init__(self):
        self.data = Data()

    def update(self, data):
        self.data = data

    def display(self):
        print(self.data.print_display())
Exemple #3
0
class Forecast(Observer, Display):
    def __init__(self):
        self.data_forecast = Data()

    def update(self, data):
        self.data_forecast = self.get_forecast(data)

    def display(self):
        print(self.data_forecast.print_display())

    def get_forecast(self, data):
        # какие-то действия, которые расчитывают статистику по полученным данным
        return data
Exemple #4
0
 def __init__(self):
     self.data = Data()
 def __init__(self):
     self.list_observer = []
     self.data = Data()
     self.measurements_changed()
Exemple #6
0
 def __init__(self):
     self.data_forecast = Data()
Exemple #7
0
from base.subject import Subject
from weather_data.weather_data import WeatherData
from element_display.current_condition import CurrentCondition
from weather_data.data import Data


if __name__ == '__main__':
    data = Data()
    wd = WeatherData()
    x = CurrentCondition()

    wd.register_observer(x)

    x.display()
    wd.measurements_changed()
    x.display()
Exemple #8
0
 def __init__(self):
     self.data_stat = Data()