Merging changes.
authorrtrimana <rtrimana@uci.edu>
Wed, 5 Sep 2018 21:28:03 +0000 (14:28 -0700)
committerrtrimana <rtrimana@uci.edu>
Wed, 5 Sep 2018 21:28:03 +0000 (14:28 -0700)
1  2 
Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java

@@@ -205,40 -205,22 +205,22 @@@ public class Main 
          Map<String, Map<String, List<Conversation>>> ons = new HashMap<>();
          // Contains all OFF events: hostname -> sequence identifier -> list of conversations with that sequence
          Map<String, Map<String, List<Conversation>>> offs = new HashMap<>();
-         if (verbose) {
-             userActionsToConvsByHostname.forEach((ua, hostnameToConvs) -> {
-                 Map<String, Map<String, List<Conversation>>> outer = ua.getType() == Type.TOGGLE_ON ? ons : offs;
-                 hostnameToConvs.forEach((host, convs) -> {
-                     Map<String, List<Conversation>> seqsToConvs = TcpConversationUtils.
-                             groupConversationsByPacketSequenceVerbose(convs);
-                     outer.merge(host, seqsToConvs, (oldMap, newMap) -> {
-                         newMap.forEach((sequence, cs) -> oldMap.merge(sequence, cs, (list1, list2) -> {
-                             list1.addAll(list2);
-                             return list1;
-                         }));
-                         return oldMap;
-                     });
-                 });
-             });
-         } else {
-             userActionsToConvsByHostname.forEach((ua, hostnameToConvs) -> {
-                 Map<String, Map<String, List<Conversation>>> outer = ua.getType() == Type.TOGGLE_ON ? ons : offs;
-                 hostnameToConvs.forEach((host, convs) -> {
-                     Map<String, List<Conversation>> seqsToConvs = TcpConversationUtils.
-                             groupConversationsByPacketSequence(convs);
-                     outer.merge(host, seqsToConvs, (oldMap, newMap) -> {
-                         newMap.forEach((sequence, cs) -> oldMap.merge(sequence, cs, (list1, list2) -> {
-                             list1.addAll(list2);
-                             return list1;
-                         }));
-                         return oldMap;
-                     });
+         userActionsToConvsByHostname.forEach((ua, hostnameToConvs) -> {
+             Map<String, Map<String, List<Conversation>>> outer = ua.getType() == Type.TOGGLE_ON ? ons : offs;
+             hostnameToConvs.forEach((host, convs) -> {
+                 Map<String, List<Conversation>> seqsToConvs = TcpConversationUtils.
+                         groupConversationsByPacketSequence(convs, verbose);
+                 outer.merge(host, seqsToConvs, (oldMap, newMap) -> {
+                     newMap.forEach((sequence, cs) -> oldMap.merge(sequence, cs, (list1, list2) -> {
+                         list1.addAll(list2);
+                         return list1;
+                     }));
+                     return oldMap;
                  });
              });
-         }
+         });
  
 -        /*
 +
          // Print out all the pairs into a file for ON events
          File fileOnEvents = new File(onPairsPath);
          PrintWriter pwOn = null;