|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmckay.utilities.staticlibraries.SortingMethods
public class SortingMethods
A holder class for static methods relating to sorting.
Collator
Constructor Summary | |
---|---|
SortingMethods()
|
Method Summary | |
---|---|
static int[] |
getDoubleArraySortKey(double[] to_sort)
Takes in an array of doubles and returns an array holding the rankings from lowest (0) to highest (to_sort -1) of each entry from lowest to highest. |
static java.lang.String[] |
sortArray(java.lang.String[] original_strings)
Takes a String array and returns an alphabetically sorted copy of it. |
static double[] |
sortDoubleArray(double[] to_sort)
Takes in an array of doubles and returns a copy of the array sorted from lowest to highest. |
static int[] |
sortIntArray(int[] to_sort)
Takes in an array of ints and returns a copy of the array sorted from lowest to highest. |
static java.lang.String[][] |
sortTable(java.lang.String[][] original_table,
int column_to_sort_by,
int[] sorted_ordering)
Takes a two dimensional String array representing a table (column indice first, then row indice) and returns a copy of the table sorted by the data in the given column indice. |
static javax.swing.tree.DefaultMutableTreeNode |
sortTree(javax.swing.tree.DefaultMutableTreeNode root_unsorted_tree)
Takes the tree with the given root and reorders it so that all siblings are sorted alphebetically. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SortingMethods()
Method Detail |
---|
public static javax.swing.tree.DefaultMutableTreeNode sortTree(javax.swing.tree.DefaultMutableTreeNode root_unsorted_tree)
root_unsorted_tree
- The root of the tree to be sorted.
public static java.lang.String[] sortArray(java.lang.String[] original_strings)
original_strings
- The array to be sorted.
public static java.lang.String[][] sortTable(java.lang.String[][] original_table, int column_to_sort_by, int[] sorted_ordering)
The sorted_ordering array is filled to reflect the positions that the old rows were assigned to. This array should have the same size as the number of rows of the original_table parameter. The original values of the sorted_ordering array are irrelevant.
original_table
- The table to be sorted.column_to_sort_by
- The column to base the sort on.sorted_ordering
- The number position assigned to each row
after sorting.
public static double[] sortDoubleArray(double[] to_sort)
to_sort
- The data that is to be sorted.
public static int[] sortIntArray(int[] to_sort)
to_sort
- The data that is to be sorted.
public static int[] getDoubleArraySortKey(double[] to_sort)
to_sort
- The data that is to be sorted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |