All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jamonapi.utils.ArraySorter Maven / Gradle / Ivy

There is a newer version: 2.82
Show newest version
package com.jamonapi.utils;

import java.util.Arrays;

/**
 * ArraySorter is used to sort 2 dimensional arrays of objects by one of the columns in the array.  Right now this class
 * sorts only for the monitor report, but could be made more generic.
 *
 */
class ArraySorter {

    public ArraySorter(Object[][] array, int sortCol, String sortOrder) {
        this.array=array;
        this.sortCol=sortCol;
        this.sortOrder=sortOrder;
    }

    private Object[][] array;
    private int sortCol;
    private String sortOrder;

    private int getRows() {
        return array.length;
    }

    private int getCols() {
        return array[0].length;
    }

    private Object[] getArrayToSort() {

        Object[] arrayToSort=new Object[getRows()];
        for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy