# DataHandleOutput (ARX Developer Documentation)

org.deidentifier.arx

## Class DataHandleOutput

- java.lang.Object
- - org.deidentifier.arx.DataHandle
  - - org.deidentifier.arx.DataHandleOutput

-     public class DataHandleOutput
      extends DataHandle

  An implementation of the class DataHandle for output data.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `DataHandleOutput.ResultIterator` The class ResultIterator.

  - ### Field Summary

    - ### Fields inherited from class org.deidentifier.arx.DataHandle

      `dataTypes, definition, header, node, registry, subset`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DataHandleOutput(ARXResult result, org.deidentifier.arx.DataRegistry registry, DataManager manager, Data outputGeneralized, Data outputMicroaggregated, ARXLattice.ARXNode node, DataDefinition definition, ARXConfiguration config)` Instantiates a new handle.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doRelease()` Releases all resources.
    `java.lang.String` | `getAttributeName(int col)` Gets the attribute name.
    `protected ARXConfiguration` | `getConfiguration()` Returns the ARXConfiguration that is currently being used, null if this is an input handle
    `DataType<?>` | `getDataType(java.lang.String attribute)` Returns the according data type.
    `protected DataType<?>[][]` | `getDataTypeArray()` Creates the data type array.
    `protected java.lang.String[]` | `getDistinctValues(int col, boolean ignoreSuppression, DataHandleInternal.InterruptHandler handler)` Gets the distinct values.
    `int` | `getGeneralization(java.lang.String attribute)` Returns the generalization level for the attribute.
    `protected int[][]` | `getInputBuffer()` Returns the input buffer
    `int` | `getNumColumns()` Gets the num columns.
    `int` | `getNumRows()` Gets the num rows.
    `protected Data` | `getOutputBufferGeneralized()` Returns the output buffer
    `protected Data` | `getOutputBufferMicroaggregated()` Returns the output buffer
    `StatisticsBuilder` | `getStatistics()` Returns an object providing access to basic descriptive statistics about the data represented by this handle.
    `java.lang.String` | `getValue(int row, int col)` Gets the value.
    `protected int` | `internalCompare(int row1, int row2, int[] columns, boolean ascending)` A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
    `protected java.lang.String` | `internalGetValue(int row, int col, boolean ignoreSuppression)` Gets the value internal.
    `protected boolean` | `internalIsOutlier(int row)` Returns whether the given row is an outlier.
    `protected boolean` | `internalReplace(int column, java.lang.String original, java.lang.String replacement)` Internal replacement method.
    `protected void` | `internalSwap(int row1, int row2)` Swap internal.
    `protected boolean` | `isAnonymous()` Returns whether the data represented by this handle is anonymous
    `boolean` | `isOptimized()` Has this handle been optimized with local recoding?
    `java.util.Iterator<java.lang.String[]>` | `iterator()` Iterator.
    `boolean` | `replace(int column, java.lang.String original, java.lang.String replacement)` Replaces the original value with the replacement in the given column.
    `protected void` | `setOptimized(boolean optimized)` Marks this handle as optimized
    `void` | `updateData(DataHandle data, java.util.Map<java.lang.String,DataType<?>> types, int[] outliers)` Used to update data when loading projects after local recoding.
    `protected void` | `updateDataTypes(int[] transformation)` Used to update data types after local recoding

    - ### Methods inherited from class org.deidentifier.arx.DataHandle

      `checkColumn, checkColumns, checkRegistry, checkRow, getBaseDataType, getColumnIndexOf, getDate, getDefinition, getDistinctValues, getDouble, getFloat, getInt, getLong, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getNonConformingValues, getNumConformingValues, getRegistry, getRiskEstimator, getRiskEstimator, getRiskEstimator, getRiskEstimator, getRiskEstimator, getRiskEstimator, getTransformation, getView, isOrphaned, isOutlier, release, render, save, save, save, save, save, save, save, save, save, setRegistry, setView, sort, sort, sort, sort, swap`

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

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

