X-Git-Url: http://plrg.eecs.uci.edu/git/?p=pingpong.git;a=blobdiff_plain;f=Code%2FProjects%2FSmartPlugDetector%2Fsrc%2Fmain%2Fjava%2Fedu%2Fuci%2Fiotproject%2FFlowPatternFinder.java;h=9bbd99ce985a329270ab12cdef38d01b68350240;hp=aff4534865c2f4d3dc696d2efe624eff1709808d;hb=f9c1525915ffd641a1e20c1e9b224e57b0f5d1fc;hpb=e1746e804c54cabf304e4d589dec8c862cf75b16 diff --git a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java index aff4534..9bbd99c 100644 --- a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java +++ b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java @@ -178,44 +178,4 @@ public class FlowPatternFinder { } } - - /** - * Immutable class used for identifying a conversation/connection/session/flow (packet's belonging to the same - * session between a client and a server). - */ - private static class Conversation { - - private final String clientIp; - private final int clientPort; - private final String serverIp; - private final int serverPort; - - public Conversation(String clientIp, int clientPort, String serverIp, int serverPort) { - this.clientIp = clientIp; - this.clientPort = clientPort; - this.serverIp = serverIp; - this.serverPort = serverPort; - } - - - // ========================================================================================================= - // We simply reuse equals and hashCode methods of String.class to be able to use this immutable class as a key - // in a Map. - @Override - public boolean equals(Object obj) { - return obj instanceof Conversation && this.toString().equals(obj.toString()); - } - - @Override - public int hashCode() { - return toString().hashCode(); - } - // ========================================================================================================= - - @Override - public String toString() { - return String.format("%s:%d %s:%d", clientIp, clientPort, serverIp, serverPort); - } - } - }