IComparer Interface
Use this Interface to define how a container of objects can be sorted. Containers like ObjectArray and ObjectCollection can be sorted when they get a reference to a class that implements IComparer.
Note:Interfaces don't actually do anything. A Interface is just a promise of what methods a implementor of a interface will have.
Methods
Compare | Implement this method to have a valid class that implements the IComparer Interface.
The implemented method should return:
-1 if object a < object b
1 if object a > object b
0 if object a = object b
So what needs to be done is
if(object a < object b) then
return -1
elseif(object a > object b) then
return 1
else
return 0
end if |
[Footnote]
Supported Platforms:
MacOS X CarbonMacOS X Cocoa 32 bitMacOS X Cocoa 64 bitWindows 32 bitWindows 64 bitLinux 32 bitLinux 64 bitLinux ARM