SequenceExtraction.java: work in progress, ignore it.
authorJanus Varmarken <varmarken@gmail.com>
Sun, 19 Aug 2018 06:54:36 +0000 (23:54 -0700)
committerJanus Varmarken <varmarken@gmail.com>
Sun, 19 Aug 2018 07:07:34 +0000 (00:07 -0700)
Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/SequenceExtraction.java

index ddf8010497c3696dc62d1d304111376126591088..bb1e210abdfa6f0b1231f287193814300f01249e 100644 (file)
@@ -5,6 +5,7 @@ import edu.uci.iotproject.comparison.seqalignment.SequenceAlignment;
 import org.pcap4j.core.PcapPacket;
 
 import java.util.List;
 import org.pcap4j.core.PcapPacket;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * TODO add class documentation.
 
 /**
  * TODO add class documentation.
@@ -26,25 +27,43 @@ public class SequenceExtraction {
         mAlignmentAlg = alignmentAlgorithm;
     }
 
         mAlignmentAlg = alignmentAlgorithm;
     }
 
-    /**
-     *
-     * @param convsForAction A set of {@link Conversation}s known to be associated with a single type of user action.
-     */
-    public void extract(List<Conversation> convsForAction) {
-        int maxDifference = 0;
-
-        for (int i = 0; i < convsForAction.size(); i++) {
-            for (int j = i+1; j < convsForAction.size(); i++) {
-                Integer[] sequence1 = getPacketLengthSequence(convsForAction.get(i));
-                Integer[] sequence2 = getPacketLengthSequence(convsForAction.get(j));
-                int alignmentCost = mAlignmentAlg.calculateAlignment(sequence1, sequence2);
-                if (alignmentCost > maxDifference) {
-                    maxDifference = alignmentCost;
-                }
-            }
-        }
+    // Initial
+//    /**
+//     *
+//     * @param convsForAction A set of {@link Conversation}s known to be associated with a single type of user action.
+//     */
+//    public void extract(List<Conversation> convsForAction) {
+//        int maxDifference = 0;
+//
+//        for (int i = 0; i < convsForAction.size(); i++) {
+//            for (int j = i+1; j < convsForAction.size(); i++) {
+//                Integer[] sequence1 = getPacketLengthSequence(convsForAction.get(i));
+//                Integer[] sequence2 = getPacketLengthSequence(convsForAction.get(j));
+//                int alignmentCost = mAlignmentAlg.calculateAlignment(sequence1, sequence2);
+//                if (alignmentCost > maxDifference) {
+//                    maxDifference = alignmentCost;
+//                }
+//            }
+//        }
+//
+//    }
 
 
-    }
+
+//    public void extract(Map<String, List<Conversation>> hostnameToConvs) {
+//        int maxDifference = 0;
+//
+//        for (int i = 0; i < convsForAction.size(); i++) {
+//            for (int j = i+1; j < convsForAction.size(); i++) {
+//                Integer[] sequence1 = getPacketLengthSequence(convsForAction.get(i));
+//                Integer[] sequence2 = getPacketLengthSequence(convsForAction.get(j));
+//                int alignmentCost = mAlignmentAlg.calculateAlignment(sequence1, sequence2);
+//                if (alignmentCost > maxDifference) {
+//                    maxDifference = alignmentCost;
+//                }
+//            }
+//        }
+//
+//    }
 
     private Integer[] getPacketLengthSequence(Conversation c) {
         List<PcapPacket> packets = c.getPackets();
 
     private Integer[] getPacketLengthSequence(Conversation c) {
         List<PcapPacket> packets = c.getPackets();