Packageorg.as3coreaddendum.system.comparators
Classpublic class PriorityIndexComparator
InheritancePriorityIndexComparator Inheritance Object
Implements IComparator

A comparator for objects that implements the org.as3coreaddendum.system.IPriority and org.as3coreaddendum.system.IIndexable interfaces, comparing the priority and index properties.

This comparator is util when you want to sort the objects by priority, but if the priority of the two objects are equal, the index property of the objects are compared to decide wich object comes before.

See also

IComparator
IIndexable
IPriority


Public Methods
 MethodDefined By
  
Constructor, creates a new PriorityIndexComparator object.
PriorityIndexComparator
  
compare(o1:*, o2:*):int
Performs the comparison between the two arguments.
PriorityIndexComparator
Constructor Detail
PriorityIndexComparator()Constructor
public function PriorityIndexComparator()

Constructor, creates a new PriorityIndexComparator object.

Method Detail
compare()method
public function compare(o1:*, o2:*):int

Performs the comparison between the two arguments.

Parameters

o1:* — The first Number object to be compared.
 
o2:* — The second Number object to be compared.

Returns
int — A negative integer or a positive integer as the priority of the first argument is greater than or less than the second. If the priority of the arguments are equal, returns a negative integer, zero, or a positive integer as the index of the first argument is less than, equal to, or greater than the second.

Throws
ArgumentError — if any of the arguments does not implements the IPriority or IIndexable interfaces.