/// <summary> /// /// </summary> /// /// @draft ICU 3.8 /// @provisional This API might change or be removed in a future release. public override Object Clone() { RuleBasedTimeZone other = (RuleBasedTimeZone)base.Clone(); if (historicRules != null) { other.historicRules = (IList)((ArrayList)historicRules).Clone(); // rules // are // immutable } if (finalRules != null) { other.finalRules = (AnnualTimeZoneRule[])finalRules.Clone(); } return(other); }
/// <summary> /// /// </summary> /// /// @draft ICU 3.8 /// @provisional This API might change or be removed in a future release. public override bool HasSameRules(TimeZone other) { if (!(other is RuleBasedTimeZone)) { // We cannot reasonably compare rules in different types return(false); } RuleBasedTimeZone otherRBTZ = (RuleBasedTimeZone)other; // initial rule if (!initialRule.IsEquivalentTo(otherRBTZ.initialRule)) { return(false); } // final rules if (finalRules != null && otherRBTZ.finalRules != null) { for (int i = 0; i < finalRules.Length; i++) { if (finalRules[i] == null && otherRBTZ.finalRules[i] == null) { continue; } if (finalRules[i] != null && otherRBTZ.finalRules[i] != null && finalRules[i] .IsEquivalentTo(otherRBTZ.finalRules[i])) { continue; } return(false); } } else if (finalRules != null || otherRBTZ.finalRules != null) { return(false); } // historic rules if (historicRules != null && otherRBTZ.historicRules != null) { if (historicRules.Count != otherRBTZ.historicRules.Count) { return(false); } IIterator it = new ILOG.J2CsMapping.Collections.IteratorAdapter(historicRules.GetEnumerator()); while (it.HasNext()) { TimeZoneRule rule = (TimeZoneRule)it.Next(); IIterator oit = new ILOG.J2CsMapping.Collections.IteratorAdapter(otherRBTZ.historicRules.GetEnumerator()); bool foundSameRule = false; while (oit.HasNext()) { TimeZoneRule orule = (TimeZoneRule)oit.Next(); if (rule.IsEquivalentTo(orule)) { foundSameRule = true; break; } } if (!foundSameRule) { return(false); } } } else if (historicRules != null || otherRBTZ.historicRules != null) { return(false); } return(true); }