}
}
// Create initial transition
typeIdx = getInt(typeData[firstTZTransitionIdx]);
firstTZTransition = new TimeZoneTransition(((long)transitionTimes[firstTZTransitionIdx])*Grego.MILLIS_PER_SECOND,
initialRule, historicRules[typeIdx]);
}
}
if (initialRule == null) {
// No historic transitions
raw = typeOffsets[0]*Grego.MILLIS_PER_SECOND;
dst = typeOffsets[1]*Grego.MILLIS_PER_SECOND;
initialRule = new InitialTimeZoneRule((dst == 0 ? stdName : dstName), raw, dst);
}
if (finalZone != null) {
// Get the first occurrence of final rule starts
long startTime = (long)finalMillis;
TimeZoneRule firstFinalRule;
if (finalZone.useDaylightTime()) {
/*
* Note: When an OlsonTimeZone is constructed, we should set the final year
* as the start year of finalZone. However, the boundary condition used for
* getting offset from finalZone has some problems. So setting the start year
* in the finalZone will cause a problem. For now, we do not set the valid
* start year when the construction time and create a clone and set the
* start year when extracting rules.
*/
finalZoneWithStartYear = (SimpleTimeZone)finalZone.clone();
// finalYear is 1 year before the actual final year.
// See the comment in the construction method.
finalZoneWithStartYear.setStartYear(finalYear + 1);
TimeZoneTransition tzt = finalZoneWithStartYear.getNextTransition(startTime, false);
firstFinalRule = tzt.getTo();
startTime = tzt.getTime();
} else {
finalZoneWithStartYear = finalZone;
firstFinalRule = new TimeArrayTimeZoneRule(finalZone.getID(),
finalZone.getRawOffset(), 0, new long[] {startTime}, DateTimeRule.UTC_TIME);
}
TimeZoneRule prevRule = null;
if (transitionCount > 0) {
prevRule = historicRules[getInt(typeData[transitionCount - 1])];
}
if (prevRule == null) {
// No historic transitions, but only finalZone available
prevRule = initialRule;
}
firstFinalTZTransition = new TimeZoneTransition(startTime, prevRule, firstFinalRule);
}
transitionRulesInitialized = true;
}