
org.molgenis.data.security.aggregation.AggregateAnonymizerImpl Maven / Gradle / Ivy
package org.molgenis.data.security.aggregation;
import com.google.common.collect.Lists;
import java.util.List;
import org.molgenis.data.aggregation.AggregateResult;
import org.springframework.stereotype.Component;
@Component
public class AggregateAnonymizerImpl implements AggregateAnonymizer {
@Override
public AnonymizedAggregateResult anonymize(final AggregateResult result, final int threshold) {
List> anonymizedmatrix = Lists.newArrayList();
for (List row : result.getMatrix()) {
List anonymizedRow =
Lists.transform(
row,
input -> {
if (input == null) return null;
return input <= threshold
? AnonymizedAggregateResult.AGGREGATE_ANONYMIZATION_VALUE
: input;
});
anonymizedmatrix.add(anonymizedRow);
}
return new AnonymizedAggregateResult(
anonymizedmatrix, result.getxLabels(), result.getyLabels(), threshold);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy