org.apache.sysds.runtime.privacy

## Class PrivacyConstraint

- java.lang.Object
- - org.apache.sysds.runtime.privacy.PrivacyConstraint

- All Implemented Interfaces:
    Externalizable, Serializable

      public class PrivacyConstraint
      extends Object
      implements Externalizable

  PrivacyConstraint holds all privacy constraints for data in the system at compile time and runtime.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PrivacyConstraint.PrivacyLevel`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrivacyConstraint()` Basic Constructor with a fine-grained collection based on a list implementation.
    `PrivacyConstraint(FineGrainedPrivacy fineGrainedPrivacyCollection)` Constructor with the option to choose between different fine-grained collection implementations.
    `PrivacyConstraint(PrivacyConstraint.PrivacyLevel privacyLevel)` Constructor with default fine-grained collection implementation where the entire data object is set to the given privacy level.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object other)`
    `FineGrainedPrivacy` | `getFineGrainedPrivacy()` Get fine-grained privacy instance.
    `PrivacyConstraint.PrivacyLevel` | `getPrivacyLevel()`
    `boolean` | `hasConstraints()` Return true if any constraints have level Private or PrivateAggregate.
    `boolean` | `hasFineGrainedConstraints()` Checks if fine-grained privacy is set for this privacy constraint.
    `boolean` | `hasPrivateElements()` Return true if any of the elements has privacy level private
    `void` | `readExternal(ObjectInput is)`
    `void` | `setFineGrainedPrivacyConstraints(FineGrainedPrivacy fineGrainedPrivacy)` Sets fine-grained privacy for the privacy constraint.
    `void` | `setPrivacyLevel(PrivacyConstraint.PrivacyLevel privacyLevel)`
    `org.apache.wink.json4j.JSONObject` | `toJson(org.apache.wink.json4j.JSONObject json)` Get privacy constraints and put them into JSON object.
    `String` | `toString()`
    `void` | `writeExternal(ObjectOutput objectOutput)`

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

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

- - ### Constructor Detail

    - #### PrivacyConstraint

          public PrivacyConstraint()

      Basic Constructor with a fine-grained collection based on a list implementation.

    - #### PrivacyConstraint

          public PrivacyConstraint(FineGrainedPrivacy fineGrainedPrivacyCollection)

      Constructor with the option to choose between different fine-grained collection implementations.
      Parameters:
        `fineGrainedPrivacyCollection` - the instance in which fine-grained constraints are stored

    - #### PrivacyConstraint

          public PrivacyConstraint(PrivacyConstraint.PrivacyLevel privacyLevel)

      Constructor with default fine-grained collection implementation where the entire data object is set to the given privacy level.
      Parameters:
        `privacyLevel` - for the entire data object.

  - ### Method Detail

    - #### setPrivacyLevel

          public void setPrivacyLevel(PrivacyConstraint.PrivacyLevel privacyLevel)

    - #### getPrivacyLevel

          public PrivacyConstraint.PrivacyLevel getPrivacyLevel()

    - #### hasFineGrainedConstraints

          public boolean hasFineGrainedConstraints()

      Checks if fine-grained privacy is set for this privacy constraint.
      Returns:
        true if the privacy constraint has fine-grained constraints.

    - #### setFineGrainedPrivacyConstraints

          public void setFineGrainedPrivacyConstraints(FineGrainedPrivacy fineGrainedPrivacy)

      Sets fine-grained privacy for the privacy constraint. Existing fine-grained privacy collection will be overwritten.
      Parameters:
        `fineGrainedPrivacy` - fine-grained privacy instance which is set for the privacy constraint

    - #### getFineGrainedPrivacy

          public FineGrainedPrivacy getFineGrainedPrivacy()

      Get fine-grained privacy instance.
      Returns:
        fine-grained privacy instance

    - #### hasPrivateElements

          public boolean hasPrivateElements()

      Return true if any of the elements has privacy level private
      Returns:
        true if any element has privacy level private

    - #### hasConstraints

          public boolean hasConstraints()

      Return true if any constraints have level Private or PrivateAggregate.
      Returns:
        true if any constraints have level Private or PrivateAggregate

    - #### toJson

          public org.apache.wink.json4j.JSONObject toJson(org.apache.wink.json4j.JSONObject json)
                                                   throws org.apache.wink.json4j.JSONException

      Get privacy constraints and put them into JSON object.
      Parameters:
        `json` - JSON object in which the privacy constraints are put
      Returns:
        JSON object including the privacy constraints
      Throws:
        `org.apache.wink.json4j.JSONException` - in case of errors in creating JSON object

    - #### readExternal

          public void readExternal(ObjectInput is)
                            throws IOException

      Specified by:
        `readExternal` in interface `Externalizable`
      Throws:
        `IOException`

    - #### writeExternal

          public void writeExternal(ObjectOutput objectOutput)
                             throws IOException

      Specified by:
        `writeExternal` in interface `Externalizable`
      Throws:
        `IOException`

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