{"action":"created","comment":{"url":"https://api.github.com/repos/wandernauta/Groep10/pulls/comments/30003878","id":30003878,"diff_hunk":"@@ -48,55 +48,115 @@ public ConnectionAnchor(Block block, CustomUIPane pane) {\n     public abstract Type getType();\n \n     /**\n-     * Disconnects the anchor from the connection\n+     * Removes the connection from its pane, first disconnecting it from its\n+     * anchors.\n      *\n      * @param connection\n-     *            Connection to disconnect from.\n+     *            Connection to remove from its pane.\n      */\n-    public abstract void removeConnection(Connection connection);\n+    public void removeConnection(Connection connection) {\n+        if (connections.contains(connection)) {\n+            connections.remove(connection);\n+            connection.remove();\n+        }\n+    }\n \n     /**\n-     * Set the connection this anchor is connected to.\n+     * Disconnects the connection from this anchor, keeping the connection on\n+     * its pane.\n      *\n      * @param connection\n+     *            Connection to disconnect from.\n+     */\n+    public void disconnectConnection(Connection connection) {\n+        if (connections.contains(connection)) {\n+            connections.remove(connection);\n+            connection.disconnect(this);\n+        }\n+    }\n+\n+    /**\n+     * Removes all the connections this anchor has.\n+     */\n+    public void removeConnections() {\n+        while (connections.size() > 0) {\n+            removeConnection(connections.get(0));\n+        }\n+    }\n+\n+    /**\n+     * Disconnects all the connections this anchor has from this anchor.\n+     */\n+    public void disconnectConnections() {\n+        while (connections.size() > 0) {\n+            disconnectConnection(connections.get(0));\n+        }\n+    }\n+\n+    /**\n+     * Adds the given connection to the connections this anchor has.\n+     * \n+     * @param connection\n+     *            Connection to add\n      */\n-    public void setConnection(Connection connection) {\n-        this.connection = Optional.ofNullable(connection);\n+    public void addConnection(Connection connection) {\n+        connections.add(connection);\n     }\n \n-    /** Returns true if the anchor is connected to a connection. */\n+    /** Returns true this anchor has 1 or more connections. */\n     public boolean hasConnection() {\n-        return connection.isPresent();\n+        return connections.size() > 0;\n     }\n \n     /**\n-     * @return True if this ConnectionAnchor is connected to a Connection and\n-     *         that connection is fully connected.\n+     * @return True if the primary connection is connected.\n+     */\n+    public boolean isPrimaryConnected() {\n+        return isConnected(0);\n+    }\n+    \n+    /**\n+     * @param index Index of the connection to check\n+     * @return Wether or not the connection specified by the index is connected.\n      */\n-    public boolean isConnected() {\n-        return hasConnection() && getConnection().get().isConnected();\n+    public boolean isConnected(int index){\n+        return index >= 0 && index < getConnections().size() && getConnections().get(index).isConnected();","path":"Code/src/main/java/nl/utwente/group10/ui/components/anchors/ConnectionAnchor.java","position":137,"original_position":137,"commit_id":"28daa53bb9c567592c3c2e5ab4f9b5c74056740d","original_commit_id":"28daa53bb9c567592c3c2e5ab4f9b5c74056740d","user":{"login":"i3anaan","id":2911348,"avatar_url":"https://avatars.githubusercontent.com/u/2911348?v=3","gravatar_id":"","url":"https://api.github.com/users/i3anaan","html_url":"https://github.com/i3anaan","followers_url":"https://api.github.com/users/i3anaan/followers","following_url":"https://api.github.com/users/i3anaan/following{/other_user}","gists_url":"https://api.github.com/users/i3anaan/gists{/gist_id}","starred_url":"https://api.github.com/users/i3anaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i3anaan/subscriptions","organizations_url":"https://api.github.com/users/i3anaan/orgs","repos_url":"https://api.github.com/users/i3anaan/repos","events_url":"https://api.github.com/users/i3anaan/events{/privacy}","received_events_url":"https://api.github.com/users/i3anaan/received_events","type":"User","site_admin":false},"body":"Ik wil graag een false returnen op een out of bounds index, daarvoor is de range check wel nodig.","created_at":"2015-05-10T16:51:03Z","updated_at":"2015-05-10T16:51:03Z","html_url":"https://github.com/wandernauta/Groep10/pull/82#discussion_r30003878","pull_request_url":"https://api.github.com/repos/wandernauta/Groep10/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/wandernauta/Groep10/pulls/comments/30003878"},"html":{"href":"https://github.com/wandernauta/Groep10/pull/82#discussion_r30003878"},"pull_request":{"href":"https://api.github.com/repos/wandernauta/Groep10/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/wandernauta/Groep10/pulls/82","id":35039702,"html_url":"https://github.com/wandernauta/Groep10/pull/82","diff_url":"https://github.com/wandernauta/Groep10/pull/82.diff","patch_url":"https://github.com/wandernauta/Groep10/pull/82.patch","issue_url":"https://api.github.com/repos/wandernauta/Groep10/issues/82","number":82,"state":"open","locked":false,"title":"Efficient Invalidation, ConnectionAnchors now always have a list of connections","user":{"login":"i3anaan","id":2911348,"avatar_url":"https://avatars.githubusercontent.com/u/2911348?v=3","gravatar_id":"","url":"https://api.github.com/users/i3anaan","html_url":"https://github.com/i3anaan","followers_url":"https://api.github.com/users/i3anaan/followers","following_url":"https://api.github.com/users/i3anaan/following{/other_user}","gists_url":"https://api.github.com/users/i3anaan/gists{/gist_id}","starred_url":"https://api.github.com/users/i3anaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i3anaan/subscriptions","organizations_url":"https://api.github.com/users/i3anaan/orgs","repos_url":"https://api.github.com/users/i3anaan/repos","events_url":"https://api.github.com/users/i3anaan/events{/privacy}","received_events_url":"https://api.github.com/users/i3anaan/received_events","type":"User","site_admin":false},"body":"Dit ding begon als een simpele fix om invalidate wat efficienter te maken, dit bleek wat meer werk dan gedacht.\r\nOndertussen heb ik de ConnectionAnchors helemaal overhoop gehaald, ze houden nu beiden een lijst bij met Connections.\r\n\r\nDit is nog een WIP PR, maar ik dien hem vast zodat anderen hiervan op de hoogte zijn en voor eventuele feedback.\r\n\r\nVolgens mij werkt de hele hoop nu, maar de code kan netter en er kan wel wat documentatie bij, dit ga ik op een later moment toevoegen.","created_at":"2015-05-08T19:35:41Z","updated_at":"2015-05-10T16:51:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fb180b819c7527bcdd0ef556c1b2b9c192636e1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wandernauta/Groep10/pulls/82/commits","review_comments_url":"https://api.github.com/repos/wandernauta/Groep10/pulls/82/comments","review_comment_url":"https://api.github.com/repos/wandernauta/Groep10/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wandernauta/Groep10/issues/82/comments","statuses_url":"https://api.github.com/repos/wandernauta/Groep10/statuses/28daa53bb9c567592c3c2e5ab4f9b5c74056740d","head":{"label":"wandernauta:efficiency-invalidate","ref":"efficiency-invalidate","sha":"28daa53bb9c567592c3c2e5ab4f9b5c74056740d","user":{"login":"wandernauta","id":126832,"avatar_url":"https://avatars.githubusercontent.com/u/126832?v=3","gravatar_id":"","url":"https://api.github.com/users/wandernauta","html_url":"https://github.com/wandernauta","followers_url":"https://api.github.com/users/wandernauta/followers","following_url":"https://api.github.com/users/wandernauta/following{/other_user}","gists_url":"https://api.github.com/users/wandernauta/gists{/gist_id}","starred_url":"https://api.github.com/users/wandernauta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wandernauta/subscriptions","organizations_url":"https://api.github.com/users/wandernauta/orgs","repos_url":"https://api.github.com/users/wandernauta/repos","events_url":"https://api.github.com/users/wandernauta/events{/privacy}","received_events_url":"https://api.github.com/users/wandernauta/received_events","type":"User","site_admin":false},"repo":{"id":30242992,"name":"Groep10","full_name":"wandernauta/Groep10","owner":{"login":"wandernauta","id":126832,"avatar_url":"https://avatars.githubusercontent.com/u/126832?v=3","gravatar_id":"","url":"https://api.github.com/users/wandernauta","html_url":"https://github.com/wandernauta","followers_url":"https://api.github.com/users/wandernauta/followers","following_url":"https://api.github.com/users/wandernauta/following{/other_user}","gists_url":"https://api.github.com/users/wandernauta/gists{/gist_id}","starred_url":"https://api.github.com/users/wandernauta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wandernauta/subscriptions","organizations_url":"https://api.github.com/users/wandernauta/orgs","repos_url":"https://api.github.com/users/wandernauta/repos","events_url":"https://api.github.com/users/wandernauta/events{/privacy}","received_events_url":"https://api.github.com/users/wandernauta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wandernauta/Groep10","description":"Ontwerpproject.","fork":false,"url":"https://api.github.com/repos/wandernauta/Groep10","forks_url":"https://api.github.com/repos/wandernauta/Groep10/forks","keys_url":"https://api.github.com/repos/wandernauta/Groep10/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wandernauta/Groep10/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wandernauta/Groep10/teams","hooks_url":"https://api.github.com/repos/wandernauta/Groep10/hooks","issue_events_url":"https://api.github.com/repos/wandernauta/Groep10/issues/events{/number}","events_url":"https://api.github.com/repos/wandernauta/Groep10/events","assignees_url":"https://api.github.com/repos/wandernauta/Groep10/assignees{/user}","branches_url":"https://api.github.com/repos/wandernauta/Groep10/branches{/branch}","tags_url":"https://api.github.com/repos/wandernauta/Groep10/tags","blobs_url":"https://api.github.com/repos/wandernauta/Groep10/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wandernauta/Groep10/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wandernauta/Groep10/git/refs{/sha}","trees_url":"https://api.github.com/repos/wandernauta/Groep10/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wandernauta/Groep10/statuses/{sha}","languages_url":"https://api.github.com/repos/wandernauta/Groep10/languages","stargazers_url":"https://api.github.com/repos/wandernauta/Groep10/stargazers","contributors_url":"https://api.github.com/repos/wandernauta/Groep10/contributors","subscribers_url":"https://api.github.com/repos/wandernauta/Groep10/subscribers","subscription_url":"https://api.github.com/repos/wandernauta/Groep10/subscription","commits_url":"https://api.github.com/repos/wandernauta/Groep10/commits{/sha}","git_commits_url":"https://api.github.com/repos/wandernauta/Groep10/git/commits{/sha}","comments_url":"https://api.github.com/repos/wandernauta/Groep10/comments{/number}","issue_comment_url":"https://api.github.com/repos/wandernauta/Groep10/issues/comments{/number}","contents_url":"https://api.github.com/repos/wandernauta/Groep10/contents/{+path}","compare_url":"https://api.github.com/repos/wandernauta/Groep10/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wandernauta/Groep10/merges","archive_url":"https://api.github.com/repos/wandernauta/Groep10/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wandernauta/Groep10/downloads","issues_url":"https://api.github.com/repos/wandernauta/Groep10/issues{/number}","pulls_url":"https://api.github.com/repos/wandernauta/Groep10/pulls{/number}","milestones_url":"https://api.github.com/repos/wandernauta/Groep10/milestones{/number}","notifications_url":"https://api.github.com/repos/wandernauta/Groep10/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wandernauta/Groep10/labels{/name}","releases_url":"https://api.github.com/repos/wandernauta/Groep10/releases{/id}","created_at":"2015-02-03T13:04:49Z","updated_at":"2015-05-08T15:01:09Z","pushed_at":"2015-05-10T15:37:53Z","git_url":"git://github.com/wandernauta/Groep10.git","ssh_url":"git@github.com:wandernauta/Groep10.git","clone_url":"https://github.com/wandernauta/Groep10.git","svn_url":"https://github.com/wandernauta/Groep10","homepage":null,"size":5463,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"wandernauta:master","ref":"master","sha":"1fce7cd652ea944ba37d75b255b05ee953dd472e","user":{"login":"wandernauta","id":126832,"avatar_url":"https://avatars.githubusercontent.com/u/126832?v=3","gravatar_id":"","url":"https://api.github.com/users/wandernauta","html_url":"https://github.com/wandernauta","followers_url":"https://api.github.com/users/wandernauta/followers","following_url":"https://api.github.com/users/wandernauta/following{/other_user}","gists_url":"https://api.github.com/users/wandernauta/gists{/gist_id}","starred_url":"https://api.github.com/users/wandernauta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wandernauta/subscriptions","organizations_url":"https://api.github.com/users/wandernauta/orgs","repos_url":"https://api.github.com/users/wandernauta/repos","events_url":"https://api.github.com/users/wandernauta/events{/privacy}","received_events_url":"https://api.github.com/users/wandernauta/received_events","type":"User","site_admin":false},"repo":{"id":30242992,"name":"Groep10","full_name":"wandernauta/Groep10","owner":{"login":"wandernauta","id":126832,"avatar_url":"https://avatars.githubusercontent.com/u/126832?v=3","gravatar_id":"","url":"https://api.github.com/users/wandernauta","html_url":"https://github.com/wandernauta","followers_url":"https://api.github.com/users/wandernauta/followers","following_url":"https://api.github.com/users/wandernauta/following{/other_user}","gists_url":"https://api.github.com/users/wandernauta/gists{/gist_id}","starred_url":"https://api.github.com/users/wandernauta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wandernauta/subscriptions","organizations_url":"https://api.github.com/users/wandernauta/orgs","repos_url":"https://api.github.com/users/wandernauta/repos","events_url":"https://api.github.com/users/wandernauta/events{/privacy}","received_events_url":"https://api.github.com/users/wandernauta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wandernauta/Groep10","description":"Ontwerpproject.","fork":false,"url":"https://api.github.com/repos/wandernauta/Groep10","forks_url":"https://api.github.com/repos/wandernauta/Groep10/forks","keys_url":"https://api.github.com/repos/wandernauta/Groep10/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wandernauta/Groep10/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wandernauta/Groep10/teams","hooks_url":"https://api.github.com/repos/wandernauta/Groep10/hooks","issue_events_url":"https://api.github.com/repos/wandernauta/Groep10/issues/events{/number}","events_url":"https://api.github.com/repos/wandernauta/Groep10/events","assignees_url":"https://api.github.com/repos/wandernauta/Groep10/assignees{/user}","branches_url":"https://api.github.com/repos/wandernauta/Groep10/branches{/branch}","tags_url":"https://api.github.com/repos/wandernauta/Groep10/tags","blobs_url":"https://api.github.com/repos/wandernauta/Groep10/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wandernauta/Groep10/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wandernauta/Groep10/git/refs{/sha}","trees_url":"https://api.github.com/repos/wandernauta/Groep10/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wandernauta/Groep10/statuses/{sha}","languages_url":"https://api.github.com/repos/wandernauta/Groep10/languages","stargazers_url":"https://api.github.com/repos/wandernauta/Groep10/stargazers","contributors_url":"https://api.github.com/repos/wandernauta/Groep10/contributors","subscribers_url":"https://api.github.com/repos/wandernauta/Groep10/subscribers","subscription_url":"https://api.github.com/repos/wandernauta/Groep10/subscription","commits_url":"https://api.github.com/repos/wandernauta/Groep10/commits{/sha}","git_commits_url":"https://api.github.com/repos/wandernauta/Groep10/git/commits{/sha}","comments_url":"https://api.github.com/repos/wandernauta/Groep10/comments{/number}","issue_comment_url":"https://api.github.com/repos/wandernauta/Groep10/issues/comments{/number}","contents_url":"https://api.github.com/repos/wandernauta/Groep10/contents/{+path}","compare_url":"https://api.github.com/repos/wandernauta/Groep10/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wandernauta/Groep10/merges","archive_url":"https://api.github.com/repos/wandernauta/Groep10/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wandernauta/Groep10/downloads","issues_url":"https://api.github.com/repos/wandernauta/Groep10/issues{/number}","pulls_url":"https://api.github.com/repos/wandernauta/Groep10/pulls{/number}","milestones_url":"https://api.github.com/repos/wandernauta/Groep10/milestones{/number}","notifications_url":"https://api.github.com/repos/wandernauta/Groep10/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wandernauta/Groep10/labels{/name}","releases_url":"https://api.github.com/repos/wandernauta/Groep10/releases{/id}","created_at":"2015-02-03T13:04:49Z","updated_at":"2015-05-08T15:01:09Z","pushed_at":"2015-05-10T15:37:53Z","git_url":"git://github.com/wandernauta/Groep10.git","ssh_url":"git@github.com:wandernauta/Groep10.git","clone_url":"https://github.com/wandernauta/Groep10.git","svn_url":"https://github.com/wandernauta/Groep10","homepage":null,"size":5463,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wandernauta/Groep10/pulls/82"},"html":{"href":"https://github.com/wandernauta/Groep10/pull/82"},"issue":{"href":"https://api.github.com/repos/wandernauta/Groep10/issues/82"},"comments":{"href":"https://api.github.com/repos/wandernauta/Groep10/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/wandernauta/Groep10/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/wandernauta/Groep10/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wandernauta/Groep10/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/wandernauta/Groep10/statuses/28daa53bb9c567592c3c2e5ab4f9b5c74056740d"}}}}