# GeneralizationHierarchy (ARX Developer Documentation)

org.deidentifier.arx.framework.data

## Class GeneralizationHierarchy

- java.lang.Object
- - org.deidentifier.arx.framework.data.GeneralizationHierarchy

-     public class GeneralizationHierarchy
      extends java.lang.Object

  The class GeneralizationHierarchy.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `attribute` Name.
    `protected int[]` | `distinctValues` Level->number of distinct values.
    `protected int[][]` | `map` Input->level->output.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GeneralizationHierarchy(java.lang.String name, int[][] map, int[] distinctValues)` Can be used to create a copy of the generalization hierarchy.
    `` | `GeneralizationHierarchy(java.lang.String name, java.lang.String[][] hierarchy, int dimension, Dictionary dictionary)` Creates a new generalization hierarchy.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkMonotonicity(DataManager manager)` Throws an exception, if the hierarchy is not monotonic.
    `int[][]` | `getArray()` Returns the array.
    `int[]` | `getDistinctValues()` Returns the number of distinct values.
    `int[]` | `getDistinctValues(int level)` Returns the distinct values.
    `int` | `getHeight()` Returns the height of the hierarchy.
    `java.lang.String` | `getName()` Returns the name.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### distinctValues

          protected final int[] distinctValues

      Level->number of distinct values.

    - #### map

          protected final int[][] map

      Input->level->output.

    - #### attribute

          protected final java.lang.String attribute

      Name.

  - ### Constructor Detail

    - #### GeneralizationHierarchy

          public GeneralizationHierarchy(java.lang.String name,
                                 java.lang.String[][] hierarchy,
                                 int dimension,
                                 Dictionary dictionary)

      Creates a new generalization hierarchy.
      Parameters:
        `name` -
        `hierarchy` -
        `dimension` -
        `dictionary` -

    - #### GeneralizationHierarchy

          protected GeneralizationHierarchy(java.lang.String name,
                                 int[][] map,
                                 int[] distinctValues)

      Can be used to create a copy of the generalization hierarchy.
      Parameters:
        `name` -
        `map` -
        `distinctValues` -

  - ### Method Detail

    - #### checkMonotonicity

          public void checkMonotonicity(DataManager manager)

      Throws an exception, if the hierarchy is not monotonic. TODO: This is a potentially expensive check that should be done when loading the hierarchy
      Parameters:
        `manager` -

    - #### getArray

          public int[][] getArray()

      Returns the array.
      Returns:

    - #### getDistinctValues

          public int[] getDistinctValues()

      Returns the number of distinct values.
      Returns:

    - #### getDistinctValues

          public int[] getDistinctValues(int level)

      Returns the distinct values.
      Parameters:
        `level` -
      Returns:

    - #### getHeight

          public int getHeight()

      Returns the height of the hierarchy.
      Returns:

    - #### getName

          public java.lang.String getName()

      Returns the name.
      Returns: