Class Rule

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

    public class Rule
    extends java.lang.Object
    implements java.lang.Comparable<Rule>
    Rule - Models a particular time change rule. For example, in the US, many places change to daylight savings time on the last Sunday of April, and the difference is 1 hour. The change occurs at 2:00am when the clock jumps immediately to 3:00am. This class models that particular rule. There is often another corresponding rule in the fall that regulates how time is changed back to standard time.
    • Field Detail

      • ruleSetName

        protected java.lang.String ruleSetName
      • startYear

        protected int startYear
      • endYear

        protected int endYear
      • type

        protected java.lang.String type
      • saveHours

        protected int saveHours
      • saveMinutes

        protected int saveMinutes
      • saveSeconds

        protected int saveSeconds
      • character

        protected java.lang.String character
      • logger

        protected org.apache.log4j.Logger logger
    • Method Detail

      • getRuleSetName

        public java.lang.String getRuleSetName()
      • getStartYear

        public int getStartYear()
        Returns:
        the startYear
      • setStartYear

        public void setStartYear​(int startYear)
        Parameters:
        startYear - the startYear to set
      • getEndYear

        public int getEndYear()
        Returns:
        the endYear
      • setEndYear

        public void setEndYear​(int endYear)
        Parameters:
        endYear - the endYear to set
      • getType

        public java.lang.String getType()
        Returns:
        the type
      • setType

        public void setType​(java.lang.String type)
        Parameters:
        type - the type to set
      • getTransitionTime

        public RelativeDate getTransitionTime()
        Returns:
        the transitionTime
      • setTransitionTime

        public void setTransitionTime​(RelativeDate transitionTime)
        Parameters:
        transitionTime - the transitionTime to set
      • hasSavings

        public boolean hasSavings()
        Return true if the current rule has savings time in it.
        Returns:
        true if the current rule has savings time in it, or false otherwise
      • getSaveHours

        public int getSaveHours()
        Returns:
        the saveHours
      • setSaveHours

        public void setSaveHours​(int saveHours)
        Parameters:
        saveHours - the saveHours to set
      • getSaveMinutes

        public int getSaveMinutes()
        Returns:
        the saveMinutes
      • setSaveMinutes

        public void setSaveMinutes​(int saveMinutes)
        Parameters:
        saveMinutes - the saveMinutes to set
      • getSaveSeconds

        public int getSaveSeconds()
        Returns:
        the saveSeconds
      • setSaveSeconds

        public void setSaveSeconds​(int saveSeconds)
        Parameters:
        saveSeconds - the saveSeconds to set
      • getCharacter

        public java.lang.String getCharacter()
        Returns:
        the character
      • setCharacter

        public void setCharacter​(java.lang.String character)
        Parameters:
        character - the character to set
      • setRuleSetName

        public void setRuleSetName​(java.lang.String ruleSetName)
        Parameters:
        ruleSetName - the ruleSetName to set
      • compareTo

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

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

        public Rule clone()
        Overrides:
        clone in class java.lang.Object