org. helvector. weather. ForecastToText

Summary
1.0.0
Takes the specified Forecast Object and returns a human readable weather report from the details.
Formats and returns a string for the current conditions.
Formats and returns a string for the temperature.
Formats and returns a string for the feels like temperature.
Formats and returns a string for the temperature.
Formats and returns a string for the wind conditions.
Formats and returns a string for the humidity.
Formats and returns a string for the visibility.
Formats and returns a string for the uvIndex.
Formats and returns a string for the dew point.
Formats and returns a string for the moons phase.
Formats and returns a string for the sunrise and sunset.
Formats and returns a string for the weather station the information was gathered from.

Version

1.0.0

Copyright © Simon Gregory, January 2005.  All rights reserved.

Notes

Static function library which takes a Forecast class object and outputs a reable string.

Variables

metricTempUnit

private static var metricTempUnit: String

imperialTempUnit

private static var imperialTempUnit: String

metricDisUnit

private static var metricDisUnit: String

imperialDisUnit

private static var imperialDisUnit: String

metricPresUnit

private static var metricPresUnit: String

imperialPresUnit

private static var imperialPresUnit: String

metricSpeedUnit

private static var metricSpeedUnit: String

imperialSpeedUnit

private static var imperialSpeedUnit: String

unknown

private static var unknown: String

Functions

makeReport

public static function makeReport(f: Forecast):String

Takes the specified Forecast Object and returns a human readable weather report from the details.

Parameters

fweather object

Returns

Human readable formatted string of weather data.

See Also

cc

public static function cc(o: Object):String

Formats and returns a string for the current conditions.

Parameters

obobject containing information from parsed xml feed.

Returns

String, eg “Summary: Not Available” or “Summary: Light Rain”

temperature

public static function temperature(o: Object,
metric: Boolean):String

Formats and returns a string for the temperature.

Parameters

obobject containing information from parsed xml feed.
metricboolean specifying wether to convert the values to metric.

Returns

String, eg “Temperature: Not Available” or “Temperature is 22 C”

tempFeelsLike

public static function tempFeelsLike(o: Object,
metric: Boolean):String

Formats and returns a string for the feels like temperature.

Parameters

obobject containing information from parsed xml feed.
metricboolean specifying wether to convert the values to metric.

Returns

String, eg “” or “and it feels like 12 C outside.”

pres

public static function pres(o: Object,
metric: Boolean):String

Formats and returns a string for the temperature.  For info on atmospheric pressure see http://en.wikipedia.org/wiki/Barometric_pressure.

Parameters

obobject containing information from parsed xml feed.
metricboolean specifying wether to convert the values to metric.

Returns

String, eg “Pressure: Not Available” or “Pressure: 968 mb” or “Pressure: 968 mb and rising”

windConditions

public static function windConditions(o: Object,
metric: Boolean):String

Formats and returns a string for the wind conditions.  Wind data from feed can be N/A for not available, CLAM for Calm winds, VAR for Variable, or FROM N,S,E,W,NE...NW,NNE...NNW

Parameters

obobject containing information from parsed xml feed.
metricboolean specifying wether to convert the values to metric.

Returns

String, eg “Wind: Not Available” or “Wind: Calm” or “Wind: From north east at 12 mph” or “Wind: From north east at 12 mph with gusts up to 18 mph.”

humid

public static function humid(o: Object):String

Formats and returns a string for the humidity.

Parameters

obobject containing information from parsed xml feed.

Returns

String, eg “Humidity: Not Available” , “Humidity: 50%”;

visibility

public static function visibility(o: Object,
metric: Boolean):String

Formats and returns a string for the visibility.

Parameters

obobject containing information from parsed xml feed.
metricboolean specifying wether to convert the values to metric.

Returns

String, eg “Visibility: Unlimited” or “Visibility: Not Available” or “Visiblity: 5 Miles”

uvIndex

public static function uvIndex(o: Object):String

Formats and returns a string for the uvIndex.

Parameters

obobject containing information from parsed xml feed.

Returns

String, eg “UV Index: Not Available” or “UV Index: low at 0 out of 12.”

dewPoint

public static function dewPoint(o: Object,
metric: Boolean):String

Formats and returns a string for the dew point.  For information on the dew point see http://en.wikipedia.org/wiki/Dew_point

Parameters

obobject containing information from parsed xml feed.
metricboolean specifying wether to convert the values to metric.

Returns

String, eg “Dew Point: Not Available” or “Dew Point: 43 F”

moonPhase

public static function moonPhase(o: Object):String

Formats and returns a string for the moons phase.  For information on the moons phase see http://en.wikipedia.org/wiki/Moon_phase

Parameters

obobject containing information from parsed xml feed.

Returns

String, eg “Moon: Not Available.” or “Moon: Waxing Gibbous.”

sunRiseSet

public static function sunRiseSet(o: Object):String

Formats and returns a string for the sunrise and sunset.

Parameters

obobject containing information from parsed xml feed.

Returns

String, eg “Sun Rise: 8.00 am \n Sun Set: 8.00 pm”;

weatherStation

public static function weatherStation(o: Object):String

Formats and returns a string for the weather station the information was gathered from.

Parameters

obobject containing information from parsed xml feed.

Returns

String, eg “Weather Station: London City Arpt, United Kingdom”

private static var metricTempUnit: String
private static var imperialTempUnit: String
private static var metricDisUnit: String
private static var imperialDisUnit: String
private static var metricPresUnit: String
private static var imperialPresUnit: String
private static var metricSpeedUnit: String
private static var imperialSpeedUnit: String
private static var unknown: String
public static function makeReport(f: Forecast):String
Takes the specified Forecast Object and returns a human readable weather report from the details.
public static function cc(o: Object):String
Formats and returns a string for the current conditions.
public static function temperature(o: Object,
metric: Boolean):String
Formats and returns a string for the temperature.
public static function tempFeelsLike(o: Object,
metric: Boolean):String
Formats and returns a string for the feels like temperature.
public static function pres(o: Object,
metric: Boolean):String
Formats and returns a string for the temperature.
public static function windConditions(o: Object,
metric: Boolean):String
Formats and returns a string for the wind conditions.
public static function humid(o: Object):String
Formats and returns a string for the humidity.
public static function visibility(o: Object,
metric: Boolean):String
Formats and returns a string for the visibility.
public static function uvIndex(o: Object):String
Formats and returns a string for the uvIndex.
public static function dewPoint(o: Object,
metric: Boolean):String
Formats and returns a string for the dew point.
public static function moonPhase(o: Object):String
Formats and returns a string for the moons phase.
public static function sunRiseSet(o: Object):String
Formats and returns a string for the sunrise and sunset.
public static function weatherStation(o: Object):String
Formats and returns a string for the weather station the information was gathered from.