# DataHandleSubset (ARX GUI Documentation)

org.deidentifier.arx

## Class DataHandleSubset

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

-     public class DataHandleSubset
      extends DataHandle

  This implementation of a data handle projects a given data handle onto a given research subset.

- - ### Field Summary

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

      `dataTypes, definition, header, node, registry`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataHandleSubset(DataHandle source, DataSubset subset)` Creates a new handle that represents the research subset.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doRelease()` Releases all resources.
    `java.lang.String` | `getAttributeName(int col)` Returns the name of the specified column.
    `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()` Generates an array of data types.
    `protected java.lang.String[]` | `getDistinctValues(int column, boolean ignoreSuppression, DataHandleInternal.InterruptHandler handler)` Returns the distinct values.
    `int` | `getGeneralization(java.lang.String attribute)` Returns the generalization level for the attribute.
    `int` | `getNumColumns()` Returns the number of columns in the dataset.
    `int` | `getNumRows()` Returns the number of rows in the dataset.
    `protected DataHandle` | `getSource()` Returns the underlying source data handle.
    `StatisticsBuilder` | `getStatistics()` Returns an object providing access to basic descriptive statistics about the data represented by this handle.
    `int[]` | `getSubset()` Returns the research subset.
    `java.lang.String` | `getValue(int row, int col)` Returns the value in the specified cell.
    `DataHandle` | `getView()` Returns a new data handle that represents a context specific view on the dataset.
    `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)` Internal representation of get value.
    `protected void` | `internalRebuild()` Rebuild array representation of subset.
    `protected boolean` | `internalReplace(int column, java.lang.String original, java.lang.String replacement)` Internal replacement method.
    `protected void` | `internalSwap(int row1, int row2)` Swaps the bits in the set representation.
    `protected int` | `internalTranslate(int row)` Translates the row number.
    `protected boolean` | `isAnonymous()` Returns whether the data represented by this handle is anonymous
    `boolean` | `isOptimized()` Has this handle been optimized with local recoding?
    `boolean` | `isOutlier(int row)` Determines whether a given row is an outlier in the currently associated data transformation.
    `java.util.Iterator<java.lang.String[]>` | `iterator()` Returns an iterator over the data.
    `boolean` | `replace(int column, java.lang.String original, java.lang.String replacement)` Replaces the original value with the replacement in the given column.

    - ### 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, isOrphaned, 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

    - #### DataHandleSubset

          public DataHandleSubset(DataHandle source,
                          DataSubset subset)

      Creates a new handle that represents the research subset.
      Parameters:
        `source` -
        `subset` -

  - ### Method Detail

    - #### getAttributeName

          public java.lang.String getAttributeName(int col)

      Description copied from class: `DataHandle`
      Returns the name of the specified column.
      Specified by:
        `getAttributeName` in class `DataHandle`
      Parameters:
        `col` - The column index
      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()

      Description copied from class: `DataHandle`
      Returns the number of columns in the dataset.
      Specified by:
        `getNumColumns` in class `DataHandle`
      Returns:
        the num columns

    - #### getNumRows

          public int getNumRows()

      Description copied from class: `DataHandle`
      Returns the number of rows in the dataset.
      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

    - #### getSubset

          public int[] getSubset()

      Returns the research subset.
      Returns:

    - #### getValue

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

      Description copied from class: `DataHandle`
      Returns the value in the specified cell.
      Specified by:
        `getValue` in class `DataHandle`
      Parameters:
        `row` - The cell's row index
        `col` - The cell's column index
      Returns:
        the value

    - #### getView

          public DataHandle getView()

      Description copied from class: `DataHandle`
      Returns a new data handle that represents a context specific view on the dataset.
      Overrides:
        `getView` in class `DataHandle`
      Returns:
        the view

    - #### isOptimized

          public boolean isOptimized()

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

    - #### isOutlier

          public boolean isOutlier(int row)

      Description copied from class: `DataHandle`
      Determines whether a given row is an outlier in the currently associated data transformation.
      Overrides:
        `isOutlier` in class `DataHandle`
      Parameters:
        `row` - the row
      Returns:
        true, if is outlier

    - #### iterator

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

      Description copied from class: `DataHandle`
      Returns an iterator over the data.
      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

    - #### doRelease

          protected void doRelease()

      Description copied from class: `DataHandle`
      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()

      Description copied from class: `DataHandle`
      Generates an array of data types.
      Specified by:
        `getDataTypeArray` in class `DataHandle`
      Returns:
        the data type array

    - #### getDistinctValues

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

      Description copied from class: `DataHandle`
      Returns the distinct values.
      Specified by:
        `getDistinctValues` in class `DataHandle`
      Parameters:
        `column` - the column
        `handler` - the handler
      Returns:
        the distinct values

    - #### getSource

          protected DataHandle getSource()

      Returns the underlying source data handle.
      Returns:

    - #### internalCompare

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

      Description copied from class: `DataHandle`
      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 datatype is specified for a specific column 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)

      Description copied from class: `DataHandle`
      Internal representation of get value.
      Specified by:
        `internalGetValue` in class `DataHandle`
      Parameters:
        `row` - the row
        `col` - the col
      Returns:
        the string

    - #### internalRebuild

          protected void internalRebuild()

      Rebuild array representation of subset.

    - #### 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)

      Swaps the bits in the set representation.
      Parameters:
        `row1` -
        `row2` -

    - #### internalTranslate

          protected int internalTranslate(int row)

      Translates the row number.
      Parameters:
        `row` -
      Returns:

    - #### 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: