From dec8f35fb1a1be32cf0302a7a23194e8dbe09a7a Mon Sep 17 00:00:00 2001 From: Janus Varmarken Date: Sat, 18 Aug 2018 23:54:36 -0700 Subject: [PATCH] SequenceExtraction.java: work in progress, ignore it. --- .../uci/iotproject/SequenceExtraction.java | 55 +++++++++++++------ 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/SequenceExtraction.java b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/SequenceExtraction.java index ddf8010..bb1e210 100644 --- a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/SequenceExtraction.java +++ b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/SequenceExtraction.java @@ -5,6 +5,7 @@ import edu.uci.iotproject.comparison.seqalignment.SequenceAlignment; import org.pcap4j.core.PcapPacket; import java.util.List; +import java.util.Map; /** * TODO add class documentation. @@ -26,25 +27,43 @@ public class SequenceExtraction { 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 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 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> 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 packets = c.getPackets(); -- 2.34.1