# ARXResult (ARX Developer Documentation)

org.deidentifier.arx

## Class ARXResult

- java.lang.Object
- - org.deidentifier.arx.ARXResult

-     public class ARXResult
      extends java.lang.Object

  Encapsulates the results of an execution of the ARX algorithm.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `ARXResult(DataHandle handle, DataDefinition definition, ARXLattice lattice, int historySize, double snapshotSizeSnapshot, double snapshotSizeDataset, Metric<?> metric, ARXConfiguration config, ARXLattice.ARXNode optimum, long time, SolutionSpace solutionSpace)` Internal constructor for deserialization.
    `protected` | `ARXResult(org.deidentifier.arx.DataRegistry registry, DataManager manager, NodeChecker checker, DataDefinition definition, ARXConfiguration config, ARXLattice lattice, long duration, SolutionSpace solutionSpace)` Creates a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ARXConfiguration` | `getConfiguration()` Returns the configuration used.
    `ARXLattice.ARXNode` | `getGlobalOptimum()` Gets the global optimum.
    `DataHandle` | `getHandle()` Deprecated.
    `DataHandle` | `getHandle(ARXLattice.ARXNode node)` Deprecated.
    `ARXLattice` | `getLattice()` Returns the lattice.
    `DataHandle` | `getOutput()` Returns a handle to the data obtained by applying the optimal transformation.
    `DataHandle` | `getOutput(ARXLattice.ARXNode node)` Returns a handle to data obtained by applying the given transformation.
    `DataHandle` | `getOutput(ARXLattice.ARXNode node, boolean fork)` Returns a handle to data obtained by applying the given transformation.
    `DataHandle` | `getOutput(boolean fork)` Returns a handle to the data obtained by applying the optimal transformation.
    `long` | `getTime()` Returns the execution time (wall clock).
    `boolean` | `isOptimizable(DataHandle handle)` Returns whether local recoding can be applied to the given handle
    `boolean` | `isResultAvailable()` Indicates if a result is available.
    `int` | `optimize(DataHandle handle)` This method optimizes the given data output with local recoding to improve its utility
    `int` | `optimize(DataHandle handle, double gsFactor)` This method optimizes the given data output with local recoding to improve its utility
    `int` | `optimize(DataHandle handle, double gsFactor, ARXListener listener)` This method optimizes the given data output with local recoding to improve its utility
    `void` | `optimizeIterative(DataHandle handle, double gsFactor, int maxIterations, double adaptionFactor)` This method optimizes the given data output with local recoding to improve its utility
    `void` | `optimizeIterative(DataHandle handle, double gsFactor, int maxIterations, double adaptionFactor, ARXListener listener)` This method optimizes the given data output with local recoding to improve its utility
    `protected void` | `releaseBuffer(DataHandleOutput handle)` Releases the buffer.

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

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

- - ### Constructor Detail

    - #### ARXResult

          public ARXResult(DataHandle handle,
                   DataDefinition definition,
                   ARXLattice lattice,
                   int historySize,
                   double snapshotSizeSnapshot,
                   double snapshotSizeDataset,
                   Metric<?> metric,
                   ARXConfiguration config,
                   ARXLattice.ARXNode optimum,
                   long time,
                   SolutionSpace solutionSpace)

      Internal constructor for deserialization.
      Parameters:
        `handle` -
        `definition` -
        `lattice` -
        `historySize` -
        `snapshotSizeSnapshot` -
        `snapshotSizeDataset` -
        `metric` -
        `config` -
        `optimum` -
        `time` -
        `solutionSpace` -

    - #### ARXResult

          protected ARXResult(org.deidentifier.arx.DataRegistry registry,
                   DataManager manager,
                   NodeChecker checker,
                   DataDefinition definition,
                   ARXConfiguration config,
                   ARXLattice lattice,
                   long duration,
                   SolutionSpace solutionSpace)

      Creates a new instance.
      Parameters:
        `registry` -
        `manager` -
        `checker` -
        `definition` -
        `config` -
        `lattice` -
        `duration` -
        `solutionSpace` -

  - ### Method Detail

    - #### getConfiguration

          public ARXConfiguration getConfiguration()

      Returns the configuration used.
      Returns:

    - #### getGlobalOptimum

          public ARXLattice.ARXNode getGlobalOptimum()

      Gets the global optimum.
      Returns:
        the global optimum

    - #### getHandle

          @Deprecated
          public DataHandle getHandle()

      Deprecated.
      Returns a handle to the data obtained by applying the optimal transformation. This method will not copy the buffer, i.e., only one instance can be obtained for each transformation. All previous handles for output data will be invalidated when a new handle is obtained. Use this only if you know exactly what you are doing.
      This method is obsolete. Please use getOutput() instead.
      Returns:

    - #### getHandle

          @Deprecated
          public DataHandle getHandle(ARXLattice.ARXNode node)

      Deprecated.
      Returns a handle to data obtained by applying the given transformation. This method will not copy the buffer, i.e., only one instance can be obtained for each transformation. All previous handles for output data will be invalidated when a new handle is obtained. Use this only if you know exactly what you are doing.
      This method is obsolete. Please use getOutput(...) instead.
      Parameters:
        `node` - the transformation
      Returns:

    - #### getLattice

          public ARXLattice getLattice()

      Returns the lattice.
      Returns:

    - #### getOutput

          public DataHandle getOutput()

      Returns a handle to the data obtained by applying the optimal transformation. This method will fork the buffer, allowing to obtain multiple handles to different representations of the data set. Note that only one instance can be obtained for each transformation.
      Returns:

    - #### getOutput

          public DataHandle getOutput(ARXLattice.ARXNode node)

      Returns a handle to data obtained by applying the given transformation. This method will fork the buffer, allowing to obtain multiple handles to different representations of the data set. Note that only one instance can be obtained for each transformation.
      Parameters:
        `node` - the transformation
      Returns:

    - #### getOutput

          public DataHandle getOutput(ARXLattice.ARXNode node,
                             boolean fork)

      Returns a handle to data obtained by applying the given transformation. This method allows controlling whether the underlying buffer is copied or not. Setting the flag to true will fork the buffer for every handle, allowing to obtain multiple handles to different representations of the data set. When setting the flag to false, all previous handles for output data will be invalidated when a new handle is obtained.
      Parameters:
        `node` - the transformation
        `fork` - Set this flag to false, only if you know exactly what you are doing.
      Returns:

    - #### getOutput

          public DataHandle getOutput(boolean fork)

      Returns a handle to the data obtained by applying the optimal transformation. This method allows controlling whether the underlying buffer is copied or not. Setting the flag to true will fork the buffer for every handle, allowing to obtain multiple handles to different representations of the data set. When setting the flag to false, all previous handles for output data will be invalidated when a new handle is obtained.
      Parameters:
        `fork` - Set this flag to false, only if you know exactly what you are doing.
      Returns:

    - #### getTime

          public long getTime()

      Returns the execution time (wall clock).
      Returns:

    - #### isOptimizable

          public boolean isOptimizable(DataHandle handle)

      Returns whether local recoding can be applied to the given handle
      Parameters:
        `handle` -
      Returns:

    - #### isResultAvailable

          public boolean isResultAvailable()

      Indicates if a result is available.
      Returns:

    - #### optimize

          public int optimize(DataHandle handle)
                       throws RollbackRequiredException

      This method optimizes the given data output with local recoding to improve its utility
      Parameters:
        `handle` -
      Returns:
        The number of optimized records
      Throws:
        `RollbackRequiredException`

    - #### optimize

          public int optimize(DataHandle handle,
                     double gsFactor)
                       throws RollbackRequiredException

      This method optimizes the given data output with local recoding to improve its utility
      Parameters:
        `handle` -
        `gsFactor` - A factor [0,1] weighting generalization and suppression. The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.
      Returns:
        The number of optimized records
      Throws:
        `RollbackRequiredException`

    - #### optimize

          public int optimize(DataHandle handle,
                     double gsFactor,
                     ARXListener listener)
                       throws RollbackRequiredException

      This method optimizes the given data output with local recoding to improve its utility
      Parameters:
        `handle` -
        `gsFactor` - A factor [0,1] weighting generalization and suppression. The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.
        `listener` -
      Returns:
        The number of optimized records
      Throws:
        `RollbackRequiredException`

    - #### optimizeIterative

          public void optimizeIterative(DataHandle handle,
                               double gsFactor,
                               int maxIterations,
                               double adaptionFactor)
                                 throws RollbackRequiredException

      This method optimizes the given data output with local recoding to improve its utility
      Parameters:
        `handle` -
        `gsFactor` - A factor [0,1] weighting generalization and suppression. The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.
        `maxIterations` - The maximal number of iterations to perform
        `adaptionFactor` - Is added to the gsFactor when reaching a fixpoint
        `listener` -
      Throws:
        `RollbackRequiredException`

    - #### optimizeIterative

          public void optimizeIterative(DataHandle handle,
                               double gsFactor,
                               int maxIterations,
                               double adaptionFactor,
                               ARXListener listener)
                                 throws RollbackRequiredException

      This method optimizes the given data output with local recoding to improve its utility
      Parameters:
        `handle` -
        `gsFactor` - A factor [0,1] weighting generalization and suppression. The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.
        `maxIterations` - The maximal number of iterations to perform
        `adaptionFactor` - Is added to the gsFactor when reaching a fixpoint
        `listener` -
      Throws:
        `RollbackRequiredException`

    - #### releaseBuffer

          protected void releaseBuffer(DataHandleOutput handle)

      Releases the buffer.
      Parameters:
        `handle` -