edu.ucla.util
Class IntArrays

Object
  extended by IntArrays

public class IntArrays
extends Object

A class consisting of static utility functions dealing with integer arrays.


Constructor Summary
IntArrays()
           
 
Method Summary
static int[] apply(int[] values, int[] inds)
          returns an array which is basically values[inds].
static int[] apply(int[] values, int[] inds, int[] result)
           
static int binarySearch(int value, int[] array, int minloc, int maxloc)
          searches for value in a sorted array between minloc and maxloc inclusive.
static String convertToString(int[] values)
           
static int[] index(int size)
          returns an array of length size where result[i]=i.
static void index(int[] values)
          Sets values[i]=i for all indices.
static Integer[] integerArray(int size)
           
static Integer[] integerIndex(int[] vals)
           
static void print(int[] values, PrintStream stream)
          displays the integer array on System.stream
static void println(int[] values, PrintStream stream)
          displays the integer array on System.stream
static void shuffle(int[] values)
          Will shuffle the values in the integer array.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntArrays

public IntArrays()
Method Detail

binarySearch

public static int binarySearch(int value,
                               int[] array,
                               int minloc,
                               int maxloc)
searches for value in a sorted array between minloc and maxloc inclusive. returns the location if found, else returns -(insertloc+1) where insertloc is the location it should be inserted into.


apply

public static int[] apply(int[] values,
                          int[] inds)
returns an array which is basically values[inds]. In other words, result[i]=values[inds[i]].


apply

public static int[] apply(int[] values,
                          int[] inds,
                          int[] result)

index

public static void index(int[] values)
Sets values[i]=i for all indices.


index

public static int[] index(int size)
returns an array of length size where result[i]=i.


convertToString

public static String convertToString(int[] values)

print

public static void print(int[] values,
                         PrintStream stream)
displays the integer array on System.stream


println

public static void println(int[] values,
                           PrintStream stream)
displays the integer array on System.stream


shuffle

public static void shuffle(int[] values)
Will shuffle the values in the integer array. See Collections.shuffle for a description of the algorithm.


integerIndex

public static Integer[] integerIndex(int[] vals)

integerArray

public static Integer[] integerArray(int size)


Copyright 2010 UCLA Automated Reasoning Group