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.String
character
protected int
endYear
protected org.apache.log4j.Logger
logger
protected java.lang.String
ruleSetName
protected int
saveHours
protected int
saveMinutes
protected int
saveSeconds
protected int
startYear
protected RelativeDate
transitionTime
protected java.lang.String
type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule
clone()
int
compareTo(Rule other)
java.lang.String
getCharacter()
int
getEndYear()
org.json.JSONObject
getJson(boolean currentOnly)
java.lang.String
getRuleSetName()
int
getSaveHours()
int
getSaveMinutes()
int
getSaveSeconds()
int
getStartYear()
RelativeDate
getTransitionTime()
java.lang.String
getType()
boolean
hasSavings()
Return true if the current rule has savings time in it.void
setCharacter(java.lang.String character)
void
setEndYear(int endYear)
void
setRuleSetName(java.lang.String ruleSetName)
void
setSaveHours(int saveHours)
void
setSaveMinutes(int saveMinutes)
void
setSaveSeconds(int saveSeconds)
void
setStartYear(int startYear)
void
setTransitionTime(RelativeDate transitionTime)
void
setType(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:
compareTo
in 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:
clone
in classjava.lang.Object
-
-