org.eclipse.wst.jsdt.ui.text.java

## Class AbstractProposalSorter

- java.lang.Object
- - org.eclipse.wst.jsdt.ui.text.java.AbstractProposalSorter

All Implemented Interfaces:
  java.util.Comparator

    public abstract class AbstractProposalSorter
    extends java.lang.Object
    implements java.util.Comparator

Abstract base class for sorters contributed to the `org.eclipse.wst.jsdt.ui.javaCompletionProposalSorters` extension point.

Subclasses need to implement `compare(ICompletionProposal, ICompletionProposal)` and may override `beginSorting` and `endSorting`.

The orderings imposed by a subclass need not be consistent with equals.

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

### Constructor Summary

Constructors
`protected` `AbstractProposalSorter()` Creates a new sorter.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `beginSorting(ContentAssistInvocationContext context)` Called once before sorting.
`abstract int` `compare(ICompletionProposal p1, ICompletionProposal p2)` Implements the same contract as `Comparator.compare(Object, Object)` but with completion proposals as parameters.
`void` `endSorting()` Called once after sorting.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Constructor Detail

#### AbstractProposalSorter

    protected AbstractProposalSorter()

Creates a new sorter. Note that subclasses must provide a zero-argument constructor to be instantiatable via `org.eclipse.core.runtime.IConfigurationElement#createExecutableExtension(String)`.

### Method Detail

#### beginSorting

    public void beginSorting(ContentAssistInvocationContext context)

Called once before sorting.

Clients may override, the default implementation does nothing.

Parameters:
  `context` - the context of the content assist invocation

#### compare

    public abstract int compare(ICompletionProposal p1,
                                ICompletionProposal p2)

Implements the same contract as `Comparator.compare(Object, Object)` but with completion proposals as parameters. This method will implement the `Comparator` interface if this class is ever converted to extend `Comparator<ICompletionProposal>`.

The orderings imposed by an implementation need not be consistent with equals.

Specified by:
  `compare` in interface `java.util.Comparator`
Parameters:
  `p1` - the first proposal to be compared
  `p2` - the second proposal to be compared
Returns:
  a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

#### endSorting

    public void endSorting()

Called once after sorting.

Clients may override, the default implementation does nothing.