Misc. changes to weather info display.
This commit is contained in:
parent
65c1263cbf
commit
760a2074e5
6 changed files with 621 additions and 257 deletions
|
@ -1,5 +1,5 @@
|
|||
/* Created by JReleaseInfo AntTask from Open Source Competence Group */
|
||||
/* Creation date Fri Jun 02 16:51:45 PDT 2006 */
|
||||
/* Creation date Mon Apr 16 15:39:07 GMT 2007 */
|
||||
package net.thauvin.erik.mobibot;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -20,21 +20,21 @@ public class ReleaseInfo {
|
|||
}
|
||||
|
||||
|
||||
/** buildDate (set during build process to 1149292305593L). */
|
||||
private static final Date buildDate = new Date(1149292305593L);
|
||||
/** buildDate (set during build process to 1176737947817L). */
|
||||
private static final Date buildDate = new Date(1176737947817L);
|
||||
|
||||
/**
|
||||
* Get buildDate (set during build process to Fri Jun 02 16:51:45 PDT 2006).
|
||||
* Get buildDate (set during build process to Mon Apr 16 15:39:07 GMT 2007).
|
||||
* @return Date buildDate
|
||||
*/
|
||||
public static Date getBuildDate() { return buildDate; }
|
||||
|
||||
|
||||
/**
|
||||
* Get buildNumber (set during build process to 63).
|
||||
* Get buildNumber (set during build process to 68).
|
||||
* @return int buildNumber
|
||||
*/
|
||||
public static int getBuildNumber() { return 63; }
|
||||
public static int getBuildNumber() { return 68; }
|
||||
|
||||
|
||||
/** version (set during build process to "0.3"). */
|
||||
|
|
|
@ -40,15 +40,15 @@ import net.sf.jweather.metar.Metar;
|
|||
import net.sf.jweather.metar.SkyCondition;
|
||||
import net.sf.jweather.metar.WeatherCondition;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* Fetches the weather data from a specific station ID.
|
||||
*
|
||||
* @author Erik C. Thauvin
|
||||
* @version $Revision$, $Date$
|
||||
*
|
||||
* @created Feb 7, 2004
|
||||
* @since 1.0
|
||||
*/
|
||||
|
@ -59,6 +59,11 @@ public class Weather implements Runnable
|
|||
*/
|
||||
public static final String STATIONS_URL = "http://www.rap.ucar.edu/weather/surface/stations.txt";
|
||||
|
||||
/**
|
||||
* The decimal number format.
|
||||
*/
|
||||
private static final DecimalFormat NUMBER_FORMAT = new DecimalFormat("0.##");
|
||||
|
||||
/**
|
||||
* The bot.
|
||||
*/
|
||||
|
@ -110,12 +115,18 @@ public class Weather implements Runnable
|
|||
|
||||
_bot.send(_sender, "Station ID: " + metar.getStationID(), _isPrivate);
|
||||
|
||||
_bot.send(_sender,
|
||||
"At: " + metar.getDateString() + " UTC ("
|
||||
+ (((new Date()).getTime() - metar.getDate().getTime()) / 1000L / 60L) + " minutes ago)",
|
||||
_isPrivate);
|
||||
|
||||
result = metar.getWindSpeedInMPH();
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
_bot.send(_sender, "Wind Speed: " + result + " mph, " + metar.getWindSpeedInKnots() + " knots",
|
||||
_isPrivate);
|
||||
_bot.send(_sender,
|
||||
"Wind Speed: " + result + " mph, " + metar.getWindSpeedInKnots() + " knots",
|
||||
_isPrivate);
|
||||
}
|
||||
|
||||
result = metar.getVisibility();
|
||||
|
@ -124,11 +135,11 @@ public class Weather implements Runnable
|
|||
{
|
||||
if (!metar.getVisibilityLessThan())
|
||||
{
|
||||
_bot.send(_sender, "Visibility: " + result + " mile(s)", _isPrivate);
|
||||
_bot.send(_sender, "Visibility: " + NUMBER_FORMAT.format(result) + " mile(s)", _isPrivate);
|
||||
}
|
||||
else
|
||||
{
|
||||
_bot.send(_sender, "Visibility: < " + result + " mile(s)", _isPrivate);
|
||||
_bot.send(_sender, "Visibility: < " + NUMBER_FORMAT.format(result) + " mile(s)", _isPrivate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,8 +154,9 @@ public class Weather implements Runnable
|
|||
|
||||
if (result != null)
|
||||
{
|
||||
_bot.send(_sender, "Temperature: " + result + " C, " + metar.getTemperatureInFahrenheit() + " F",
|
||||
_isPrivate);
|
||||
_bot.send(_sender,
|
||||
"Temperature: " + result + " C, " + metar.getTemperatureInFahrenheit() + " F",
|
||||
_isPrivate);
|
||||
}
|
||||
|
||||
if (metar.getWeatherConditions() != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue