001package headfirst.observer.WeatherStationObservable; 002 003import java.util.Observable; 004 005public class WeatherData extends Observable { 006 private float temperature; 007 private float humidity; 008 private float pressure; 009 010 public WeatherData() { } 011 012 public void measurementsChanged() { 013 setChanged(); 014 notifyObservers(); 015 } 016 017 public void setMeasurements(float temperature, float humidity, float pressure) { 018 this.temperature = temperature; 019 this.humidity = humidity; 020 this.pressure = pressure; 021 measurementsChanged(); 022 } 023 024 public float getTemperature() { 025 return temperature; 026 } 027 028 public float getHumidity() { 029 return humidity; 030 } 031 032 public float getPressure() { 033 return pressure; 034 } 035}