mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
suppress compile type warnings
This commit is contained in:
parent
66e1f5cca6
commit
eb57361b6f
@ -172,7 +172,7 @@ final class ResultViewerPersistence {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the property sort order and sort rank into onde data bag.
|
||||
* Encapsulate the property, sort order, and sort rank into one data bag.
|
||||
*/
|
||||
static class SortCriterion {
|
||||
|
||||
|
@ -32,6 +32,7 @@ import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.SortOrder;
|
||||
@ -163,17 +164,25 @@ class ThumbnailViewChildren extends Children.Keys<Integer> {
|
||||
}
|
||||
|
||||
private Comparator<Node> getCriterionComparator(SortCriterion criterion) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Comparator<Node> c = Comparator.comparing(node -> getPropertyValue(node, criterion.getProperty()),
|
||||
Comparator.nullsFirst(Comparator.naturalOrder()));
|
||||
return criterion.getSortOrder() == SortOrder.ASCENDING ? c : c.reversed();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Comparable getPropertyValue(Node node, Node.Property<?> prop) {
|
||||
for (Node.PropertySet ps : node.getPropertySets()) {
|
||||
for (Node.Property<?> p : ps.getProperties()) {
|
||||
if (p.equals(prop)) {
|
||||
try {
|
||||
if (p.getValue() instanceof Comparable) {
|
||||
return (Comparable) p.getValue();
|
||||
} else {
|
||||
//if the value is not comparable use its string representation
|
||||
return p.getValue().toString();
|
||||
}
|
||||
|
||||
} catch (IllegalAccessException | InvocationTargetException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user