Package 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 Description static classPrivacyConstraint.PrivacyLevel
-
Constructor Summary
Constructors Constructor 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 Description booleanequals(Object other)FineGrainedPrivacygetFineGrainedPrivacy()Get fine-grained privacy instance.PrivacyConstraint.PrivacyLevelgetPrivacyLevel()booleanhasConstraints()Return true if any constraints have level Private or PrivateAggregate.booleanhasFineGrainedConstraints()Checks if fine-grained privacy is set for this privacy constraint.booleanhasPrivateElements()Return true if any of the elements has privacy level privatevoidreadExternal(ObjectInput is)voidsetFineGrainedPrivacyConstraints(FineGrainedPrivacy fineGrainedPrivacy)Sets fine-grained privacy for the privacy constraint.voidsetPrivacyLevel(PrivacyConstraint.PrivacyLevel privacyLevel)voidtoJson(org.apache.wink.json4j.JSONObject json)Get privacy constraints and put them into JSON object.StringtoString()voidwriteExternal(ObjectOutput objectOutput)
-
-
-
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 void toJson(org.apache.wink.json4j.JSONObject json) throws org.apache.wink.json4j.JSONExceptionGet privacy constraints and put them into JSON object.- Parameters:
json- JSON object in which the privacy constraints are put- Throws:
org.apache.wink.json4j.JSONException- in case of errors in putting into JSON object
-
readExternal
public void readExternal(ObjectInput is) throws IOException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
writeExternal
public void writeExternal(ObjectOutput objectOutput) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
-