# DataHandleSubset (ARX API 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.

- - ### 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
    --- | ---
    `java.lang.String` | `getAttributeName(int col)` Returns the name of the specified column.
    `DataType<?>` | `getDataType(java.lang.String attribute)` Returns the according data type.
    `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.
    `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.
    `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

      `getColumnIndexOf, getDate, getDefinition, getDistinctValues, getDouble, getFloat, getInt, getLong, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getMatchingDataTypes, getNonConformingValues, getNumConformingValues, getRiskEstimator, getRiskEstimator, getRiskEstimator, getRiskEstimator, getRiskEstimator, getRiskEstimator, getTransformation, isOrphaned, release, render, save, save, save, save, save, save, save, save, save, sort, sort, sort, sort, swap`

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

      `equals, 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