papaya
Class Unique

java.lang.Object
  extended by papaya.Unique

public class Unique
extends Object

Class for getting and storing an unsorted array's unique elements, the indices of these elements, and the number of times the elements occur.

This class is overkill if:
you want to store only the unique elements. Use a Java Set instead.
you don't want to store everything in a class. Use the Descriptive.frequencies(float[], java.util.ArrayList, java.util.ArrayList) method instead.


Field Summary
 ArrayList<Integer> frequencies
          ArrayList containing the frequencies of the corresponding unique value
 int[][] idx
          Class containing the integer arrays that hold the indices of each unique value.
 ArrayList<Float> values
          ArrayList containing the unique values
 
Constructor Summary
Unique(float[] data, boolean storeIndices)
          Class for storing the unique values in an unsorted data array.
 
Method Summary
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

public ArrayList<Float> values
ArrayList containing the unique values


frequencies

public ArrayList<Integer> frequencies
ArrayList containing the frequencies of the corresponding unique value


idx

public int[][] idx
Class containing the integer arrays that hold the indices of each unique value.

Constructor Detail

Unique

public Unique(float[] data,
              boolean storeIndices)
Class for storing the unique values in an unsorted data array. Does essentially the same thing as the Descriptive.frequencies method would, except:


- The input data array is unsorted.

- You can choose to store the indices of each unique value as well by setting the @param storeIndices to true.

- It (currently) only works for float arrays.

Example:

data = (8,5,6,7,8,5,5) --> values = (5,6,7,8), frequencies = (3,1,1,2), idx[0] = {1,5,6}, idx[1] = {2}, idx[2] = {3}, idx[3] = {0,4}

Parameters:
data - the data array
storeIndices - set to true if you want to store the indices, else set to false


Processing library papaya by Adila Faruk. (C) 2014