Class Offset

  • All Implemented Interfaces:
    java.lang.Comparable<Offset>

    public class Offset
    extends java.lang.Object
    implements java.lang.Comparable<Offset>
    Offset - models an offset from GMT in a particular time frame. If the time zone chooses to observe daylight savings time for an offset, then the offset will have a reference to a rule set that gives information about what the start and stop rules are for observing daylight savings time in a particular time frame. If the offset does not observe daylight savings time, the numeric value of the offset from GMT will remain fixed throughout the year. Rule sets can be shared. For example, the US federal government sets a default standard rule for daylight savings time that is to be used when smaller jurisdictions do not decide to make their own variation from the standard. Thus, many time zones share the "US" rule set.
    • Field Detail

      • offsetHours

        protected int offsetHours
      • offsetMinutes

        protected int offsetMinutes
      • offsetSeconds

        protected int offsetSeconds
      • ruleSetName

        protected java.lang.String ruleSetName
      • format

        protected java.lang.String format
      • logger

        protected org.apache.log4j.Logger logger
      • zoneChar

        protected char zoneChar
    • Constructor Detail

      • Offset

        public Offset()
      • Offset

        public Offset​(java.lang.String line,
                      java.util.HashMap<java.lang.String,​RuleSet> ruleSets,
                      java.lang.String timeZoneName)
               throws ParseException
        Throws:
        ParseException
    • Method Detail

      • setFields

        public void setFields​(java.lang.String line,
                              java.util.HashMap<java.lang.String,​RuleSet> ruleSets,
                              java.lang.String timeZoneName)
                       throws ParseException
        Throws:
        ParseException
      • getOffsetHours

        public int getOffsetHours()
        Returns:
        the offsetHours
      • setOffsetHours

        public void setOffsetHours​(int offsetHours)
        Parameters:
        offsetHours - the offsetHours to set
      • getOffsetMinutes

        public int getOffsetMinutes()
        Returns:
        the offsetMinutes
      • setOffsetMinutes

        public void setOffsetMinutes​(int offsetMinutes)
        Parameters:
        offsetMinutes - the offsetMinutes to set
      • getOffsetSeconds

        public int getOffsetSeconds()
        Returns:
        the offsetSeconds
      • setOffsetSeconds

        public void setOffsetSeconds​(int offsetSeconds)
        Parameters:
        offsetSeconds - the offsetSeconds to set
      • getRules

        public RuleSet getRules()
        Returns:
        the rules
      • setRules

        public void setRules​(RuleSet rules)
        Parameters:
        rules - the rules to set
      • getFormat

        public java.lang.String getFormat()
        Returns:
        the format
      • setFormat

        public void setFormat​(java.lang.String format)
        Parameters:
        format - the format to set
      • getEndDate

        public RelativeDate getEndDate()
        Returns:
        the endRule
      • setEndDate

        public void setEndDate​(RelativeDate endDate)
        Parameters:
        endDate - the endRule to set
      • compareTo

        public int compareTo​(Offset other)
        Specified by:
        compareTo in interface java.lang.Comparable<Offset>
      • getJson

        public org.json.JSONObject getJson​(boolean currentOnly)
                                    throws org.json.JSONException
        Throws:
        org.json.JSONException