Class Sort


  • public class Sort
    extends Object
    For sorting binnable data.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • Sort

        public Sort()
    • Method Detail

      • swap

        protected static <T> void swap​(List<Binnable<T>> list,
                                       int first,
                                       int second)
        Swaps two elements in the list.
        Parameters:
        first - the first list item
        second - the second list item
      • group

        public static <T> List<Binnable<T>> group​(List<Binnable<T>> data)
        Groups the binnable data in-place using its values. Based on Weka's sorting method in Instances#stratify(int), assuming that the values are discrete.
        Type Parameters:
        T - the payload type
        Parameters:
        data - the data to sort
        Returns:
        the grouped input list
      • sort

        public static <T> List<Binnable<T>> sort​(List<Binnable<T>> data)
        Sorts the binnable data in-place using its values.
        Type Parameters:
        T - the payload type
        Parameters:
        data - the data to sort
        Returns:
        the sorted input data