Class WeatherUtil


  • public class WeatherUtil
    extends Object
    Helper methods for helping display some weather information from numbers to strings.
    • Constructor Detail

      • WeatherUtil

        public WeatherUtil()
    • Method Detail

      • appendDegree

        public static String appendDegree​(String temp)
        Appends the degree sign to the string degree.
        Parameters:
        temp - temperature in degree to add the sign to.
        Returns:
        String with degree sign appended.
      • appendDegree

        public static String appendDegree​(Number temp)
        Appends the degree sign to the string degree.
        Parameters:
        temp - temperature in degree to add the sign to.
        Returns:
        String with degree sign appended.
      • getWindSpeedDirDesc

        public static String getWindSpeedDirDesc​(String dir,
                                                 Number speed)
      • getFormatFromTimeZone

        public static String getFormatFromTimeZone​(Profile profile,
                                                   String format)
        Gets the format from the profile with desired UTS 35
        Parameters:
        profile - profile to get format from
        format - format to parse to
        Returns:
        time in hh:mm a format.
      • getTimeFromTimezone

        public static String getTimeFromTimezone​(Profile profile)
        Gets the time from the timezone object in hh:mm a format.
        Parameters:
        profile - profile to get time from
        Returns:
        time in hh:mm a format.
      • getDayNumFromISO

        public static String getDayNumFromISO​(String iso)
        Takes the ISO 8601 time string and returns the day number (1-31) of the month
        Parameters:
        iso - ISO 8601 string to parse
        Returns:
        Day number of the month
      • getDayFromISO

        public static String getDayFromISO​(String iso)
        Takes the ISO 8601 time string and returns the day i.e. Mon in three character code.
        Parameters:
        iso - ISO 8601 string to parse
        Returns:
        Day of the week in EEE
      • getTimeFromISO

        public static String getTimeFromISO​(String iso)
        Takes the ISO 8601 time string and returns time in HH:mm AM/PM (h:mm aa in Unicode UTS #35)
        Parameters:
        iso - ISO 8601 string to parse
        Returns:
        Time formatted.
      • getFormatFromISO

        public static String getFormatFromISO​(String iso,
                                              String pattern)
        Takes the ISO 8601 time string and returns time in desired UTS #35 format.
        Parameters:
        iso - ISO 8601 string to parse
        pattern - pattern to parse too.
        Returns:
        Time formatted.
      • getFormatFromISO_CorrectTimezone

        public static String getFormatFromISO_CorrectTimezone​(String iso,
                                                              String pattern)
        Takes the ISO 8601 time string and returns time in desired UTS #35
        Parameters:
        iso - ISO 8601 string to parse
        pattern - Pattern for the time/date format
        Returns:
        String - formatted date and time
      • getTimeFromISO

        public static String getTimeFromISO​(String iso,
                                            boolean showMinutes)
        Takes the ISO 8601 time string and returns time in HH:mm AM/PM (h:mm aa Unicode UTS #35) if showMinutes is true, or HH AM/PM(h aa Unicode UTS #35) if not.
        Parameters:
        iso - ISO 8601 string to parse
        showMinutes - whether to show the minutes or not
        Returns:
        Time formatted.
      • getPlaceFormat

        public static String getPlaceFormat​(Place place)
      • getFormattedPrecipText

        public static String getFormattedPrecipText​(Number number)
      • getFormattedPrecipText

        public static String getFormattedPrecipText​(Number number,
                                                    boolean isSnow)