# DataManager (ARX Developer Documentation)

org.deidentifier.arx.framework.data

## Class DataManager

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

- Direct Known Subclasses:
    DataManagerSubset

      public class DataManager
      extends java.lang.Object

  Holds all data needed for the anonymization process.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DataManager.AttributeTypeInternal` Internal representation of attribute types.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---

    `protected`

    `DataManager(DataDefinition definition, Data dataAnalyzed, Data dataGeneralized, Data dataStatic, java.lang.String[] header, GeneralizationHierarchy[] hierarchiesGeneralized, int[] hierarchiesHeights, java.util.Map<java.lang.String,GeneralizationHierarchy> hierarchiesSensitive, java.util.Map<java.lang.String,java.lang.Integer> indexesSensitive, int[] maxLevels, DistributionAggregateFunction[] microaggregationFunctions, java.lang.String[] microaggregationHeader, int[] microaggregationMap, int[] microaggregationDomainSizes, int microaggregationNumAttributes, int microaggregationStartIndex, int[] minLevels, java.util.Map<java.lang.String,DataType<?>> dataTypesSensitive)`
    For creating a projected instance

    `` | `DataManager(java.lang.String[] header, int[][] data, Dictionary dictionary, DataDefinition definition, java.util.Set<PrivacyCriterion> criteria, java.util.Map<java.lang.String,DistributionAggregateFunction> functions)` Creates a new data manager from pre-encoded data.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Data` | `getDataAnalyzed()` Returns the input data that will be analyzed.
    `protected DataDefinition` | `getDataDefinition()` Returns the data definitions
    `Data` | `getDataGeneralized()` Returns the input data that will be generalized.
    `Data` | `getDataStatic()` Returns the static input data.
    `double[]` | `getDistribution(int[][] data, int index, int distinctValues)` Returns the distribution of the attribute in the data array at the given index.
    `double[]` | `getDistribution(java.lang.String attribute)` Returns the distribution of the given sensitive attribute in the original dataset.
    `DomainShare[]` | `getDomainShares()`
    `java.lang.String[]` | `getHeader()` The original data header.
    `int[]` | `getHierachiesHeights()` Returns the heights of the hierarchiesQI.
    `GeneralizationHierarchy[]` | `getHierarchies()` Returns the generalization hierarchiesQI.
    `int[]` | `getHierarchiesMaxLevels()` Returns the maximum levels for the generalizaiton.
    `int[]` | `getHierarchiesMinLevels()` Returns the minimum levels for the generalizations.
    `int[]` | `getMicroaggregationDomainSizes()` Returns the map for the according buffer
    `DistributionAggregateFunction[]` | `getMicroaggregationFunctions()` Returns the microaggregation functions.
    `java.lang.String[]` | `getMicroaggregationHeader()` Returns the header for the according buffer
    `int[]` | `getMicroaggregationMap()` Returns the map for the according buffer
    `int` | `getMicroaggregationNumAttributes()` Gets the number of attributes to which microaggregation will be applied in dataAnalyzed.
    `int` | `getMicroaggregationStartIndex()` Gets the start index of the attributes to which microaggregation will be applied in dataAnalyzed.
    `int[]` | `getOrder(java.lang.String attribute)` Returns the order of the given sensitive attribute in the original dataset.
    `DataManager` | `getSubsetInstance(RowSet rowset)` Returns an instance of this data manager, that is projected onto the given rowset
    `int[]` | `getTree(int[][] data, int index, int[][] hierarchy)` Returns a tree for the given attribute at the index within the given data array, using the given hierarchy.
    `int[]` | `getTree(java.lang.String attribute)` Returns the tree for the given sensitive attribute, if a generalization hierarchy is associated.

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

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

