Package com.ilib.tools.zic
Class Offset
- java.lang.Object
-
- com.ilib.tools.zic.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 Summary
Fields Modifier and Type Field Description protected RelativeDateendDateprotected java.lang.Stringformatprotected org.apache.log4j.Loggerloggerprotected intoffsetHoursprotected intoffsetMinutesprotected intoffsetSecondsprotected RuleSetrulesprotected java.lang.StringruleSetNameprotected charzoneChar
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Offset other)RelativeDategetEndDate()java.lang.StringgetFormat()org.json.JSONObjectgetJson(boolean currentOnly)intgetOffsetHours()intgetOffsetMinutes()intgetOffsetSeconds()RuleSetgetRules()voidsetEndDate(RelativeDate endDate)voidsetFields(java.lang.String line, java.util.HashMap<java.lang.String,RuleSet> ruleSets, java.lang.String timeZoneName)voidsetFormat(java.lang.String format)voidsetOffsetHours(int offsetHours)voidsetOffsetMinutes(int offsetMinutes)voidsetOffsetSeconds(int offsetSeconds)voidsetRules(RuleSet rules)
-
-
-
Field Detail
-
offsetHours
protected int offsetHours
-
offsetMinutes
protected int offsetMinutes
-
offsetSeconds
protected int offsetSeconds
-
ruleSetName
protected java.lang.String ruleSetName
-
rules
protected RuleSet rules
-
format
protected java.lang.String format
-
endDate
protected RelativeDate endDate
-
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:
compareToin interfacejava.lang.Comparable<Offset>
-
getJson
public org.json.JSONObject getJson(boolean currentOnly) throws org.json.JSONException- Throws:
org.json.JSONException
-
-