org.eclipse.mylar.internal.monitor.reports
Class InteractionEventSummarySorter

java.lang.Object
  extended by org.eclipse.jface.viewers.ViewerComparator
      extended by org.eclipse.jface.viewers.ViewerSorter
          extended by org.eclipse.mylar.internal.monitor.reports.InteractionEventSummarySorter

public class InteractionEventSummarySorter
extends org.eclipse.jface.viewers.ViewerSorter

Sorts SingleSummary objects based on type, id, name, or usage count.


Field Summary
private  int criteria
           
static int ID
           
static int NAME
           
static int TYPE
          Constructor argument values that indicate to sort items by different columns.
static int USAGE_COUNT
           
 
Fields inherited from class org.eclipse.jface.viewers.ViewerSorter
collator
 
Constructor Summary
InteractionEventSummarySorter(int criteria)
          Creates a resource sorter that will use the given sort criteria.
 
Method Summary
 int compare(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object obj1, java.lang.Object obj2)
           
protected  int compareNames(InteractionEventSummary summary1, InteractionEventSummary summary2)
          Returns a number reflecting the collation order of the given summaries based on their names.
protected  int compareTypes(InteractionEventSummary summary1, InteractionEventSummary summary2)
          Returns a number reflecting the collation order of the given summaries based on their types.
private  int compareUsageCount(InteractionEventSummary summary1, InteractionEventSummary summary2)
          Returns a number reflecting the collation order of the given summaries based on their usage count.
 int getCriteria()
          Returns the sort criteria of this this sorter.
 
Methods inherited from class org.eclipse.jface.viewers.ViewerSorter
getCollator, getComparator
 
Methods inherited from class org.eclipse.jface.viewers.ViewerComparator
category, isSorterProperty, sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final int TYPE
Constructor argument values that indicate to sort items by different columns.

See Also:
Constant Field Values

ID

public static final int ID
See Also:
Constant Field Values

NAME

public static final int NAME
See Also:
Constant Field Values

USAGE_COUNT

public static final int USAGE_COUNT
See Also:
Constant Field Values

criteria

private int criteria
Constructor Detail

InteractionEventSummarySorter

public InteractionEventSummarySorter(int criteria)
Creates a resource sorter that will use the given sort criteria.

Parameters:
criteria - the sort criterion to use: one of NAME or TYPE
Method Detail

compare

public int compare(org.eclipse.jface.viewers.Viewer viewer,
                   java.lang.Object obj1,
                   java.lang.Object obj2)
Overrides:
compare in class org.eclipse.jface.viewers.ViewerComparator

compareUsageCount

private int compareUsageCount(InteractionEventSummary summary1,
                              InteractionEventSummary summary2)
Returns a number reflecting the collation order of the given summaries based on their usage count.

Parameters:
summary1 -
summary2 -
Returns:
a negative number if the first element is less than the second element; the value 0 if the first element is equal to the second element; and a positive number if the first element is greater than the second element

compareNames

protected int compareNames(InteractionEventSummary summary1,
                           InteractionEventSummary summary2)
Returns a number reflecting the collation order of the given summaries based on their names.

Parameters:
summary1 - the first task element to be ordered
summary2 - the second task element to be ordered
Returns:
a negative number if the first element is less than the second element; the value 0 if the first element is equal to the second element; and a positive number if the first element is greater than the second element

compareTypes

protected int compareTypes(InteractionEventSummary summary1,
                           InteractionEventSummary summary2)
Returns a number reflecting the collation order of the given summaries based on their types.

Parameters:
summary1 - the first task element to be ordered
summary2 - the second task element to be ordered
Returns:
a negative number if the first element is less than the second element; the value 0 if the first element is equal to the second element; and a positive number if the first element is greater than the second element

getCriteria

public int getCriteria()
Returns the sort criteria of this this sorter.

Returns:
the sort criterion