ICU-5454 Update argument of operator== in RuleBasedTimeZone, InitialTimeZoneRule, AnnualTimeZoneRule and TimeArrayTimeZoneRule to match their super class.

X-SVN-Rev: 21886
This commit is contained in:
Yoshito Umaoka 2007-07-02 14:56:08 +00:00
parent e1ee281cf9
commit 5c3732d32b
5 changed files with 55 additions and 49 deletions

View file

@ -306,7 +306,6 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial,
}
getTimeZoneRules(orgini, orgtrs, ruleCount, status);
if (U_FAILURE(status)) {
delete orgtrs;
goto error;
}
for (i = 0; i < ruleCount; i++) {
@ -316,6 +315,7 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial,
}
}
uprv_free(orgtrs);
orgtrs = NULL;
avail = getPreviousTransition(start, TRUE, tzt);
if (!avail) {

View file

@ -86,7 +86,7 @@ RuleBasedTimeZone::operator=(const RuleBasedTimeZone& right) {
}
UBool
RuleBasedTimeZone::operator==(const RuleBasedTimeZone& that) const {
RuleBasedTimeZone::operator==(const TimeZone& that) const {
if (this == &that) {
return TRUE;
}
@ -94,18 +94,19 @@ RuleBasedTimeZone::operator==(const RuleBasedTimeZone& that) const {
|| BasicTimeZone::operator==(that) == FALSE) {
return FALSE;
}
if (*fInitialRule != *(that.fInitialRule)) {
RuleBasedTimeZone *rbtz = (RuleBasedTimeZone*)&that;
if (*fInitialRule != *(rbtz->fInitialRule)) {
return FALSE;
}
if (compareRules(fHistoricRules, that.fHistoricRules)
&& compareRules(fFinalRules, that.fFinalRules)) {
if (compareRules(fHistoricRules, rbtz->fHistoricRules)
&& compareRules(fFinalRules, rbtz->fFinalRules)) {
return TRUE;
}
return FALSE;
}
UBool
RuleBasedTimeZone::operator!=(const RuleBasedTimeZone& that) const {
RuleBasedTimeZone::operator!=(const TimeZone& that) const {
return !operator==(that);
}

View file

@ -106,14 +106,14 @@ InitialTimeZoneRule::operator=(const InitialTimeZoneRule& right) {
}
UBool
InitialTimeZoneRule::operator==(const InitialTimeZoneRule& that) const {
InitialTimeZoneRule::operator==(const TimeZoneRule& that) const {
return ((this == &that) ||
(getDynamicClassID() == that.getDynamicClassID() &&
TimeZoneRule::operator==(that)));
}
UBool
InitialTimeZoneRule::operator!=(const InitialTimeZoneRule& that) const {
InitialTimeZoneRule::operator!=(const TimeZoneRule& that) const {
return !operator==(that);
}
@ -213,17 +213,21 @@ AnnualTimeZoneRule::operator=(const AnnualTimeZoneRule& right) {
}
UBool
AnnualTimeZoneRule::operator==(const AnnualTimeZoneRule& that) const {
return ((this == &that) ||
(getDynamicClassID() == that.getDynamicClassID() &&
TimeZoneRule::operator==(that) &&
fDateTimeRule == that.fDateTimeRule &&
fStartYear == that.fStartYear &&
fEndYear == that.fEndYear));
AnnualTimeZoneRule::operator==(const TimeZoneRule& that) const {
if (this == &that) {
return TRUE;
}
if (getDynamicClassID() != that.getDynamicClassID()) {
return FALSE;
}
AnnualTimeZoneRule *atzr = (AnnualTimeZoneRule*)&that;
return (*fDateTimeRule == *(atzr->fDateTimeRule) &&
fStartYear == atzr->fStartYear &&
fEndYear == atzr->fEndYear);
}
UBool
AnnualTimeZoneRule::operator!=(const AnnualTimeZoneRule& that) const {
AnnualTimeZoneRule::operator!=(const TimeZoneRule& that) const {
return !operator==(that);
}
@ -438,7 +442,7 @@ TimeArrayTimeZoneRule::operator=(const TimeArrayTimeZoneRule& right) {
}
UBool
TimeArrayTimeZoneRule::operator==(const TimeArrayTimeZoneRule& that) const {
TimeArrayTimeZoneRule::operator==(const TimeZoneRule& that) const {
if (this == &that) {
return TRUE;
}
@ -446,14 +450,15 @@ TimeArrayTimeZoneRule::operator==(const TimeArrayTimeZoneRule& that) const {
|| TimeZoneRule::operator==(that) == FALSE) {
return FALSE;
}
if (fTimeRuleType != that.fTimeRuleType ||
fNumStartTimes != that.fNumStartTimes) {
TimeArrayTimeZoneRule *tatzr = (TimeArrayTimeZoneRule*)&that;
if (fTimeRuleType != tatzr->fTimeRuleType ||
fNumStartTimes != tatzr->fNumStartTimes) {
return FALSE;
}
// Compare start times
UBool res = TRUE;
for (int32_t i = 0; i < fNumStartTimes; i++) {
if (fStartTimes[i] != that.fStartTimes[i]) {
if (fStartTimes[i] != tatzr->fStartTimes[i]) {
res = FALSE;
break;
}
@ -462,7 +467,7 @@ TimeArrayTimeZoneRule::operator==(const TimeArrayTimeZoneRule& that) const {
}
UBool
TimeArrayTimeZoneRule::operator!=(const TimeArrayTimeZoneRule& that) const {
TimeArrayTimeZoneRule::operator!=(const TimeZoneRule& that) const {
return !operator==(that);
}

View file

@ -58,24 +58,24 @@ public:
RuleBasedTimeZone& operator=(const RuleBasedTimeZone& right);
/**
* Return true if the given <code>RuleBasedTimeZone</code> objects are
* Return true if the given <code>TimeZone</code> objects are
* semantically equal. Objects of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given <code>RuleBasedTimeZone</code> objects are
* @return true if the given <code>TimeZone</code> objects are
*semantically equal.
* @draft ICU 3.8
*/
virtual UBool operator==(const RuleBasedTimeZone& that) const;
virtual UBool operator==(const TimeZone& that) const;
/**
* Return true if the given <code>RuleBasedTimeZone</code> objects are
* Return true if the given <code>TimeZone</code> objects are
* semantically unequal. Objects of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given <code>RuleBasedTimeZone</code> objects are
* @return true if the given <code>TimeZone</code> objects are
* semantically unequal.
* @draft ICU 3.8
*/
virtual UBool operator!=(const RuleBasedTimeZone& that) const;
virtual UBool operator!=(const TimeZone& that) const;
/**
* Adds the <code>TimeZoneRule</code> which represents time transitions.

View file

@ -46,19 +46,19 @@ public:
virtual TimeZoneRule* clone(void) const = 0;
/**
* Return true if the given TimeZoneRule objects are semantically equal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given TimeZoneRule objects are semantically equal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
* @draft ICU 3.8
*/
virtual UBool operator==(const TimeZoneRule& that) const;
/**
* Return true if the given TimeZoneRule objects are semantically unequal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given TimeZoneRule objects are semantically unequal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
* @draft ICU 3.8
*/
virtual UBool operator!=(const TimeZoneRule& that) const;
@ -237,22 +237,22 @@ public:
InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right);
/**
* Return true if the given InitialTimeZoneRule objects are semantically equal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given InitialTimeZoneRule objects are semantically equal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
* @draft ICU 3.8
*/
virtual UBool operator==(const InitialTimeZoneRule& that) const;
virtual UBool operator==(const TimeZoneRule& that) const;
/**
* Return true if the given InitialTimeZoneRule objects are semantically unequal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given InitialTimeZoneRule objects are semantically unequal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
* @draft ICU 3.8
*/
virtual UBool operator!=(const InitialTimeZoneRule& that) const;
virtual UBool operator!=(const TimeZoneRule& that) const;
/**
* Gets the time when this rule takes effect in the given year.
@ -448,22 +448,22 @@ public:
AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right);
/**
* Return true if the given AnnualTimeZoneRule objects are semantically equal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given AnnualTimeZoneRule objects are semantically equal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
* @draft ICU 3.8
*/
virtual UBool operator==(const AnnualTimeZoneRule& that) const;
virtual UBool operator==(const TimeZoneRule& that) const;
/**
* Return true if the given AnnualTimeZoneRule objects are semantically unequal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given AnnualTimeZoneRule objects are semantically unequal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
* @draft ICU 3.8
*/
virtual UBool operator!=(const AnnualTimeZoneRule& that) const;
virtual UBool operator!=(const TimeZoneRule& that) const;
/**
* Gets the start date/time rule used by this rule.
@ -665,22 +665,22 @@ public:
TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right);
/**
* Return true if the given TimeArrayTimeZoneRule objects are semantically equal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given TimeArrayTimeZoneRule objects are semantically equal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
* @draft ICU 3.8
*/
virtual UBool operator==(const TimeArrayTimeZoneRule& that) const;
virtual UBool operator==(const TimeZoneRule& that) const;
/**
* Return true if the given TimeArrayTimeZoneRule objects are semantically unequal. Objects
* Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
* of different subclasses are considered unequal.
* @param that The object to be compared with.
* @return true if the given TimeArrayTimeZoneRule objects are semantically unequal.
* @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
* @draft ICU 3.8
*/
virtual UBool operator!=(const TimeArrayTimeZoneRule& that) const;
virtual UBool operator!=(const TimeZoneRule& that) const;
/**
* Gets the time type of the start times used by this rule. The return value