Package pl.put.poznan.transformer.logic
Class InsertSort
- java.lang.Object
-
- pl.put.poznan.transformer.logic.InsertSort
-
- All Implemented Interfaces:
SortAlgorithm
public class InsertSort extends Object implements SortAlgorithm
A class containing an implementation of insertion sort. Implements theSortAlgorithminterface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pl.put.poznan.transformer.logic.SortAlgorithm
SortAlgorithm.Order
-
-
Constructor Summary
Constructors Constructor Description InsertSort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleansort(Cell[][] tab, int column, int maxIter, SortAlgorithm.Order order)An in-place implementation of the insertion sort algorithm
-
-
-
Method Detail
-
sort
public boolean sort(Cell[][] tab, int column, int maxIter, SortAlgorithm.Order order)
An in-place implementation of the insertion sort algorithm- Specified by:
sortin interfaceSortAlgorithm- Parameters:
tab- a 2-D array of typeCellto be sorted.column- the index of the column which will be the sorting criteria.maxIter- maximum number of iterations. Value of-1means unlimited iterations,<-1means none.order- an enum Order value determining the sorting direction.- Returns:
- a boolean value of whether sorting could be completed in the given number of iterations.
-
-