org.eclipse.emf.emfstore.common.extensionpoint
Class ESPriorityComparator

java.lang.Object
  extended by org.eclipse.emf.emfstore.common.extensionpoint.ESPriorityComparator
All Implemented Interfaces:
Comparator<ESExtensionElement>

public final class ESPriorityComparator
extends Object
implements Comparator<ESExtensionElement>

A comparator for ESExtensionElement. This allows to sort the elements in the ESExtensionPoint in order to represent priority of registered elements. This comparator by default uses a field priority, which is expected to hold an priority number and then sort by by this number.

Author:
wesendon

Constructor Summary
ESPriorityComparator()
          Default constructor.
ESPriorityComparator(boolean descending)
          Constructor which allows to config the ordering.
ESPriorityComparator(String fieldname, boolean descending)
          Constructor allows to config fieldname and ordering.
 
Method Summary
 int compare(ESExtensionElement element1, ESExtensionElement element2)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ESPriorityComparator

public ESPriorityComparator()
Default constructor.


ESPriorityComparator

public ESPriorityComparator(boolean descending)
Constructor which allows to config the ordering.

Parameters:
descending - if true, priorities are sorted in descending order, ascending otherwise

ESPriorityComparator

public ESPriorityComparator(String fieldname,
                            boolean descending)
Constructor allows to config fieldname and ordering.

Parameters:
fieldname - the attribute id of the priority field
descending - if true, priorities are sorted in descending order, ascending otherwise
Method Detail

compare

public int compare(ESExtensionElement element1,
                   ESExtensionElement element2)

Specified by:
compare in interface Comparator<ESExtensionElement>


Copyright © 2015. All Rights Reserved.