org.ka2ddo.yaac.weather
Class WeatherDistributor

java.lang.Object
  extended by org.ka2ddo.yaac.weather.WeatherDistributor

public class WeatherDistributor
extends java.lang.Object

This class collects weather data from the local weather station and makes it available to other listening classes.


Field Summary
static java.lang.String[] WEATHER_STATION_TYPES
          Types of weather stations (abbreviations) to be appended to generic weather station data strings.
 
Method Summary
 void addWeatherListener(WeatherListener l)
          Register a WeatherListener to be notified of updates in the weather data.
 java.lang.Number get(WeatherEnum e)
          Fetch a numeric value from the weather data.
static WeatherDistributor getInstance()
           
static java.lang.String[] getWeatherModelNameStrings()
          Returns an array of localized weather station model names, in the same order as the standard abbreviations.
 void loadCurrentWeather(java.util.Map<? extends java.lang.Enum,?> extensions)
          Copy weather data from some other map into the currentWeather map in this WeatherDistributor.
 PositionlessWeatherReport makeWeatherMsg()
          Build a PositionlessWeatherReport from the current state of the collected local weather data.
 java.util.Map<java.lang.Enum,java.lang.Object> parseWeatherData(java.lang.String line, java.util.Map<java.lang.Enum,java.lang.Object> currentWeather)
           
 void removeWeatherListener(WeatherListener l)
          Deregister a WeatherListener so it will no longer be informed of changes in the local weather data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEATHER_STATION_TYPES

public static final java.lang.String[] WEATHER_STATION_TYPES
Types of weather stations (abbreviations) to be appended to generic weather station data strings. The key "WeatherStationType."+the abbreviation is the key to look up the localized name string for each supported abbreviation.

Method Detail

getInstance

public static WeatherDistributor getInstance()

parseWeatherData

public java.util.Map<java.lang.Enum,java.lang.Object> parseWeatherData(java.lang.String line,
                                                                       java.util.Map<java.lang.Enum,java.lang.Object> currentWeather)

loadCurrentWeather

public void loadCurrentWeather(java.util.Map<? extends java.lang.Enum,?> extensions)
Copy weather data from some other map into the currentWeather map in this WeatherDistributor.

Parameters:
extensions - Map of WeatherEnums to values

get

public java.lang.Number get(WeatherEnum e)
Fetch a numeric value from the weather data.

Parameters:
e - WeatherEnum for the data item wanted
Returns:
Number of the value of the requested weather data item, or null if the item isn't known

addWeatherListener

public void addWeatherListener(WeatherListener l)
Register a WeatherListener to be notified of updates in the weather data.

Parameters:
l - WeatherListener to register

removeWeatherListener

public void removeWeatherListener(WeatherListener l)
Deregister a WeatherListener so it will no longer be informed of changes in the local weather data.

Parameters:
l - WeatherListener to deregister

makeWeatherMsg

public PositionlessWeatherReport makeWeatherMsg()
Build a PositionlessWeatherReport from the current state of the collected local weather data.

Returns:
PositionlessWeatherReport containing the current local weather, or null if there is no weather data to report

getWeatherModelNameStrings

public static java.lang.String[] getWeatherModelNameStrings()
Returns an array of localized weather station model names, in the same order as the standard abbreviations.

Returns:
String array of model names