LComparator is a PowerPlant class that is used for comparing objects. Comparators are objects that know how to compare to other objects or structures.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
Subclasses will need to implement the Compare() method. The compare Compare() result should be one of the following:
Purpose:
The constructor is a placeholder, it doesn't do anything for this class.
Access:
Prototype:
LComparator();Parameters:
Purpose:
The destructor is a placeholder, it doesn't do anything for this class.
Access:
Prototype:
~LComparator();
Purpose:
This method simply creates this object by calling new.
Access:
Prototype:
virtual LComparator* Clone();Parameters:
Return:
A pointer to a new comparator object.
Purpose:
This method takes two pointers to data blocks, and their sizes, and determines what the result of the comparison should be.
Access:
Prototype:
virtual SInt32 Compare(Parameters:
const void* inItemOne,
const void* inItemTwo,
USInt32 inSizeOne,
USInt32 inSizeTwo ) const;
This method has the following parameters:
Return:
SInt32 that indicates one of the following:
< 0 - object/data item 1 is less than object/data item 2 0 - object/data item 1 is equal to object/data item 2 > 0 -þobject/data item 1 is greater than object/data item 2
Purpose:
This method is not yet implemented.
Access:
Prototype:
virtual SInt32 CompareToKey(Parameters:
const void* inItem,
USInt32 inSize,
const void* inKey) const;
This method has the following parameters:
Return:
Purpose:
This method is an accessor for sComparator. If sComparator does not yet exist, the object is created before returning from this method.
Access:
Prototype:
static LComparator* GetComparator();Parameters:
Return:
A pointer to sComparator.
Purpose:
This method detects whether two objects are equal.
Access:
Prototype:
virtual Boolean IsEqualTo(Parameters:
const void* inItemOne,
const void* inItemTwo,
USInt32 inSizeOne,
USInt32 inSizeTwo) const;
This method has the following parameters:
Return:
Boolean indicating true if the items are equal, false otherwise.
Purpose:
This method compares an item to the key to see if they are identical.
Access:
Prototype:
virtual Boolean IsEqualToKey(Parameterss:
const void* inItem,
USInt32 inSize,
const void* inKey) const;
This method has the following parameters:
Return:
Boolean indicating true if the items are equal, false otherwise.
Purpose:
This data member stores the pointer to the object we use as a standard for comparisons.
Access:
Prototype:
static LComparator* sComparator;