Here you can find the source of swap(long[] keys, double[] values, int i, int j)
Parameter | Description |
---|---|
keys | a parameter |
values | a parameter |
i | a parameter |
j | a parameter |
private static final void swap(long[] keys, double[] values, int i, int j)
//package com.java2s; //License from project: Open Source License public class Main { /**//www .j a v a 2 s .co m * Swaps the keys and values at {@code i} with those at {@code j} * * @param keys * @param values * @param i * @param j */ private static final void swap(long[] keys, double[] values, int i, int j) { long keySwap = keys[i]; keys[i] = keys[j]; keys[j] = keySwap; double swapValue = values[i]; values[i] = values[j]; values[j] = swapValue; } /** * Swaps the keys and values at {@code i} with those at {@code j} * * @param keys * @param values * @param i * @param j */ private static final void swap(int[] keys, int[] values, int i, int j) { int keySwap = keys[i]; keys[i] = keys[j]; keys[j] = keySwap; int swapValue = values[i]; values[i] = values[j]; values[j] = swapValue; } /** * Swaps the keys and values at {@code i} with those at {@code j} * * @param keys * @param values * @param i * @param j */ private static final <T> void swap(int[] keys, T[] values, int i, int j) { int keySwap = keys[i]; keys[i] = keys[j]; keys[j] = keySwap; T swapValue = values[i]; values[i] = values[j]; values[j] = swapValue; } /** * Swaps the keys and values at {@code i} with those at {@code j} * * @param keys * @param values * @param i * @param j */ private static final void swap(int[] keys, Object[][] values, int i, int j) { int keySwap = keys[i]; keys[i] = keys[j]; keys[j] = keySwap; Object swapValue; for (int k = 0; k < values.length; k++) { swapValue = values[k][i]; values[k][i] = values[k][j]; values[k][j] = swapValue; } } /** * Swaps the keys and values at {@code i} with those at {@code j} * * @param keys * @param values * @param i * @param j */ private static final <T> void swap(long[] keys, T[] values, double[] probs, int i, int j) { long keySwap = keys[i]; keys[i] = keys[j]; keys[j] = keySwap; T swapValue = values[i]; values[i] = values[j]; values[j] = swapValue; double swapProb = probs[i]; probs[i] = probs[j]; probs[j] = swapProb; } }