{"action":"created","comment":{"url":"https://api.github.com/repos/ModelInference/synoptic/pulls/comments/94179189","pull_request_review_id":14701713,"id":94179189,"diff_hunk":"@@ -96,151 +110,326 @@ public EventInstance(int traceID, int eventIndexWithinTrace) {\n         }\n     }\n \n+    // Map of nodes and their respective global ID's\n+    static Map<EvBasedNode, Integer> nodesIDMap = new LinkedHashMap<EvBasedNode, Integer>();\n+\n     /**\n-     * Creates the 'log' of the JSON object: a list of traces within the log of\n-     * this partition graph\n+     * Creates the 'nodes' of the JSON object: a list of nodes within this\n+     * EvBasedGraph\n      * \n-     * @param pGraph\n-     *            The partition graph whose log we're outputting\n+     * @param evGraph\n+     *            The EvBasedGraph whose nodes we're outputting\n      */\n-    private static List<Map<String, Object>> makeLogJSON(\n-            PartitionGraph pGraph) {\n-        // The log (list of traces) to go into the JSON object\n-        List<Map<String, Object>> logListOfTraces = new LinkedList<Map<String, Object>>();\n-\n-        // Get all partitions in the partition graph\n-        Set<Partition> allPartitions = pGraph.getNodes();\n-\n-        // Get the INITIAL partition, which will be used to retrieve all traces\n-        // and their events\n-        Partition initialPart = null;\n-        for (Partition part : allPartitions) {\n-            if (part.isInitial()) {\n-                initialPart = part;\n-                break;\n+    private static List<Map<String, Integer>> makeNodesJSON(\n+            EvBasedGraph evGraph) {\n+\n+        // List of Nodes to go into the JSON object\n+        List<Map<String, Integer>> nodeList = new LinkedList<Map<String, Integer>>();\n+\n+        // add the initial node first\n+        Map<String, Integer> initialNodeMap = new LinkedHashMap<String, Integer>();\n+        initialNodeMap.put(\"id\", globalID);\n+        nodesIDMap.put(evGraph.getInitialNode(), globalID);\n+        initialNodeMap.put(\"displayableIDs: \",\n+                displayablesIDMap.get(\"INITIAL\"));\n+        nodeList.add(initialNodeMap);\n+        globalID++;\n+\n+        // Get all the nodes in the evGraph\n+        Set<EvBasedNode> allNodes = evGraph.getNodes();\n+        for (EvBasedNode node : allNodes) {\n+            Map<String, Integer> nodesMap = new LinkedHashMap<String, Integer>();\n+\n+            if (node != evGraph.getInitialNode()\n+                    && node != evGraph.getTerminalNode()) {\n+                nodesMap.put(\"id\", globalID);\n+                nodesIDMap.put(node, globalID);\n+                nodeList.add(nodesMap);\n+                globalID++;\n             }\n         }\n \n-        // There must have been an INITIAL partition found\n-        assert initialPart != null;\n-        if (initialPart == null) {\n-            return null;\n-        }\n+        // add the terminal node last\n+        Map<String, Integer> terminalNodeMap = new LinkedHashMap<String, Integer>();\n+        terminalNodeMap.put(\"id\", globalID);\n+        nodesIDMap.put(evGraph.getTerminalNode(), globalID);\n+        terminalNodeMap.put(\"displayableIDs: \",\n+                displayablesIDMap.get(\"TERMINAL\"));\n+        nodeList.add(terminalNodeMap);\n+        globalID++;\n \n-        // Follow all traces and store them in the log list of traces\n-        int traceID = 0;\n-        for (EventNode startingEvent : initialPart.getEventNodes().iterator()\n-                .next().getAllSuccessors()) {\n-            // One trace, contains the trace number and a list of events\n-            Map<String, Object> singleTraceMap = new LinkedHashMap<String, Object>();\n-            // List of events\n-            List<Map<String, Object>> singleTraceEventsList = new LinkedList<Map<String, Object>>();\n-\n-            int eventIndexWithinTrace = 0;\n-            for (EventNode event = startingEvent; !event\n-                    .isTerminal(); event = event.getAllSuccessors().iterator()\n-                            .next()) {\n-                // One event, contains event index, event type, and timestamp\n-                Map<String, Object> singleEventMap = new LinkedHashMap<String, Object>();\n+        return nodeList;\n+    }\n \n-                // Populate this event's index within the trace, its type, and\n-                // the line in the log where it was found\n-                singleEventMap.put(\"eventIndex\", eventIndexWithinTrace);\n-                EventType evType = event.getEType();\n-                singleEventMap.put(\"eventType\", evType.toString());\n-                singleEventMap.put(\"logLine\", event.getLineNum());\n+    // Map of edges and their respective global ID's\n+    static Map<EvBasedEdge, Integer> edgesIDMap = new LinkedHashMap<EvBasedEdge, Integer>();\n \n-                // Populate this event's time if it's not INITIAL or TERMINAL\n-                if (!evType.isSpecialEventType()) {\n-                    singleEventMap.put(\"timestamp\", event.getTime());\n+    /**\n+     * Creates the 'edges' of the JSON object: a list of edges within this\n+     * EvBasedGraph\n+     * \n+     * @param evGraph\n+     *            The EvBasedGraph whose edges we're outputting\n+     */\n+    private static List<Map<String, Integer>> makeEdgesJSON(\n+            EvBasedGraph evGraph) {\n+\n+        // List of edges and info to go into the JSON Object\n+        List<Map<String, Integer>> edgesList = new LinkedList<Map<String, Integer>>();\n+\n+        // Get all the nodes in the evGraph\n+        Set<EvBasedNode> allNodes = evGraph.getNodes();\n+\n+        // Contains all edges used to avoid duplicates\n+        Set<EvBasedEdge> usedEdges = new HashSet<EvBasedEdge>();\n+\n+        for (EvBasedNode node : allNodes) {\n+\n+            // Get the edges for each node\n+            Set<EvBasedEdge> allEdges = node.outEdges;\n+\n+            for (EvBasedEdge edge : allEdges) {\n+\n+                Map<String, Integer> edgesMap = new LinkedHashMap<String, Integer>();\n+\n+                // Check to see if it is a duplicate\n+                if (!usedEdges.contains(edge)) {\n+\n+                    edgesMap.put(\"id\", globalID);\n+                    edgesMap.put(\"srcNodeID\", nodesIDMap.get(edge.srcNode));\n+                    edgesMap.put(\"destNodeID\", nodesIDMap.get(edge.destNode));\n+                    String displayableValue = edge.eType.getETypeLabel() + \" [\"\n+                            + edge.resMin + \", \" + edge.resMax + \"]\";\n+                    if (edge.resMin == null && edge.resMax == null) {","path":"synoptic/src/synoptic/model/export/JsonExporter.java","position":254,"original_position":254,"commit_id":"32e8bb366570bb519ddc4d3c813fb6f6b01ed69e","original_commit_id":"32e8bb366570bb519ddc4d3c813fb6f6b01ed69e","user":{"login":"ohmann","id":5009420,"avatar_url":"https://avatars.githubusercontent.com/u/5009420?v=3","gravatar_id":"","url":"https://api.github.com/users/ohmann","html_url":"https://github.com/ohmann","followers_url":"https://api.github.com/users/ohmann/followers","following_url":"https://api.github.com/users/ohmann/following{/other_user}","gists_url":"https://api.github.com/users/ohmann/gists{/gist_id}","starred_url":"https://api.github.com/users/ohmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohmann/subscriptions","organizations_url":"https://api.github.com/users/ohmann/orgs","repos_url":"https://api.github.com/users/ohmann/repos","events_url":"https://api.github.com/users/ohmann/events{/privacy}","received_events_url":"https://api.github.com/users/ohmann/received_events","type":"User","site_admin":false},"body":"This means displayableValue will be set twice for every edge for Synoptic models and still twice for a few edges touching initial or terminal in Perfume models. Instead, just assign displayableValue once based on whether this condition is true (so basically do an `if/else` instead of just an `if`).","created_at":"2016-12-29T20:55:37Z","updated_at":"2016-12-29T21:02:37Z","html_url":"https://github.com/ModelInference/synoptic/pull/409#discussion_r94179189","pull_request_url":"https://api.github.com/repos/ModelInference/synoptic/pulls/409","_links":{"self":{"href":"https://api.github.com/repos/ModelInference/synoptic/pulls/comments/94179189"},"html":{"href":"https://github.com/ModelInference/synoptic/pull/409#discussion_r94179189"},"pull_request":{"href":"https://api.github.com/repos/ModelInference/synoptic/pulls/409"}}},"pull_request":{"url":"https://api.github.com/repos/ModelInference/synoptic/pulls/409","id":90743382,"html_url":"https://github.com/ModelInference/synoptic/pull/409","diff_url":"https://github.com/ModelInference/synoptic/pull/409.diff","patch_url":"https://github.com/ModelInference/synoptic/pull/409.patch","issue_url":"https://api.github.com/repos/ModelInference/synoptic/issues/409","number":409,"state":"open","locked":false,"title":"JsonExporter changes","user":{"login":"wborkofsky","id":18491538,"avatar_url":"https://avatars.githubusercontent.com/u/18491538?v=3","gravatar_id":"","url":"https://api.github.com/users/wborkofsky","html_url":"https://github.com/wborkofsky","followers_url":"https://api.github.com/users/wborkofsky/followers","following_url":"https://api.github.com/users/wborkofsky/following{/other_user}","gists_url":"https://api.github.com/users/wborkofsky/gists{/gist_id}","starred_url":"https://api.github.com/users/wborkofsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wborkofsky/subscriptions","organizations_url":"https://api.github.com/users/wborkofsky/orgs","repos_url":"https://api.github.com/users/wborkofsky/repos","events_url":"https://api.github.com/users/wborkofsky/events{/privacy}","received_events_url":"https://api.github.com/users/wborkofsky/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-25T05:54:19Z","updated_at":"2016-12-29T21:02:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94f92482005adc0e6dac0112dc6403e69c751412","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ModelInference/synoptic/pulls/409/commits","review_comments_url":"https://api.github.com/repos/ModelInference/synoptic/pulls/409/comments","review_comment_url":"https://api.github.com/repos/ModelInference/synoptic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ModelInference/synoptic/issues/409/comments","statuses_url":"https://api.github.com/repos/ModelInference/synoptic/statuses/32e8bb366570bb519ddc4d3c813fb6f6b01ed69e","head":{"label":"wborkofsky:master","ref":"master","sha":"32e8bb366570bb519ddc4d3c813fb6f6b01ed69e","user":{"login":"wborkofsky","id":18491538,"avatar_url":"https://avatars.githubusercontent.com/u/18491538?v=3","gravatar_id":"","url":"https://api.github.com/users/wborkofsky","html_url":"https://github.com/wborkofsky","followers_url":"https://api.github.com/users/wborkofsky/followers","following_url":"https://api.github.com/users/wborkofsky/following{/other_user}","gists_url":"https://api.github.com/users/wborkofsky/gists{/gist_id}","starred_url":"https://api.github.com/users/wborkofsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wborkofsky/subscriptions","organizations_url":"https://api.github.com/users/wborkofsky/orgs","repos_url":"https://api.github.com/users/wborkofsky/repos","events_url":"https://api.github.com/users/wborkofsky/events{/privacy}","received_events_url":"https://api.github.com/users/wborkofsky/received_events","type":"User","site_admin":false},"repo":{"id":71824665,"name":"synoptic","full_name":"wborkofsky/synoptic","owner":{"login":"wborkofsky","id":18491538,"avatar_url":"https://avatars.githubusercontent.com/u/18491538?v=3","gravatar_id":"","url":"https://api.github.com/users/wborkofsky","html_url":"https://github.com/wborkofsky","followers_url":"https://api.github.com/users/wborkofsky/followers","following_url":"https://api.github.com/users/wborkofsky/following{/other_user}","gists_url":"https://api.github.com/users/wborkofsky/gists{/gist_id}","starred_url":"https://api.github.com/users/wborkofsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wborkofsky/subscriptions","organizations_url":"https://api.github.com/users/wborkofsky/orgs","repos_url":"https://api.github.com/users/wborkofsky/repos","events_url":"https://api.github.com/users/wborkofsky/events{/privacy}","received_events_url":"https://api.github.com/users/wborkofsky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wborkofsky/synoptic","description":"Inferring models of systems from observations of their behavior","fork":true,"url":"https://api.github.com/repos/wborkofsky/synoptic","forks_url":"https://api.github.com/repos/wborkofsky/synoptic/forks","keys_url":"https://api.github.com/repos/wborkofsky/synoptic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wborkofsky/synoptic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wborkofsky/synoptic/teams","hooks_url":"https://api.github.com/repos/wborkofsky/synoptic/hooks","issue_events_url":"https://api.github.com/repos/wborkofsky/synoptic/issues/events{/number}","events_url":"https://api.github.com/repos/wborkofsky/synoptic/events","assignees_url":"https://api.github.com/repos/wborkofsky/synoptic/assignees{/user}","branches_url":"https://api.github.com/repos/wborkofsky/synoptic/branches{/branch}","tags_url":"https://api.github.com/repos/wborkofsky/synoptic/tags","blobs_url":"https://api.github.com/repos/wborkofsky/synoptic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wborkofsky/synoptic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wborkofsky/synoptic/git/refs{/sha}","trees_url":"https://api.github.com/repos/wborkofsky/synoptic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wborkofsky/synoptic/statuses/{sha}","languages_url":"https://api.github.com/repos/wborkofsky/synoptic/languages","stargazers_url":"https://api.github.com/repos/wborkofsky/synoptic/stargazers","contributors_url":"https://api.github.com/repos/wborkofsky/synoptic/contributors","subscribers_url":"https://api.github.com/repos/wborkofsky/synoptic/subscribers","subscription_url":"https://api.github.com/repos/wborkofsky/synoptic/subscription","commits_url":"https://api.github.com/repos/wborkofsky/synoptic/commits{/sha}","git_commits_url":"https://api.github.com/repos/wborkofsky/synoptic/git/commits{/sha}","comments_url":"https://api.github.com/repos/wborkofsky/synoptic/comments{/number}","issue_comment_url":"https://api.github.com/repos/wborkofsky/synoptic/issues/comments{/number}","contents_url":"https://api.github.com/repos/wborkofsky/synoptic/contents/{+path}","compare_url":"https://api.github.com/repos/wborkofsky/synoptic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wborkofsky/synoptic/merges","archive_url":"https://api.github.com/repos/wborkofsky/synoptic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wborkofsky/synoptic/downloads","issues_url":"https://api.github.com/repos/wborkofsky/synoptic/issues{/number}","pulls_url":"https://api.github.com/repos/wborkofsky/synoptic/pulls{/number}","milestones_url":"https://api.github.com/repos/wborkofsky/synoptic/milestones{/number}","notifications_url":"https://api.github.com/repos/wborkofsky/synoptic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wborkofsky/synoptic/labels{/name}","releases_url":"https://api.github.com/repos/wborkofsky/synoptic/releases{/id}","deployments_url":"https://api.github.com/repos/wborkofsky/synoptic/deployments","created_at":"2016-10-24T19:30:19Z","updated_at":"2016-10-24T19:30:37Z","pushed_at":"2016-10-24T22:01:38Z","git_url":"git://github.com/wborkofsky/synoptic.git","ssh_url":"git@github.com:wborkofsky/synoptic.git","clone_url":"https://github.com/wborkofsky/synoptic.git","svn_url":"https://github.com/wborkofsky/synoptic","homepage":"","size":250655,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ModelInference:master","ref":"master","sha":"5e667e698f3e14a351b61baf55220d7dff105c40","user":{"login":"ModelInference","id":12242425,"avatar_url":"https://avatars.githubusercontent.com/u/12242425?v=3","gravatar_id":"","url":"https://api.github.com/users/ModelInference","html_url":"https://github.com/ModelInference","followers_url":"https://api.github.com/users/ModelInference/followers","following_url":"https://api.github.com/users/ModelInference/following{/other_user}","gists_url":"https://api.github.com/users/ModelInference/gists{/gist_id}","starred_url":"https://api.github.com/users/ModelInference/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ModelInference/subscriptions","organizations_url":"https://api.github.com/users/ModelInference/orgs","repos_url":"https://api.github.com/users/ModelInference/repos","events_url":"https://api.github.com/users/ModelInference/events{/privacy}","received_events_url":"https://api.github.com/users/ModelInference/received_events","type":"Organization","site_admin":false},"repo":{"id":35062324,"name":"synoptic","full_name":"ModelInference/synoptic","owner":{"login":"ModelInference","id":12242425,"avatar_url":"https://avatars.githubusercontent.com/u/12242425?v=3","gravatar_id":"","url":"https://api.github.com/users/ModelInference","html_url":"https://github.com/ModelInference","followers_url":"https://api.github.com/users/ModelInference/followers","following_url":"https://api.github.com/users/ModelInference/following{/other_user}","gists_url":"https://api.github.com/users/ModelInference/gists{/gist_id}","starred_url":"https://api.github.com/users/ModelInference/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ModelInference/subscriptions","organizations_url":"https://api.github.com/users/ModelInference/orgs","repos_url":"https://api.github.com/users/ModelInference/repos","events_url":"https://api.github.com/users/ModelInference/events{/privacy}","received_events_url":"https://api.github.com/users/ModelInference/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ModelInference/synoptic","description":"Inferring models of systems from observations of their behavior","fork":false,"url":"https://api.github.com/repos/ModelInference/synoptic","forks_url":"https://api.github.com/repos/ModelInference/synoptic/forks","keys_url":"https://api.github.com/repos/ModelInference/synoptic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ModelInference/synoptic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ModelInference/synoptic/teams","hooks_url":"https://api.github.com/repos/ModelInference/synoptic/hooks","issue_events_url":"https://api.github.com/repos/ModelInference/synoptic/issues/events{/number}","events_url":"https://api.github.com/repos/ModelInference/synoptic/events","assignees_url":"https://api.github.com/repos/ModelInference/synoptic/assignees{/user}","branches_url":"https://api.github.com/repos/ModelInference/synoptic/branches{/branch}","tags_url":"https://api.github.com/repos/ModelInference/synoptic/tags","blobs_url":"https://api.github.com/repos/ModelInference/synoptic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ModelInference/synoptic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ModelInference/synoptic/git/refs{/sha}","trees_url":"https://api.github.com/repos/ModelInference/synoptic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ModelInference/synoptic/statuses/{sha}","languages_url":"https://api.github.com/repos/ModelInference/synoptic/languages","stargazers_url":"https://api.github.com/repos/ModelInference/synoptic/stargazers","contributors_url":"https://api.github.com/repos/ModelInference/synoptic/contributors","subscribers_url":"https://api.github.com/repos/ModelInference/synoptic/subscribers","subscription_url":"https://api.github.com/repos/ModelInference/synoptic/subscription","commits_url":"https://api.github.com/repos/ModelInference/synoptic/commits{/sha}","git_commits_url":"https://api.github.com/repos/ModelInference/synoptic/git/commits{/sha}","comments_url":"https://api.github.com/repos/ModelInference/synoptic/comments{/number}","issue_comment_url":"https://api.github.com/repos/ModelInference/synoptic/issues/comments{/number}","contents_url":"https://api.github.com/repos/ModelInference/synoptic/contents/{+path}","compare_url":"https://api.github.com/repos/ModelInference/synoptic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ModelInference/synoptic/merges","archive_url":"https://api.github.com/repos/ModelInference/synoptic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ModelInference/synoptic/downloads","issues_url":"https://api.github.com/repos/ModelInference/synoptic/issues{/number}","pulls_url":"https://api.github.com/repos/ModelInference/synoptic/pulls{/number}","milestones_url":"https://api.github.com/repos/ModelInference/synoptic/milestones{/number}","notifications_url":"https://api.github.com/repos/ModelInference/synoptic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ModelInference/synoptic/labels{/name}","releases_url":"https://api.github.com/repos/ModelInference/synoptic/releases{/id}","deployments_url":"https://api.github.com/repos/ModelInference/synoptic/deployments","created_at":"2015-05-04T22:03:38Z","updated_at":"2016-12-22T16:39:16Z","pushed_at":"2016-12-20T22:59:24Z","git_url":"git://github.com/ModelInference/synoptic.git","ssh_url":"git@github.com:ModelInference/synoptic.git","clone_url":"https://github.com/ModelInference/synoptic.git","svn_url":"https://github.com/ModelInference/synoptic","homepage":"","size":251141,"stargazers_count":21,"watchers_count":21,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":98,"forks":13,"open_issues":98,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ModelInference/synoptic/pulls/409"},"html":{"href":"https://github.com/ModelInference/synoptic/pull/409"},"issue":{"href":"https://api.github.com/repos/ModelInference/synoptic/issues/409"},"comments":{"href":"https://api.github.com/repos/ModelInference/synoptic/issues/409/comments"},"review_comments":{"href":"https://api.github.com/repos/ModelInference/synoptic/pulls/409/comments"},"review_comment":{"href":"https://api.github.com/repos/ModelInference/synoptic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ModelInference/synoptic/pulls/409/commits"},"statuses":{"href":"https://api.github.com/repos/ModelInference/synoptic/statuses/32e8bb366570bb519ddc4d3c813fb6f6b01ed69e"}}}}
{"actor":{"display_login":"ohmann"}}