- - ### Constructor Detail

    - #### DataHandleOutput

          protected DataHandleOutput(ARXResult result,
                          org.deidentifier.arx.DataRegistry registry,
                          DataManager manager,
                          Data outputGeneralized,
                          Data outputMicroaggregated,
                          ARXLattice.ARXNode node,
                          DataDefinition definition,
                          ARXConfiguration config)

      Instantiates a new handle.
      Parameters:
        `result` -
        `registry` -
        `manager` -
        `outputGeneralized` -
        `outputMicroaggregated` -
        `node` -
        `definition` -
        `config` -

  - ### Method Detail

    - #### getAttributeName

          public java.lang.String getAttributeName(int col)

      Gets the attribute name.
      Specified by:
        `getAttributeName` in class `DataHandle`
      Parameters:
        `col` - the col
      Returns:
        the attribute name

    - #### getDataType

          public DataType<?> getDataType(java.lang.String attribute)

      Description copied from class: `DataHandle`
      Returns the according data type.
      Overrides:
        `getDataType` in class `DataHandle`
      Parameters:
        `attribute` - the attribute
      Returns:
        the data type

    - #### getGeneralization

          public int getGeneralization(java.lang.String attribute)

      Description copied from class: `DataHandle`
      Returns the generalization level for the attribute.
      Specified by:
        `getGeneralization` in class `DataHandle`
      Parameters:
        `attribute` - the attribute
      Returns:
        the generalization

    - #### getNumColumns

          public int getNumColumns()

      Gets the num columns.
      Specified by:
        `getNumColumns` in class `DataHandle`
      Returns:
        the num columns

    - #### getNumRows

          public int getNumRows()

      Gets the num rows.
      Specified by:
        `getNumRows` in class `DataHandle`
      Returns:
        the num rows

    - #### getStatistics

          public StatisticsBuilder getStatistics()

      Description copied from class: `DataHandle`
      Returns an object providing access to basic descriptive statistics about the data represented by this handle.
      Specified by:
        `getStatistics` in class `DataHandle`
      Returns:
        the statistics

    - #### getValue

          public java.lang.String getValue(int row,
                                  int col)

      Gets the value.
      Specified by:
        `getValue` in class `DataHandle`
      Parameters:
        `row` - the row
        `col` - the col
      Returns:
        the value

    - #### isOptimized

          public boolean isOptimized()

      Description copied from class: `DataHandle`
      Has this handle been optimized with local recoding?
      Overrides:
        `isOptimized` in class `DataHandle`
      Returns:

    - #### iterator

          public java.util.Iterator<java.lang.String[]> iterator()

      Iterator.
      Specified by:
        `iterator` in class `DataHandle`
      Returns:
        the iterator

    - #### replace

          public boolean replace(int column,
                        java.lang.String original,
                        java.lang.String replacement)

      Description copied from class: `DataHandle`
      Replaces the original value with the replacement in the given column. Only supported by handles for input data.
      Overrides:
        `replace` in class `DataHandle`
      Parameters:
        `column` - the column
        `original` - the original
        `replacement` - the replacement
      Returns:
        Whether the original value was found

    - #### updateData

          public void updateData(DataHandle data,
                        java.util.Map<java.lang.String,DataType<?>> types,
                        int[] outliers)

      Used to update data when loading projects after local recoding. This is part of the internal API and should never be called by users
      Parameters:
        `data` -
        `types` -

    - #### doRelease

          protected void doRelease()

      Releases all resources.
      Specified by:
        `doRelease` in class `DataHandle`

    - #### getConfiguration

          protected ARXConfiguration getConfiguration()

      Description copied from class: `DataHandle`
      Returns the ARXConfiguration that is currently being used, null if this is an input handle
      Specified by:
        `getConfiguration` in class `DataHandle`
      Returns:

    - #### getDataTypeArray

          protected DataType<?>[][] getDataTypeArray()

      Creates the data type array.
      Specified by:
        `getDataTypeArray` in class `DataHandle`
      Returns:

    - #### getDistinctValues

          protected java.lang.String[] getDistinctValues(int col,
                                             boolean ignoreSuppression,
                                             DataHandleInternal.InterruptHandler handler)

      Gets the distinct values.
      Specified by:
        `getDistinctValues` in class `DataHandle`
      Parameters:
        `col` - the column
        `ignoreSuppression` -
        `handler` -
      Returns:
        the distinct values

    - #### getInputBuffer

          protected int[][] getInputBuffer()

      Returns the input buffer
      Returns:

    - #### getOutputBufferGeneralized

          protected Data getOutputBufferGeneralized()

      Returns the output buffer
      Returns:

    - #### getOutputBufferMicroaggregated

          protected Data getOutputBufferMicroaggregated()

      Returns the output buffer
      Returns:

    - #### internalCompare

          protected int internalCompare(int row1,
                            int row2,
                            int[] columns,
                            boolean ascending)

      A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. It uses the specified data types for comparison if no generalization was applied, otherwise it uses string comparison.
      Overrides:
        `internalCompare` in class `DataHandle`
      Parameters:
        `row1` - the row1
        `row2` - the row2
        `columns` - the columns
        `ascending` - the ascending
      Returns:
        the int

    - #### internalGetValue

          protected java.lang.String internalGetValue(int row,
                                          int col,
                                          boolean ignoreSuppression)

      Gets the value internal.
      Specified by:
        `internalGetValue` in class `DataHandle`
      Parameters:
        `row` - the row
        `col` - the col
      Returns:
        the value internal

    - #### internalIsOutlier

          protected boolean internalIsOutlier(int row)

      Returns whether the given row is an outlier.
      Parameters:
        `row` -
      Returns:

    - #### internalReplace

          protected boolean internalReplace(int column,
                                java.lang.String original,
                                java.lang.String replacement)

      Description copied from class: `DataHandle`
      Internal replacement method.
      Specified by:
        `internalReplace` in class `DataHandle`
      Parameters:
        `column` - the column
        `original` - the original
        `replacement` - the replacement
      Returns:
        true, if successful

    - #### internalSwap

          protected void internalSwap(int row1,
                          int row2)

      Swap internal.
      Parameters:
        `row1` - the row1
        `row2` - the row2

    - #### isAnonymous

          protected boolean isAnonymous()

      Description copied from class: `DataHandle`
      Returns whether the data represented by this handle is anonymous
      Overrides:
        `isAnonymous` in class `DataHandle`
      Returns:

    - #### setOptimized

          protected void setOptimized(boolean optimized)

      Marks this handle as optimized
      Parameters:
        `optimized` -

    - #### updateDataTypes

          protected void updateDataTypes(int[] transformation)

      Used to update data types after local recoding
      Parameters:
        `transformation` -