Class Weather
java.lang.Object
de.kaffeemitkoffein.tinyweatherforecastgermany.Weather
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic final classstatic classstatic classclassstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final doublestatic final intstatic final intstatic final String[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatgetApproxMoonPositionOnSky(Weather.WeatherLocation weatherLocation, long time) Determines the approximate position of the moon on the sky based on rise and set times.static floatgetApproxSunPositionOnSky(Weather.WeatherLocation weatherLocation, long time) Determines the approximate position of the sun on the sky based on sunrise and sunset times.static longgetCivilTwilightEvening(Weather.WeatherLocation weatherLocation, long time) static longgetCivilTwilightEvening(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) static longgetCivilTwilightEvening(Astronomy.Riseset riseset, long time) static longgetCivilTwilightMorning(Weather.WeatherLocation weatherLocation, long time) static longgetCivilTwilightMorning(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) static longgetCivilTwilightMorning(Astronomy.Riseset riseset, long time) static CurrentWeatherInfogetCurrentWeatherInfo(Context context) static StringGetDateString(SimpleDateFormat simpleDateFormat, long time) static longgetMidnightTime(long time) static doublegetMoonPhase(long time) Calculates the moon phase from the current time.static doublegetMoonPhaseDay(long time) Calculates the moon day from the current time.static intgetMoonPhaseInDegrees(long time) Calculates the moon phase from the current time.static longgetMoonRiseInUTC(Weather.WeatherLocation weatherLocation, long time) static longgetMoonRiseInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) static longgetMoonRiseInUTC(Astronomy.Riseset riseset, long time) static Astronomy.RisesetgetMoonRiseset(Weather.WeatherLocation weatherLocation, long time) static longgetMoonSetInUTC(Weather.WeatherLocation weatherLocation, long time) static longgetMoonSetInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) static longgetMoonSetInUTC(Astronomy.Riseset riseset, long time) static longgetNextMidnightTime(long time) static longgetPollingTime(Context context) static Astronomy.RisesetgetRiseset(Weather.WeatherLocation weatherLocation, long time) static SimpleDateFormatgetSimpleDateFormat(int format) static longgetSunriseInUTC(Weather.WeatherLocation weatherLocation, long time) static longgetSunriseInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) static longgetSunriseInUTC(Astronomy.Riseset riseset, long time) static longgetSunsetInUTC(Weather.WeatherLocation weatherLocation, long time) static longgetSunsetInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) static longgetSunsetInUTC(Astronomy.Riseset riseset, long time) static StringgetWindString(Context context, CurrentWeatherInfo weatherCard) static StringgetWindUnitString(int type) static booleanhasCurrentWeatherInfo(Context context) static booleanhasUVHIData(Context context) static booleanisDaytime(Weather.WeatherLocation weatherLocation, long time) static booleanisMoonTime(Weather.WeatherLocation weatherLocation, long time) static booleanisSunriseInIntervalUTC(Astronomy.Riseset riseset, long start, long stop) static booleanisSunsetInIntervalUTC(Astronomy.Riseset riseset, long start, long stop) static voidremoveForecastsFromDatabase(Context context) static voidsanitizeDatabase(Context context) static booleansuitableNetworkAvailable(Context context) static StringtoFullDateTimeString(long time) static StringtoHourMinuteString(long time) static booleanusePreciseIsDaytime(Weather.WeatherLocation weatherLocation) Returns if a precise calculation of day/night time with the Astronomy class makes sense.
-
Field Details
-
KelvinConstant
public static final double KelvinConstant- See Also:
-
MILLIS_IN_HOUR
public static final int MILLIS_IN_HOUR- See Also:
-
DELTA_T
public static final int DELTA_T- See Also:
-
PROB_OF_PRECIPITATION_ITEM_COUNT
public static final int PROB_OF_PRECIPITATION_ITEM_COUNT- See Also:
-
DATA_SIZE
public static final int DATA_SIZE- See Also:
-
SQL_COMMAND_QUERYTIMECOLUMN
-
-
Constructor Details
-
Weather
public Weather()
-
-
Method Details
-
hasCurrentWeatherInfo
public static boolean hasCurrentWeatherInfo(Context context) -
getCurrentWeatherInfo
-
hasUVHIData
public static boolean hasUVHIData(Context context) -
getPollingTime
public static long getPollingTime(Context context) -
sanitizeDatabase
public static void sanitizeDatabase(Context context) -
getRiseset
-
getMoonRiseset
-
isMoonTime
-
getMidnightTime
public static long getMidnightTime(long time) -
getNextMidnightTime
public static long getNextMidnightTime(long time) -
getApproxMoonPositionOnSky
Determines the approximate position of the moon on the sky based on rise and set times. Note: to eliminate possible time shifts between rise sets of different days, in most cases this calculation is averaged over three hours.- Parameters:
weatherLocation- the location to calculate the value fortime- the time in UTC (milliseconds)- Returns:
- the approximate position, where 0 is rise and 1 is set. Returns -1 if the moon is not visible at the time.
-
getApproxSunPositionOnSky
Determines the approximate position of the sun on the sky based on sunrise and sunset times. Note: to eliminate possible time shifts between rise sets of different days, in most cases this calculation is averaged over three hours.- Parameters:
weatherLocation- the location to calculate the value fortime- the time in UTC (milliseconds)- Returns:
- the approximate position, where 0 is sunrise, 0.5 is midday and 1 is sunset. Returns -1 if the sun is not visible at the time.
-
isDaytime
-
usePreciseIsDaytime
Returns if a precise calculation of day/night time with the Astronomy class makes sense. It makes sense between a latutide of -65° to +65°, but not further south or north.- Parameters:
weatherLocation-- Returns:
-
getSunsetInUTC
-
getSunsetInUTC
-
getSunsetInUTC
public static long getSunsetInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) -
getSunriseInUTC
-
getSunriseInUTC
-
getSunriseInUTC
public static long getSunriseInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) -
getCivilTwilightMorning
-
getCivilTwilightMorning
-
getCivilTwilightMorning
public static long getCivilTwilightMorning(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) -
getCivilTwilightEvening
-
getCivilTwilightEvening
-
getCivilTwilightEvening
public static long getCivilTwilightEvening(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) -
getMoonRiseInUTC
-
getMoonRiseInUTC
-
getMoonRiseInUTC
public static long getMoonRiseInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) -
getMoonSetInUTC
-
getMoonSetInUTC
-
getMoonSetInUTC
public static long getMoonSetInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo) -
getMoonPhaseDay
public static double getMoonPhaseDay(long time) Calculates the moon day from the current time.- Parameters:
time- in milliseconds epoch time- Returns:
- day of the moon phase; range 0 - 29.53
-
getMoonPhase
public static double getMoonPhase(long time) Calculates the moon phase from the current time.- Parameters:
time- in milliseconds epoch time- Returns:
- the moon phase; range 0 - 1, where 0 is new moon and 0.5 is full moon
-
getMoonPhaseInDegrees
public static int getMoonPhaseInDegrees(long time) Calculates the moon phase from the current time.- Parameters:
time- in milliseconds epoch time- Returns:
- the moon phase in degrees; range 0 - 360, where 0 is new moon and 180 is full moon
-
isSunriseInIntervalUTC
-
isSunsetInIntervalUTC
-
toHourMinuteString
-
toFullDateTimeString
-
getWindUnitString
-
getWindString
-
removeForecastsFromDatabase
public static void removeForecastsFromDatabase(Context context) -
getSimpleDateFormat
-
GetDateString
-
suitableNetworkAvailable
public static boolean suitableNetworkAvailable(Context context)
-