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)
138 Map<Integer, List<CommonAttributeValue>> itemsToRemove =
new HashMap<>();
143 for (Entry<Integer, CommonAttributeValueList> listOfValues : Collections.unmodifiableMap(
this.instanceCountToAttributeValues).entrySet()) {
145 final Integer key = listOfValues.getKey();
149 if (maximumPercentageThreshold != 0) {
152 attributeType, value.getValue()).doubleValue();
153 Double commonalityPercentage = uniqueTypeValueTuples / uniqueCaseDataSourceTuples * 100;
154 int frequencyPercentage = commonalityPercentage.intValue();
155 if (frequencyPercentage > maximumPercentageThreshold) {
156 if (itemsToRemove.containsKey(key)) {
157 itemsToRemove.get(key).add(value);
159 List<CommonAttributeValue> toRemove =
new ArrayList<>();
161 itemsToRemove.put(key, toRemove);
165 LOGGER.log(Level.WARNING,
"Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results.", ex);
170 for (Entry<Integer, List<CommonAttributeValue>> valuesToRemove : itemsToRemove.entrySet()) {
171 final Integer key = valuesToRemove.getKey();
172 final List<CommonAttributeValue> values = valuesToRemove.getValue();
175 if (instanceCountValue != null) {
176 instanceCountValue.removeMetaData(value);
177 if (instanceCountValue.getDelayedMetadataSet().isEmpty()) {
178 this.instanceCountToAttributeValues.remove(key);
195 count += md5.getInstanceCount();
static final Logger LOGGER
final int percentageThreshold
Long getCountUniqueDataSources()
List< CorrelationAttributeInstance.Type > getDefinedCorrelationTypes()
void filterMetadata(int maximumPercentageThreshold)
Map< Integer, CommonAttributeValueList > getMetadata()
final Map< Integer, CommonAttributeValueList > instanceCountToAttributeValues
synchronized static Logger getLogger(String name)
static CentralRepository getInstance()
Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value)
static final int FILES_TYPE_ID
static boolean isEnabled()