org.apache.sysds.runtime.privacy.finegrained

## Class FineGrainedPrivacyList

- java.lang.Object
- - org.apache.sysds.runtime.privacy.finegrained.FineGrainedPrivacyList

- All Implemented Interfaces:
    FineGrainedPrivacy

      public class FineGrainedPrivacyList
      extends Object
      implements FineGrainedPrivacy

  Simple implementation of retrieving fine-grained privacy constraints based on pairs in an ArrayList.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FineGrainedPrivacyList()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object other)`
    `Map<String,long[][][]>` | `getAllConstraints()` Get all fine-grained constraints as a map from privacy level to an array of data ranges represented as two-dimensional long arrays.
    `ArrayList<Map.Entry<DataRange,PrivacyConstraint.PrivacyLevel>>` | `getAllConstraintsList()` Return all fine-grained privacy constraints as an arraylist.
    `PrivacyConstraint.PrivacyLevel[]` | `getColPrivacy(int numRows, int numCols)`
    `DataRange[]` | `getDataRangesOfPrivacyLevel(PrivacyConstraint.PrivacyLevel privacyLevel)` Get all data ranges for the given privacy level.
    `Map<DataRange,PrivacyConstraint.PrivacyLevel>` | `getPrivacyLevel(DataRange searchRange)` Get the data ranges and related privacy levels within given data search range.
    `Map<DataRange,PrivacyConstraint.PrivacyLevel>` | `getPrivacyLevelOfElement(long[] searchIndex)` Get the data ranges and related privacy levels of the element with the given index.
    `PrivacyConstraint.PrivacyLevel[]` | `getRowPrivacy(int numRows, int numCols)`
    `boolean` | `hasConstraints()` True if any fine-grained constraints has been set.
    `void` | `put(DataRange dataRange, PrivacyConstraint.PrivacyLevel privacyLevel)` Set privacy level of the given data range.
    `void` | `putCol(int colIndex, int colLength, PrivacyConstraint.PrivacyLevel privacyLevel)`
    `void` | `putElement(int rowIndex, int colIndex, PrivacyConstraint.PrivacyLevel privacyLevel)`
    `void` | `putRow(int rowIndex, int rowLength, PrivacyConstraint.PrivacyLevel privacyLevel)`
    `void` | `removeAllConstraints()` Remove all fine-grained privacy constraints.
    `String` | `toString()`

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

      `getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FineGrainedPrivacyList

          public FineGrainedPrivacyList()

  - ### Method Detail

    - #### getRowPrivacy

          public PrivacyConstraint.PrivacyLevel[] getRowPrivacy(int numRows,
                                                                int numCols)

      Specified by:
        `getRowPrivacy` in interface `FineGrainedPrivacy`

    - #### getColPrivacy

          public PrivacyConstraint.PrivacyLevel[] getColPrivacy(int numRows,
                                                                int numCols)

      Specified by:
        `getColPrivacy` in interface `FineGrainedPrivacy`

    - #### put

          public void put(DataRange dataRange,
                          PrivacyConstraint.PrivacyLevel privacyLevel)

      Description copied from interface: `FineGrainedPrivacy`
      Set privacy level of the given data range.
      Specified by:
        `put` in interface `FineGrainedPrivacy`
      Parameters:
        `dataRange` - representing the range for which the privacy is set
        `privacyLevel` - the level of privacy for the given data range

    - #### putRow

          public void putRow(int rowIndex,
                             int rowLength,
                             PrivacyConstraint.PrivacyLevel privacyLevel)

      Specified by:
        `putRow` in interface `FineGrainedPrivacy`

    - #### putCol

          public void putCol(int colIndex,
                             int colLength,
                             PrivacyConstraint.PrivacyLevel privacyLevel)

      Specified by:
        `putCol` in interface `FineGrainedPrivacy`

    - #### putElement

          public void putElement(int rowIndex,
                                 int colIndex,
                                 PrivacyConstraint.PrivacyLevel privacyLevel)

      Specified by:
        `putElement` in interface `FineGrainedPrivacy`

    - #### getPrivacyLevel

          public Map<DataRange,PrivacyConstraint.PrivacyLevel> getPrivacyLevel(DataRange searchRange)

      Description copied from interface: `FineGrainedPrivacy`
      Get the data ranges and related privacy levels within given data search range.
      Specified by:
        `getPrivacyLevel` in interface `FineGrainedPrivacy`
      Parameters:
        `searchRange` - the range from which all privacy levels are retrieved
      Returns:
        all mappings from range to privacy level within the given search range

    - #### getPrivacyLevelOfElement

          public Map<DataRange,PrivacyConstraint.PrivacyLevel> getPrivacyLevelOfElement(long[] searchIndex)

      Description copied from interface: `FineGrainedPrivacy`
      Get the data ranges and related privacy levels of the element with the given index.
      Specified by:
        `getPrivacyLevelOfElement` in interface `FineGrainedPrivacy`
      Parameters:
        `searchIndex` - index of element
      Returns:
        all mappings from range to privacy level for the given search element

    - #### getDataRangesOfPrivacyLevel

          public DataRange[] getDataRangesOfPrivacyLevel(PrivacyConstraint.PrivacyLevel privacyLevel)

      Description copied from interface: `FineGrainedPrivacy`
      Get all data ranges for the given privacy level.
      Specified by:
        `getDataRangesOfPrivacyLevel` in interface `FineGrainedPrivacy`
      Parameters:
        `privacyLevel` - for which data ranges are found
      Returns:
        all data ranges with the given privacy level

    - #### removeAllConstraints

          public void removeAllConstraints()

      Description copied from interface: `FineGrainedPrivacy`
      Remove all fine-grained privacy constraints.
      Specified by:
        `removeAllConstraints` in interface `FineGrainedPrivacy`

    - #### hasConstraints

          public boolean hasConstraints()

      Description copied from interface: `FineGrainedPrivacy`
      True if any fine-grained constraints has been set.
      Specified by:
        `hasConstraints` in interface `FineGrainedPrivacy`
      Returns:
        true if any fine-grained constraint is set

    - #### getAllConstraints

          public Map<String,long[][][]> getAllConstraints()

      Description copied from interface: `FineGrainedPrivacy`
      Get all fine-grained constraints as a map from privacy level to an array of data ranges represented as two-dimensional long arrays.
      Specified by:
        `getAllConstraints` in interface `FineGrainedPrivacy`
      Returns:
        map from privacy level to array of data ranges

    - #### getAllConstraintsList

          public ArrayList<Map.Entry<DataRange,PrivacyConstraint.PrivacyLevel>> getAllConstraintsList()

      Description copied from interface: `FineGrainedPrivacy`
      Return all fine-grained privacy constraints as an arraylist.
      Specified by:
        `getAllConstraintsList` in interface `FineGrainedPrivacy`
      Returns:
        all constraints

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2021 The Apache Software Foundation. All rights reserved.