Validate method
void
Validate()
override
Implementation
void Validate() {
// The definition must have at least one period, one transition group and one transition,
// and there must be as many transitions as there are transition groups.
if (this._periods.length < 1 ||
this._transitions.length < 1 ||
this._transitionGroups.length < 1 ||
this._transitionGroups.length != this._transitions.length) {
throw new ServiceLocalException(
"Strings.InvalidOrUnsupportedTimeZoneDefinition");
}
// The first transition must be of type TimeZoneTransition.
if (this._transitions[0].runtimeType != TimeZoneTransition) {
throw new ServiceLocalException(
"Strings.InvalidOrUnsupportedTimeZoneDefinition");
}
// All transitions must be to transition groups and be either TimeZoneTransition or
// AbsoluteDateTransition instances.
for (TimeZoneTransition transition in this._transitions) {
Type transitionType = transition.runtimeType;
if (transitionType != TimeZoneTransition &&
transitionType != AbsoluteDateTransition) {
throw new ServiceLocalException(
"Strings.InvalidOrUnsupportedTimeZoneDefinition");
}
if (transition.TargetGroup == null) {
throw new ServiceLocalException(
"Strings.InvalidOrUnsupportedTimeZoneDefinition");
}
}
// All transition groups must be valid.
for (TimeZoneTransitionGroup transitionGroup
in this._transitionGroups.values) {
transitionGroup.Validate();
}
}