org.deidentifier.arx.framework.check.distribution

## Class Distribution

- java.lang.Object
- - org.deidentifier.arx.framework.check.distribution.Distribution

    public class Distribution
    extends java.lang.Object

This class can be utilized to track the distributions of values. It is backed by a hash table implementing open addressing with linear probing.

Author:
  Fabian Prasser, Florian Kohlmayer

### Constructor Summary

Constructors
Constructor and Description
`Distribution()` Default constructor.
`Distribution(int[] element, int[] frequency)` Constructor used to create frequency set from a history entry.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add(int element)` Adds a element to the hashtable.
`void` `add(int element, int value)` Adds an element with the given frequency.
`void` `clear()` Clears the table.
`int[]` `getBuckets()` Gets all buckets of the hash table.
`void` `merge(Distribution other)` Merges two frequency sets.
`void` `merge(int[] elements, int[] frequency)` Merge a frequency set with a history entry.
`int[][]` `pack()` Packs the frequency table; removes null values and generates sortedElements and sortedFrequency arrays.
`int` `size()` Gets the current size.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Distribution

    public Distribution()

Default constructor.

#### Distribution

    public Distribution(int[] element,
                        int[] frequency)

Constructor used to create frequency set from a history entry.

Parameters:
  `element` -
  `frequency` -

### Method Detail

#### add

    public final void add(int element)

Adds a element to the hashtable. Frequency value 1.

Parameters:
  `element` -

#### add

    public void add(int element,
                    int value)

Adds an element with the given frequency.

Parameters:
  `element` -
  `value` -

#### clear

    public void clear()

Clears the table.

#### getBuckets

    public int[] getBuckets()

Gets all buckets of the hash table.

Returns:

#### merge

    public void merge(Distribution other)

Merges two frequency sets.

Parameters:
  `other` -

#### merge

    public void merge(int[] elements,
                      int[] frequency)

Merge a frequency set with a history entry.

Parameters:
  `elements` -
  `frequency` -

#### pack

    public int[][] pack()

Packs the frequency table; removes null values and generates sortedElements and sortedFrequency arrays. In case a collission occured this method also sorts the elements. First entry is elements, second entry is frequencies.

#### size

    public int size()

Gets the current size.

Returns:

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`