choco.kernel.common.util.tools
Class ArrayUtils

java.lang.Object
  extended by choco.kernel.common.util.tools.ArrayUtils

public final class ArrayUtils
extends Object


Method Summary
static
<T> T[]
append(T[]... toAppend)
          Append two Arrays
static
<T> boolean
contains(T[] array, T obj)
           
static int[] createNonRedundantSortedValues(gnu.trove.TIntArrayList values)
           
static int[] flatten(int[][] matrix)
           
static
<T> T[]
flatten(T[][] matrix)
           
static
<T> T[]
flattenSubMatrix(int iMin, int iLength, int jMin, int jLength, T[][] matrix)
           
static
<T> T
get(int index, List<T>... arrays)
           
static
<T> T
get(int index, T[]... arrays)
           
static
<T> T[]
getColumn(T[][] array, int column)
           
static
<V extends IIndex>
V[]
getNonRedundantObjects(Class classe, V[] all)
           
static
<V extends IIndex>
V[]
getNonRedundantObjects(V[] all)
           
static int[] getNonRedundantSortedValues(int[] values)
          create a new array which contains sorted distinct values;
static int[] getNonRedundantSortedValues(gnu.trove.TIntArrayList values)
          create an array which contains sorted distinct values. do not modify the original list
static void inverseSign(int[] tab)
          Reverse all signs of the a given int table.
static
<T> int
length(T[]... arrays)
           
static int[] linspace(int begin, int end)
           
static int[] oneToN(int n)
           
static
<T> void
permutation(int[] permutation, T[] tab)
          apply a permuation on an array
static void reverse(int[] tab)
           
static
<T> void
reverse(T[] tab)
           
static
<T extends Comparable<T>>
T[]
sort(Set<T> set)
           
static int[][][] swallowCopy(int[][][] arr)
           
static int[][][][] swallowCopy(int[][][][] arr)
           
static
<T> T[]
toArray(ArrayList<T> list)
           
static
<T> T[]
toArray(Class c, List<T> list)
           
static
<T> List<T>
toList(T[] array)
           
static int[][] transpose(int[][] matrix)
           
static
<T> T[][]
transpose(T[][] matrix)
           
static int[] zeroToN(int n)
           
static int[] zeroToNShuffle(int nb)
           
static int[] zeroToNShuffle(int nb, long seed)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

zeroToN

public static int[] zeroToN(int n)

oneToN

public static int[] oneToN(int n)

linspace

public static int[] linspace(int begin,
                             int end)

getColumn

public static <T> T[] getColumn(T[][] array,
                                int column)

length

public static <T> int length(T[]... arrays)

contains

public static <T> boolean contains(T[] array,
                                   T obj)

get

public static <T> T get(int index,
                        T[]... arrays)

get

public static <T> T get(int index,
                        List<T>... arrays)

append

public static <T> T[] append(T[]... toAppend)
Append two Arrays

Parameters:
toAppend - array of arrays to append
Returns:
a new Array composed of both given in parameters.

inverseSign

public static void inverseSign(int[] tab)
Reverse all signs of the a given int table.

Parameters:
tab - array to inverse

reverse

public static void reverse(int[] tab)

reverse

public static <T> void reverse(T[] tab)

permutation

public static <T> void permutation(int[] permutation,
                                   T[] tab)
apply a permuation on an array


toList

public static <T> List<T> toList(T[] array)

toArray

public static <T> T[] toArray(Class c,
                              List<T> list)

toArray

public static <T> T[] toArray(ArrayList<T> list)

transpose

public static <T> T[][] transpose(T[][] matrix)

transpose

public static int[][] transpose(int[][] matrix)

flatten

public static <T> T[] flatten(T[][] matrix)

flattenSubMatrix

public static <T> T[] flattenSubMatrix(int iMin,
                                       int iLength,
                                       int jMin,
                                       int jLength,
                                       T[][] matrix)

flatten

public static int[] flatten(int[][] matrix)

getNonRedundantSortedValues

public static int[] getNonRedundantSortedValues(int[] values)
create a new array which contains sorted distinct values;

Parameters:
values -
Returns:

getNonRedundantSortedValues

public static int[] getNonRedundantSortedValues(gnu.trove.TIntArrayList values)
create an array which contains sorted distinct values. do not modify the original list


createNonRedundantSortedValues

public static int[] createNonRedundantSortedValues(gnu.trove.TIntArrayList values)

getNonRedundantObjects

public static <V extends IIndex> V[] getNonRedundantObjects(V[] all)

getNonRedundantObjects

public static <V extends IIndex> V[] getNonRedundantObjects(Class classe,
                                                            V[] all)

sort

public static <T extends Comparable<T>> T[] sort(Set<T> set)

swallowCopy

public static int[][][][] swallowCopy(int[][][][] arr)

swallowCopy

public static int[][][] swallowCopy(int[][][] arr)

zeroToNShuffle

public static int[] zeroToNShuffle(int nb)

zeroToNShuffle

public static int[] zeroToNShuffle(int nb,
                                   long seed)


Copyright © 2012. All Rights Reserved.