org.statcato.utils
Class OrderingFunctions
- java.lang.Object
-
- org.statcato.utils.OrderingFunctions
-
public class OrderingFunctions extends java.lang.ObjectFunctions for ordering column cells.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description OrderingFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double[]rank(java.util.Vector<DataValue> data)Returns the ranks of the given DataValue objects.static java.util.Vector<java.lang.Integer>rankColumnVector(java.util.Vector<Cell> vec, boolean ascending)Given a vector of Cells and the sort order, return a vector of Integers that are the ranks of the Cells.static double[]rankDoubleVector(java.util.Vector<java.lang.Double> data)Returns the ranks of the given DataValue objects.static java.util.Vector<Cell>sortColumnVector(java.util.Vector<Cell> vec, java.util.Vector<Cell> byVec, boolean ascending)Sorts a vector of Cell based on another vector of Cell in the given order.static java.util.Vector<java.util.Vector<Cell>>sortVectors(java.util.Vector<java.util.Vector<Cell>> vecs, java.util.Vector<java.lang.Boolean> orders)Sorts a set of vectors in place, from the last vector in the set to the first.
-
-
-
Method Detail
-
rankColumnVector
public static java.util.Vector<java.lang.Integer> rankColumnVector(java.util.Vector<Cell> vec, boolean ascending)
Given a vector of Cells and the sort order, return a vector of Integers that are the ranks of the Cells. For ascending order, the smallest number has rank 0, and cells with higher order have increasing ranks. For descending order, the largest number has rank 0, and cells with lower order have increasing ranks. Empty cells have no rank.- Parameters:
vec- vector of Cell to be rankedascending- sort order- Returns:
- a vector of ranks
-
sortColumnVector
public static java.util.Vector<Cell> sortColumnVector(java.util.Vector<Cell> vec, java.util.Vector<Cell> byVec, boolean ascending)
Sorts a vector of Cell based on another vector of Cell in the given order.- Parameters:
vec- vector to be sortedbyVec- vector to sort byascending- sort order- Returns:
- a sorted vector of Cell
-
sortVectors
public static java.util.Vector<java.util.Vector<Cell>> sortVectors(java.util.Vector<java.util.Vector<Cell>> vecs, java.util.Vector<java.lang.Boolean> orders)
Sorts a set of vectors in place, from the last vector in the set to the first.- Parameters:
vecs- vector of vectors of cellsorders- vector of boolean values indicating the sort orders. Must have the same length asvec.- Returns:
- vector of vectors of cells that are sorted
-
rank
public static double[] rank(java.util.Vector<DataValue> data)
Returns the ranks of the given DataValue objects. Ranks are based on absolute values, and signs of data values are attached to their corresponding ranks. Mean ranks are assigned to tied data values.- Parameters:
data- vector of DataValue objects- Returns:
- array of ranks corresponding to the given data values (in the same order)
-
rankDoubleVector
public static double[] rankDoubleVector(java.util.Vector<java.lang.Double> data)
Returns the ranks of the given DataValue objects. Ranks are based on absolute values, and signs of data values are attached to their corresponding ranks. Mean ranks are assigned to tied data values.- Parameters:
data- vector of DataValue objects- Returns:
- array of ranks corresponding to the given data values (in the same order)
-
-
DMelt 3.0 © DataMelt by jWork.ORG