org.omnaest.utils.sorting
Class SortUtil

java.lang.Object
  extended by org.omnaest.utils.sorting.SortUtil

public class SortUtil
extends Object


Nested Class Summary
static interface SortUtil.ArbitraryStructureContext
          Used by merge sort, to determin the index position start and end points.
static interface SortUtil.ComparableArbitraryStructureIndexPosition
          Used within the merge sort core to compare two indexPositions.
static interface SortUtil.MergeSortDataModify
          Used with merge sort.
 
Constructor Summary
SortUtil()
           
 
Method Summary
static void mergeSort(SortUtil.ArbitraryStructureContext arbitraryStructureContext, SortUtil.ComparableArbitraryStructureIndexPosition comparableArbitraryStructureIndexPosition, SortUtil.MergeSortDataModify mergeSortDataModify, boolean ascending)
          Sorts a given arbitrary structure with a mergesort algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortUtil

public SortUtil()
Method Detail

mergeSort

public static void mergeSort(SortUtil.ArbitraryStructureContext arbitraryStructureContext,
                             SortUtil.ComparableArbitraryStructureIndexPosition comparableArbitraryStructureIndexPosition,
                             SortUtil.MergeSortDataModify mergeSortDataModify,
                             boolean ascending)
Sorts a given arbitrary structure with a mergesort algorithm.
The necessary access to the arbitrary structure is the possibility to push (elements of an) index position to a stack, where by this have to implemented by the client application.
Also there have to be an index range with uninterrupted range of index positions, and there have to be a metric by a comparison implied. Both have to be implemented by the client application, too.

Parameters:
arbitraryStructureContext -
comparableArbitraryStructureIndexPosition -
mergeSortDataModify -
ascending - if true, the list will be sorted ascending, if false descending
See Also:
SortUtil.ArbitraryStructureContext, SortUtil.ComparableArbitraryStructureIndexPosition, SortUtil.MergeSortDataModify


Copyright © 2013. All Rights Reserved.