Adding a method to delete a bad sequence in a signature after we test the produced...
[pingpong.git] / Code / Projects / SmartPlugDetector / src / main / java / edu / uci / iotproject / util / PcapPacketUtils.java
index c5de954536d961dc52aa9ebb602ec5890be046bb..c20512659fd2f62a065431e6279d7b2415aae04b 100644 (file)
@@ -363,7 +363,7 @@ public final class PcapPacketUtils {
     public static void printSignatures(List<List<List<PcapPacket>>> signatures) {
 
         // Iterate over the list of all clusters/sequences
-        int sequenceCounter = 1;
+        int sequenceCounter = 0;
         for(List<List<PcapPacket>> listListPcapPacket : signatures) {
             // Iterate over every member of a cluster/sequence
             System.out.print("====== SEQUENCE " + sequenceCounter++);
@@ -383,4 +383,18 @@ public final class PcapPacketUtils {
             }
         }
     }
+
+    /**
+     * Remove a sequence in a signature object.
+     *
+     * @param signatures A {@link List} of {@link List} of {@link List} of
+     *          {@link PcapPacket} objects.
+     * @param sequenceIndex An index for a sequence that consists of {{@link List} of {@link List} of
+     *          {@link PcapPacket} objects.
+     */
+    public static void removeSequenceFromSignature(List<List<List<PcapPacket>>> signatures, int sequenceIndex) {
+
+        // Sequence index starts from 0
+        signatures.remove(sequenceIndex);
+    }
 }