Sorts this table into a new table on the columns indexed
<p>
if index is negative then sort that column in decending order otherwise sort ascending
776752
public Table sortOn(int... columnIndexes) {
        List<String> names = new ArrayList<>();
        for (int i : columnIndexes) {
            if (i >= 0) {
                names.add(columnList.get(i).name());
            } else {
                names.add("-" + columnList.get(-i).name());
            }
        }
        return sortOn(names.toArray(new String[names.size()]));
    }
32475
private void moveRowsBasedOnPriority() {
        for (RowNumber myNumber : overs.keySet()) {
            Over over = overs.get(myNumber);

            int newIndex = rowOrder.indexOf(new RowNumber(over.getOver()));

            rowOrder.remove(myNumber);
            rowOrder.add(newIndex,
                         myNumber);
        }
    }
1092697
def sort(self, column, order=Qt.AscendingOrder):
        """"""
        ascending = order == Qt.AscendingOrder
        self.model.sort(self.COLUMN_INDEX, order=ascending)
        return True
500572
public Comparator<Columns> comparator() {
        return new Comparator<Columns>() {
            public int compare(Columns o1, Columns o2) {

                if (o1 == null) {
                    return o2 == null ? 0 : 1;
                }
                if (o2 == null) {
                    return -1;
                }

                Column column1 = o1.getColumn(field);
                Column column2 = o2.getColumn(field);

                if (column1 == null) {
                    return column2 == null ? 0 : 1;
                }
                if (column2 == null) {
                    return -1;
                }

                AbstractType<?> type = column1.getType();
                ByteBuffer value1 = column1.getDecomposedValue();
                ByteBuffer value2 = column2.getDecomposedValue();
                return reverse ? type.compare(value2, value1) : type.compare(value1, value2);
            }
        };
    }
103277
public static void sortDescending(byte[] byteArray) {
        int index = 0;
        byte value = 0;
        
        for(int i = 1; i < byteArray.length; i++) {
            index = i;
            value = byteArray[index];
            
            while(index > 0 && value > byteArray[index - 1]) {
                byteArray[index] = byteArray[index - 1];
                
                index--;
            }
            
            byteArray[index] = value;
        }
    }
1061854
def sortByColumn(self, index, direction):
        
        if self.isPaged() and not self.isFullyLoaded():
            self.reorder(index, direction)
        else:
            super(XOrbTreeWidget, self).sortByColumn(index, direction)
1089958
final int getColumnPkeyIndex(int index) {
        if (m_extraMetadata != null) {
            for (int i = 0; i < m_extraMetadata.pkeyIndexes.length; i++) {
                if (m_extraMetadata.pkeyIndexes[i] == index) {
                    return i;
                }
            }
        }
        return -1;
    }
1000540
function getIndexOfColumn(tableStructure, column) {
  for (var i = 0; i < tableStructure.columns.length; i++) {
    if (tableStructure.columns[i] === column) {
      return i;
    }
  }
}
578404
protected void setSort(final int index, final boolean ascending) {
		WTableComponentModel model = getOrCreateComponentModel();
		model.sortColIndex = index;
		model.sortAscending = ascending;
	}
994333
private synchronized void sortCells()
    {
        if (isSorted)
            return; // Just sorted by a previous call

        Comparator<Cell> comparator = reversed
                                    ? getComparator().columnReverseComparator()
                                    : getComparator().columnComparator(false);

        // Sort the unsorted segment - will still potentially contain duplicate (non-reconciled) cells
        Arrays.sort(cells, sortedSize, size, comparator);

        // Determine the merge start position for that segment
        int pos = binarySearch(0, sortedSize, cells[sortedSize].name(), internalComparator());
        if (pos < 0)
            pos = -pos - 1;

        // Copy [pos, lastSortedCellIndex] cells into a separate array
        Cell[] leftCopy = pos == sortedSize
                        ? EMPTY_ARRAY
                        : Arrays.copyOfRange(cells, pos, sortedSize);

        // Store the beginning (inclusive) and the end (exclusive) indexes of the right segment
        int rightStart = sortedSize;
        int rightEnd = size;

        // 'Trim' the sizes to what's left without the leftCopy
        size = sortedSize = pos;

        // Merge the cells from both segments. When adding from the left segment we can rely on it not having any
        // duplicate cells, and thus omit the comparison with the previously entered cell - we'll never need to reconcile.
        int l = 0, r = rightStart;
        while (l < leftCopy.length && r < rightEnd)
        {
            int cmp = comparator.compare(leftCopy[l], cells[r]);
            if (cmp < 0)
                append(leftCopy[l++]);
            else if (cmp == 0)
                append(leftCopy[l++].reconcile(cells[r++]));
            else
                appendOrReconcile(cells[r++]);
        }
        while (l < leftCopy.length)
            append(leftCopy[l++]);
        while (r < rightEnd)
            appendOrReconcile(cells[r++]);

        // Nullify the remainder of the array (in case we had duplicate cells that got reconciled)
        for (int i = size; i < rightEnd; i++)
            cells[i] = null;

        // Fully sorted at this point
        isSorted = true;
    }
