Package com.ilib.tools.zic
Class Rule
- java.lang.Object
-
- com.ilib.tools.zic.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 Summary
Fields Modifier and Type Field Description protected java.lang.Stringcharacterprotected intendYearprotected org.apache.log4j.Loggerloggerprotected java.lang.StringruleSetNameprotected intsaveHoursprotected intsaveMinutesprotected intsaveSecondsprotected intstartYearprotected RelativeDatetransitionTimeprotected java.lang.Stringtype
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ruleclone()intcompareTo(Rule other)java.lang.StringgetCharacter()intgetEndYear()org.json.JSONObjectgetJson(boolean currentOnly)java.lang.StringgetRuleSetName()intgetSaveHours()intgetSaveMinutes()intgetSaveSeconds()intgetStartYear()RelativeDategetTransitionTime()java.lang.StringgetType()booleanhasSavings()Return true if the current rule has savings time in it.voidsetCharacter(java.lang.String character)voidsetEndYear(int endYear)voidsetRuleSetName(java.lang.String ruleSetName)voidsetSaveHours(int saveHours)voidsetSaveMinutes(int saveMinutes)voidsetSaveSeconds(int saveSeconds)voidsetStartYear(int startYear)voidsetTransitionTime(RelativeDate transitionTime)voidsetType(java.lang.String type)
-
-
-
Field Detail
-
ruleSetName
protected java.lang.String ruleSetName
-
startYear
protected int startYear
-
endYear
protected int endYear
-
type
protected java.lang.String type
-
transitionTime
protected RelativeDate transitionTime
-
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
-
-
Constructor Detail
-
Rule
public Rule()
-
Rule
public Rule(java.lang.String line) throws ParseException- Throws:
ParseException
-
-
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:
compareToin interfacejava.lang.Comparable<Rule>
-
getJson
public org.json.JSONObject getJson(boolean currentOnly) throws org.json.JSONException- Throws:
org.json.JSONException
-
clone
public Rule clone()
- Overrides:
clonein classjava.lang.Object
-
-