20 package org.sleuthkit.autopsy.commonpropertiessearch;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.List;
27 import java.util.Map.Entry;
28 import java.util.TreeMap;
29 import java.util.logging.Level;
62 this.instanceCountToAttributeValues =
new TreeMap<>(metadata);
64 this.resultTypeId = resultType.getId();
77 this.instanceCountToAttributeValues =
new TreeMap<>(metadata);
92 CommonAttributeValueList getAttributeValuesForInstanceCount(Integer instanceCount) {
93 return this.instanceCountToAttributeValues.get(instanceCount);
104 return Collections.unmodifiableMap(this.instanceCountToAttributeValues);
134 .filter(filterType -> filterType.getId() == this.
resultTypeId)
139 Map<Integer, List<CommonAttributeValue>> itemsToRemove =
new HashMap<>();
144 for (Entry<Integer, CommonAttributeValueList> listOfValues : Collections.unmodifiableMap(
this.instanceCountToAttributeValues).entrySet()) {
146 final Integer key = listOfValues.getKey();
150 if (maximumPercentageThreshold != 0) {
153 attributeType, value.getValue()).doubleValue();
154 Double commonalityPercentage = uniqueTypeValueTuples / uniqueCaseDataSourceTuples * 100;
155 int frequencyPercentage = commonalityPercentage.intValue();
156 if (frequencyPercentage > maximumPercentageThreshold) {
157 if (itemsToRemove.containsKey(key)) {
158 itemsToRemove.get(key).add(value);
160 List<CommonAttributeValue> toRemove =
new ArrayList<>();
162 itemsToRemove.put(key, toRemove);
166 LOGGER.log(Level.WARNING,
"Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results.", ex);
171 for (Entry<Integer, List<CommonAttributeValue>> valuesToRemove : itemsToRemove.entrySet()) {
172 final Integer key = valuesToRemove.getKey();
173 final List<CommonAttributeValue> values = valuesToRemove.getValue();
176 if (instanceCountValue != null) {
177 instanceCountValue.removeMetaData(value);
178 if (instanceCountValue.getDelayedMetadataSet().isEmpty()) {
179 this.instanceCountToAttributeValues.remove(key);
196 count += md5.getInstanceCount();
static final Logger LOGGER
final int percentageThreshold
static List< CorrelationAttributeInstance.Type > getDefaultCorrelationTypes()
Long getCountUniqueDataSources()
Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value)
static EamDb getInstance()
void filterMetadata(int maximumPercentageThreshold)
static boolean isEnabled()
Map< Integer, CommonAttributeValueList > getMetadata()
final Map< Integer, CommonAttributeValueList > instanceCountToAttributeValues
synchronized static Logger getLogger(String name)
static final int FILES_TYPE_ID