418149
def resort(self, attributeID, isAscending=None):
        
        if isAscending is None:
            isAscending = self.defaultSortAscending

        newSortColumn = self.columns[attributeID]
        if newSortColumn.sortAttribute() is None:
            raise Unsortable('column %r has no sort attribute' % (attributeID,))
        if self.currentSortColumn == newSortColumn:
            # if this query is to be re-sorted on the same column, but in the
            # opposite direction to our last query, then use the first item in
            # the result set as the marker
            if self.isAscending == isAscending:
                offset = 0
            else:
                # otherwise use the last
                offset = -1
        else:
            offset = 0
            self.currentSortColumn = newSortColumn
        self.isAscending = isAscending
        self._updateResults(self._sortAttributeValue(offset), True)
1365665
private void dropInvertedIndexTable(TableInfo tableInfo)
    {
        boolean indexTableRequired = CassandraPropertyReader.csmd.isInvertedIndexingEnabled(databaseName)/* ) */
                && !tableInfo.getEmbeddedColumnMetadatas().isEmpty();
        if (indexTableRequired)
        {
            try
            {
                cassandra_client.system_drop_column_family(tableInfo.getTableName() + Constants.INDEX_TABLE_SUFFIX);
            }
            catch (Exception ex)
            {
                if (log.isWarnEnabled())
                {
                    log.warn("Error while dropping inverted index table, Caused by: ", ex);
                }
            }
        }
    }
590493
private void sortByName() {
		this.sresList.setComparator(new ViewerComparator() {
			@Override
			public int compare(Viewer viewer, Object e1, Object e2) {
				if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) {
					final ISREInstall left = (ISREInstall) e1;
					final ISREInstall right = (ISREInstall) e2;
					return left.getName().compareToIgnoreCase(right.getName());
				}
				return super.compare(viewer, e1, e2);
			}

			@Override
			public boolean isSorterProperty(Object element, String property) {
				return true;
			}
		});
		this.sortColumn = Column.NAME;
	}
1250182
public int columnIndex(String columnName) {
        int columnIndex = -1;
        for (int i = 0; i < columnList.size(); i++) {
            if (columnList.get(i).name().equalsIgnoreCase(columnName)) {
                columnIndex = i;
                break;
            }
        }
        if (columnIndex == -1) {
            throw new IllegalArgumentException(String.format("Column %s is not present in table %s", columnName, name));
        }
        return columnIndex;
    }
994559
function sortedIndex(element) {
    /* jshint validthis:true */
    var index = binarySearch(toArray(this), element, this.comparator);

    if (index < 0) {
        // binarySearch decreases the negative index by one because otherwise the index 0 would stand for two results
        // @see https://github.com/darkskyapp/binary-search/issues/1
        return Math.abs(index) - 1;
    } else {
        return index;
    }
}
484971
public void order() {
        Collections.sort(cells, new Comparator<SortedSet<Integer>>() {

            @Override
            public int compare(SortedSet<Integer> cellA, SortedSet<Integer> cellB) {
                return cellA.first().compareTo(cellB.first());
            }

        });
    }
86083
public Table sortDescendingOn(String... columnNames) {
        Sort key = getSort(columnNames);
        return sortOn(key);
    }