public static abstract class

DataTransferer.IndexedComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ sun.awt.datatransfer.DataTransferer.IndexedComparator
Known Direct Subclasses

Class Overview

A Comparator which includes a helper function for comparing two Objects which are likely to be keys in the specified Map.

Summary

Constants
boolean SELECT_BEST The best Object (e.g., DataFlavor) will be the last in sequence.
boolean SELECT_WORST The best Object (e.g., DataFlavor) will be the first in sequence.
Fields
protected final boolean order
Public Constructors
DataTransferer.IndexedComparator()
DataTransferer.IndexedComparator(boolean order)
Protected Methods
static int compareIndices(Map indexMap, Object obj1, Object obj2, Integer fallbackIndex)
Helper method to compare two objects by their Integer indices in the given map.
static int compareLongs(Map indexMap, Object obj1, Object obj2, Long fallbackIndex)
Helper method to compare two objects by their Long indices in the given map.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Constants

public static final boolean SELECT_BEST

The best Object (e.g., DataFlavor) will be the last in sequence.

Constant Value: true

public static final boolean SELECT_WORST

The best Object (e.g., DataFlavor) will be the first in sequence.

Constant Value: false

Fields

protected final boolean order

Public Constructors

public DataTransferer.IndexedComparator ()

public DataTransferer.IndexedComparator (boolean order)

Protected Methods

protected static int compareIndices (Map indexMap, Object obj1, Object obj2, Integer fallbackIndex)

Helper method to compare two objects by their Integer indices in the given map. If the map doesn't contain an entry for either of the objects, the fallback index will be used for the object instead.

Parameters
indexMap the map which maps objects into Integer indexes.
obj1 the first object to be compared.
obj2 the second object to be compared.
fallbackIndex the Integer to be used as a fallback index.
Returns
  • a negative integer, zero, or a positive integer as the first object is mapped to a less, equal to, or greater index than the second.

protected static int compareLongs (Map indexMap, Object obj1, Object obj2, Long fallbackIndex)

Helper method to compare two objects by their Long indices in the given map. If the map doesn't contain an entry for either of the objects, the fallback index will be used for the object instead.

Parameters
indexMap the map which maps objects into Long indexes.
obj1 the first object to be compared.
obj2 the second object to be compared.
fallbackIndex the Long to be used as a fallback index.
Returns
  • a negative integer, zero, or a positive integer as the first object is mapped to a less, equal to, or greater index than the second.