Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Cyberdog Programmer's Kit / Part 3 - Cyberdog Reference
Chapter 7 - Classes and Methods / CyberItem


Compare

Compares this Cyberdog item with another Cyberdog item for equality.

CDCompareType Compare (in CyberItem compare);
compare
The CyberItem object to compare.
return value
The results of the comparison. Valid return values are kCICompareLessThan, kCICompareEqual, and kCICompareGreaterThan.
DISCUSSION
This method should compare this Cyberdog item with another Cyberdog item object for equality. The superclass implementation performs an ASCII comparison of the SOM class IDs of the two Cyberdog items. In some cases, that is sufficient to distinguish between them.

Therefore, the Compare method in a CyberItem subclass should first call its inherited Compare method. If the inherited Compare method indicates that the CyberItem objects are equal, then the comparison object is of the same class as the receiver. In this case, the subclass implementation should perform the additional computation necessary to establish a consistent ordering among the items.

The ordering of Cyberdog items in a Cyberdog item subclass is specified by the Cyberdog item developer. For example, a developer implementing a Cyberdog item subclass might order Cyberdog items of the subclass by performing an ASCII comparison of their URL strings.

This method should define a complete ordering among all Cyberdog items of the subclass. For example, for any two Cyberdog items A and B, A->Compare(B) must return a result consistent with the result of B->Compare(A). The ordering of Cyberdog items in a subclass should not be affected by other operations on Cyberdog items, such as opening, resolving, cloning, flattening, and unflattening.

If you subclass CyberItem, you must override this method. Your override must call its inherited method.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996