- - ### Constructor Detail

    - #### DataManager

          public DataManager(java.lang.String[] header,
                     int[][] data,
                     Dictionary dictionary,
                     DataDefinition definition,
                     java.util.Set<PrivacyCriterion> criteria,
                     java.util.Map<java.lang.String,DistributionAggregateFunction> functions)

      Creates a new data manager from pre-encoded data.
      Parameters:
        `header` -
        `data` -
        `dictionary` -
        `definition` -
        `criteria` -
        `function` -

    - #### DataManager

          protected DataManager(DataDefinition definition,
                     Data dataAnalyzed,
                     Data dataGeneralized,
                     Data dataStatic,
                     java.lang.String[] header,
                     GeneralizationHierarchy[] hierarchiesGeneralized,
                     int[] hierarchiesHeights,
                     java.util.Map<java.lang.String,GeneralizationHierarchy> hierarchiesSensitive,
                     java.util.Map<java.lang.String,java.lang.Integer> indexesSensitive,
                     int[] maxLevels,
                     DistributionAggregateFunction[] microaggregationFunctions,
                     java.lang.String[] microaggregationHeader,
                     int[] microaggregationMap,
                     int[] microaggregationDomainSizes,
                     int microaggregationNumAttributes,
                     int microaggregationStartIndex,
                     int[] minLevels,
                     java.util.Map<java.lang.String,DataType<?>> dataTypesSensitive)

      For creating a projected instance
      Parameters:
        `definition` -
        `dataAnalyzed` -
        `dataGeneralized` -
        `dataStatic` -
        `header` -
        `hierarchiesGeneralized` -
        `hierarchiesHeights` -
        `hierarchiesSensitive` -
        `indexesSensitive` -
        `maxLevels` -
        `microaggregationFunctions` -
        `microaggregationHeader` -
        `microaggregationMap` -
        `microaggregationDomainSizes` -
        `microaggregationNumAttributes` -
        `microaggregationStartIndex` -
        `minLevels` -
        `dataTypesSensitive` -

  - ### Method Detail

    - #### getDataAnalyzed

          public Data getDataAnalyzed()

      Returns the input data that will be analyzed.
      Returns:
        the data

    - #### getDataGeneralized

          public Data getDataGeneralized()

      Returns the input data that will be generalized.
      Returns:
        the data

    - #### getDataStatic

          public Data getDataStatic()

      Returns the static input data.
      Returns:
        the data

    - #### getDistribution

          public double[] getDistribution(int[][] data,
                                 int index,
                                 int distinctValues)

      Returns the distribution of the attribute in the data array at the given index.
      Parameters:
        `data` -
        `index` -
        `distinctValues` -
      Returns:

    - #### getDistribution

          public double[] getDistribution(java.lang.String attribute)

      Returns the distribution of the given sensitive attribute in the original dataset. Required for t-closeness.
      Parameters:
        `attribute` -
      Returns:
        distribution

    - #### getDomainShares

          public DomainShare[] getDomainShares()

    - #### getHeader

          public java.lang.String[] getHeader()

      The original data header.
      Returns:

    - #### getHierachiesHeights

          public int[] getHierachiesHeights()

      Returns the heights of the hierarchiesQI.
      Returns:

    - #### getHierarchies

          public GeneralizationHierarchy[] getHierarchies()

      Returns the generalization hierarchiesQI.
      Returns:
        the hierarchiesQI

    - #### getHierarchiesMaxLevels

          public int[] getHierarchiesMaxLevels()

      Returns the maximum levels for the generalizaiton.
      Returns:
        the maximum level for each QI

    - #### getHierarchiesMinLevels

          public int[] getHierarchiesMinLevels()

      Returns the minimum levels for the generalizations.
      Returns:

    - #### getMicroaggregationDomainSizes

          public int[] getMicroaggregationDomainSizes()

      Returns the map for the according buffer
      Returns:

    - #### getMicroaggregationFunctions

          public DistributionAggregateFunction[] getMicroaggregationFunctions()

      Returns the microaggregation functions.
      Returns:

    - #### getMicroaggregationHeader

          public java.lang.String[] getMicroaggregationHeader()

      Returns the header for the according buffer
      Returns:

    - #### getMicroaggregationMap

          public int[] getMicroaggregationMap()

      Returns the map for the according buffer
      Returns:

    - #### getMicroaggregationNumAttributes

          public int getMicroaggregationNumAttributes()

      Gets the number of attributes to which microaggregation will be applied in dataAnalyzed.
      Returns:

    - #### getMicroaggregationStartIndex

          public int getMicroaggregationStartIndex()

      Gets the start index of the attributes to which microaggregation will be applied in dataAnalyzed.
      Returns:

    - #### getOrder

          public int[] getOrder(java.lang.String attribute)

      Returns the order of the given sensitive attribute in the original dataset. Required for t-closeness.
      Parameters:
        `attribute` -
      Returns:
        distribution

    - #### getSubsetInstance

          public DataManager getSubsetInstance(RowSet rowset)

      Returns an instance of this data manager, that is projected onto the given rowset
      Parameters:
        `rowset` -
      Returns:

    - #### getTree

          public int[] getTree(int[][] data,
                      int index,
                      int[][] hierarchy)

      Returns a tree for the given attribute at the index within the given data array, using the given hierarchy. The resulting tree can be used to calculate the earth mover's distance with hierarchical ground-distance.
      Parameters:
        `data` -
        `index` -
        `hierarchy` -
      Returns:
        tree

    - #### getTree

          public int[] getTree(java.lang.String attribute)

      Returns the tree for the given sensitive attribute, if a generalization hierarchy is associated. The resulting tree can be used to calculate the earth mover's distance with hierarchical ground-distance.
      Parameters:
        `attribute` -
      Returns:
        tree

    - #### getDataDefinition

          protected DataDefinition getDataDefinition()

      Returns the data definitions
      Returns: