20 package org.sleuthkit.autopsy.commonfilesearch;
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.logging.Level;
57 this.instanceCountToAttributeValues =
new HashMap<>(metadata);
59 this.resultTypeId = resultType.getId();
70 this.instanceCountToAttributeValues =
new HashMap<>(metadata);
84 CommonAttributeValueList getAttributeValuesForInstanceCount(Integer instanceCount) {
85 return this.instanceCountToAttributeValues.get(instanceCount);
96 if(this.percentageThreshold == 0){
97 return Collections.unmodifiableMap(this.instanceCountToAttributeValues);
115 if(maximumPercentageThreshold == 0){
116 return Collections.unmodifiableMap(this.instanceCountToAttributeValues);
122 .filter(filterType -> filterType.getId() == this.
resultTypeId)
127 Map<Integer, List<CommonAttributeValue>> itemsToRemove =
new HashMap<>();
132 for(Entry<Integer, CommonAttributeValueList> listOfValues : Collections.unmodifiableMap(
this.instanceCountToAttributeValues).entrySet()){
134 final Integer key = listOfValues.getKey();
141 attributeType, value.getValue()).doubleValue();
142 Double commonalityPercentage = uniqueTypeValueTuples / uniqueCaseDataSourceTuples * 100;
143 int frequencyPercentage = commonalityPercentage.intValue();
145 if(frequencyPercentage > maximumPercentageThreshold){
146 if(itemsToRemove.containsKey(key)){
147 itemsToRemove.get(key).add(value);
149 List<CommonAttributeValue> toRemove =
new ArrayList<>();
151 itemsToRemove.put(key, toRemove);
155 LOGGER.log(Level.WARNING,
"Unable to determine frequency percentage attribute - frequency filter may not be accurate for these results.", ex);
160 for(Entry<Integer, List<CommonAttributeValue>> valuesToRemove : itemsToRemove.entrySet()){
162 final Integer key = valuesToRemove.getKey();
163 final List<CommonAttributeValue> values = valuesToRemove.getValue();
167 instanceCountValue.removeMetaData(value);
169 if(instanceCountValue.getDelayedMetadataList().isEmpty()){
170 this.instanceCountToAttributeValues.remove(key);
175 return Collections.unmodifiableMap(this.instanceCountToAttributeValues);
188 count += md5.getInstanceCount();
final int percentageThreshold
static List< CorrelationAttributeInstance.Type > getDefaultCorrelationTypes()
Long getCountUniqueDataSources()
Long getCountUniqueCaseDataSourceTuplesHavingTypeValue(CorrelationAttributeInstance.Type aType, String value)
static final Logger LOGGER
static EamDb getInstance()
final Map< Integer, CommonAttributeValueList > instanceCountToAttributeValues
synchronized static Logger getLogger(String name)
Map< Integer, CommonAttributeValueList > getMetadata()
static final int FILES_TYPE_ID
Map< Integer, CommonAttributeValueList > getMetadata(int maximumPercentageThreshold)