ctf: make MonotonicComparator Serializable
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Sat, 7 Feb 2015 13:09:50 +0000 (08:09 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Mon, 9 Feb 2015 16:09:40 +0000 (11:09 -0500)
This allows datastructures like Trees to use it

Change-Id: I1579a6b81326860587e3b403e021f49ac4ecb890
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/41356
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputPacketIndex.java

index 0b0665fff41b4021539c0c330bf66a2536dfed56..b92c7fb9e3349de73be1854dadabd178a499d536 100644 (file)
@@ -16,12 +16,14 @@ package org.eclipse.tracecompass.internal.ctf.core.trace;
 
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.TreeSet;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.ctf.core.trace.CTFReaderException;
@@ -234,9 +236,15 @@ public class StreamInputPacketIndex {
     }
 
     /**
-     * Ordering comparator for entering entries into a data structure sorted by timestamp.
+     * Ordering comparator for entering entries into a data structure sorted by
+     * timestamp.
      */
-    private static class MonotonicComparator implements Comparator<StreamInputPacketIndexEntry> {
+    private static class MonotonicComparator implements Comparator<StreamInputPacketIndexEntry>, Serializable {
+        /**
+         * For {@link Serializable}, that way if we migrate to a {@link TreeSet}
+         * the comparator is serializable too.
+         */
+        private static final long serialVersionUID = -5693064068367242076L;
 
         @Override
         public int compare(StreamInputPacketIndexEntry left, StreamInputPacketIndexEntry right) {
This page took 0.026635 seconds and 5 git commands to generate.