Package Utils

Class SortByIndexDouble

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.Integer>

    public class SortByIndexDouble
    extends java.lang.Object
    implements java.util.Comparator<java.lang.Integer>
    Comparator to sort integer indicies based on the corresponding value in a double array.
    • Constructor Summary

      Constructors 
      Constructor Description
      SortByIndexDouble​(double[] values)
      Constructor.
      SortByIndexDouble​(double[] values, boolean reverse)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.Integer i, java.lang.Integer j)  
      java.lang.Integer[] sort()
      Produce a sorted list of indicies for the entire array
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • SortByIndexDouble

        public SortByIndexDouble​(double[] values)
        Constructor. Defaults to sorting in standard order.
        Parameters:
        values - The double array used to sort the indicies
      • SortByIndexDouble

        public SortByIndexDouble​(double[] values,
                                 boolean reverse)
        Constructor. Can sort in either standard or reverse order.
        Parameters:
        values - The double array used to sort the indicies
        reverse - If true sorts in reverse order
    • Method Detail

      • compare

        public int compare​(java.lang.Integer i,
                           java.lang.Integer j)
        Specified by:
        compare in interface java.util.Comparator<java.lang.Integer>
      • sort

        public java.lang.Integer[] sort()
        Produce a sorted list of indicies for the entire array
        Returns:
        Sorted list of indicies