{"action":"created","comment":{"url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/comments/26874818","id":26874818,"diff_hunk":"@@ -0,0 +1,145 @@\n+/*\n+ * To change this license header, choose License Headers in Project Properties.\n+ * To change this template file, choose Tools | Templates\n+ * and open the template in the editor.\n+ */\n+package ExamenPractica_2_Parcial;\n+\n+import java.io.File;\n+import java.io.FileNotFoundException;\n+import java.io.FileWriter;\n+import java.io.IOException;\n+import java.io.RandomAccessFile;\n+\n+/**\n+ *\n+ * @author KenyStev\n+ */\n+public class Biblioteca {\n+    private RandomAccessFile rBooks;\n+    private NodoBook root;\n+    private static final String ROOT_PATH=\"Library\";\n+\n+    public Biblioteca() {\n+        root=null;\n+        try {\n+            File rootDir = new File(ROOT_PATH);\n+            if(!rootDir.exists()) rootDir.mkdir();\n+            \n+            rBooks = new RandomAccessFile(rootDir+\"/books.boo\", \"rw\");\n+            reloadList();\n+        } catch (FileNotFoundException ex) {\n+            System.out.println(\"Error:\"+ex);\n+        } catch (IOException ex) {\n+            System.out.println(\"Error:\"+ex);\n+        }\n+    }\n+\n+    private void reloadList() throws IOException {\n+        while(rBooks.getFilePointer() < rBooks.length()){\n+            long pos = rBooks.getFilePointer();\n+            int code = rBooks.readInt();\n+            rBooks.readUTF();\n+            rBooks.skipBytes(12);\n+            \n+            addNode(new NodoBook(code, pos));\n+        }\n+    }\n+    \n+    public boolean isEmpty(){\n+        return root == null;\n+    }\n+\n+    private void addNode(NodoBook obj) {\n+        if(isEmpty()) root=obj;\n+        \n+        NodoBook tmp = root;\n+        while(tmp.nextBook!=null){\n+            tmp = tmp.nextBook;\n+        }\n+        tmp.nextBook = obj;\n+    }\n+    \n+    public long searchBook(int code){\n+        NodoBook tmp = root;\n+        while(tmp!=null){\n+            if(tmp.bookCode==code)\n+                return tmp.bookByte;\n+            tmp = tmp.nextBook;\n+        }\n+        return -1;\n+    }\n+    \n+    public boolean addBook(int code, String title, double rentPrice) throws IOException{\n+        if(searchBook(code)==-1){\n+            long pos = rBooks.getFilePointer();","path":"src/ExamenPractica_2_Parcial/Biblioteca.java","position":75,"original_position":75,"commit_id":"34ea543dd8577a63506e992ed61ca93564cc6769","original_commit_id":"34ea543dd8577a63506e992ed61ca93564cc6769","user":{"login":"gotchahn","id":587830,"avatar_url":"https://avatars.githubusercontent.com/u/587830?v=3","gravatar_id":"","url":"https://api.github.com/users/gotchahn","html_url":"https://github.com/gotchahn","followers_url":"https://api.github.com/users/gotchahn/followers","following_url":"https://api.github.com/users/gotchahn/following{/other_user}","gists_url":"https://api.github.com/users/gotchahn/gists{/gist_id}","starred_url":"https://api.github.com/users/gotchahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gotchahn/subscriptions","organizations_url":"https://api.github.com/users/gotchahn/orgs","repos_url":"https://api.github.com/users/gotchahn/repos","events_url":"https://api.github.com/users/gotchahn/events{/privacy}","received_events_url":"https://api.github.com/users/gotchahn/received_events","type":"User","site_admin":false},"body":"Esto debería de hacerlo hasta DESPUES del `seek` sino, tomara una posición incorrecta, para el inicio del registro.","created_at":"2015-03-20T20:46:07Z","updated_at":"2015-03-20T20:46:07Z","html_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015/pull/6#discussion_r26874818","pull_request_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/comments/26874818"},"html":{"href":"https://github.com/UnitecSPS/Programacion2_1_1_2015/pull/6#discussion_r26874818"},"pull_request":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6","id":31649336,"html_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015/pull/6","diff_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015/pull/6.diff","patch_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015/pull/6.patch","issue_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/6","number":6,"state":"open","locked":false,"title":"Examen de practica del trimestre pasado","user":{"login":"KenyStev","id":6833682,"avatar_url":"https://avatars.githubusercontent.com/u/6833682?v=3","gravatar_id":"","url":"https://api.github.com/users/KenyStev","html_url":"https://github.com/KenyStev","followers_url":"https://api.github.com/users/KenyStev/followers","following_url":"https://api.github.com/users/KenyStev/following{/other_user}","gists_url":"https://api.github.com/users/KenyStev/gists{/gist_id}","starred_url":"https://api.github.com/users/KenyStev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KenyStev/subscriptions","organizations_url":"https://api.github.com/users/KenyStev/orgs","repos_url":"https://api.github.com/users/KenyStev/repos","events_url":"https://api.github.com/users/KenyStev/events{/privacy}","received_events_url":"https://api.github.com/users/KenyStev/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-20T20:31:31Z","updated_at":"2015-03-20T20:46:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"761eb0a3f67d86c1ab178a2bb1c85e9cc859ee6d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6/commits","review_comments_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6/comments","review_comment_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/6/comments","statuses_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/statuses/34ea543dd8577a63506e992ed61ca93564cc6769","head":{"label":"UnitecSPS:ExamenDePractica","ref":"ExamenDePractica","sha":"34ea543dd8577a63506e992ed61ca93564cc6769","user":{"login":"UnitecSPS","id":812441,"avatar_url":"https://avatars.githubusercontent.com/u/812441?v=3","gravatar_id":"","url":"https://api.github.com/users/UnitecSPS","html_url":"https://github.com/UnitecSPS","followers_url":"https://api.github.com/users/UnitecSPS/followers","following_url":"https://api.github.com/users/UnitecSPS/following{/other_user}","gists_url":"https://api.github.com/users/UnitecSPS/gists{/gist_id}","starred_url":"https://api.github.com/users/UnitecSPS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UnitecSPS/subscriptions","organizations_url":"https://api.github.com/users/UnitecSPS/orgs","repos_url":"https://api.github.com/users/UnitecSPS/repos","events_url":"https://api.github.com/users/UnitecSPS/events{/privacy}","received_events_url":"https://api.github.com/users/UnitecSPS/received_events","type":"Organization","site_admin":false},"repo":{"id":29735831,"name":"Programacion2_1_1_2015","full_name":"UnitecSPS/Programacion2_1_1_2015","owner":{"login":"UnitecSPS","id":812441,"avatar_url":"https://avatars.githubusercontent.com/u/812441?v=3","gravatar_id":"","url":"https://api.github.com/users/UnitecSPS","html_url":"https://github.com/UnitecSPS","followers_url":"https://api.github.com/users/UnitecSPS/followers","following_url":"https://api.github.com/users/UnitecSPS/following{/other_user}","gists_url":"https://api.github.com/users/UnitecSPS/gists{/gist_id}","starred_url":"https://api.github.com/users/UnitecSPS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UnitecSPS/subscriptions","organizations_url":"https://api.github.com/users/UnitecSPS/orgs","repos_url":"https://api.github.com/users/UnitecSPS/repos","events_url":"https://api.github.com/users/UnitecSPS/events{/privacy}","received_events_url":"https://api.github.com/users/UnitecSPS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015","description":"El proyecto de la clase de Programacion 2 Semestre 1 Trimestre 1 Año 2015","fork":false,"url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015","forks_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/forks","keys_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/teams","hooks_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/hooks","issue_events_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/events{/number}","events_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/events","assignees_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/assignees{/user}","branches_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/branches{/branch}","tags_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/tags","blobs_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/statuses/{sha}","languages_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/languages","stargazers_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/stargazers","contributors_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/contributors","subscribers_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/subscribers","subscription_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/subscription","commits_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/contents/{+path}","compare_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/merges","archive_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/downloads","issues_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues{/number}","pulls_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls{/number}","milestones_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/milestones{/number}","notifications_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/labels{/name}","releases_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/releases{/id}","created_at":"2015-01-23T14:24:54Z","updated_at":"2015-03-20T13:15:25Z","pushed_at":"2015-03-20T20:39:10Z","git_url":"git://github.com/UnitecSPS/Programacion2_1_1_2015.git","ssh_url":"git@github.com:UnitecSPS/Programacion2_1_1_2015.git","clone_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015.git","svn_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015","homepage":null,"size":464,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"UnitecSPS:master","ref":"master","sha":"32547cf3c6b594c0353b77a1958da212c958ceb2","user":{"login":"UnitecSPS","id":812441,"avatar_url":"https://avatars.githubusercontent.com/u/812441?v=3","gravatar_id":"","url":"https://api.github.com/users/UnitecSPS","html_url":"https://github.com/UnitecSPS","followers_url":"https://api.github.com/users/UnitecSPS/followers","following_url":"https://api.github.com/users/UnitecSPS/following{/other_user}","gists_url":"https://api.github.com/users/UnitecSPS/gists{/gist_id}","starred_url":"https://api.github.com/users/UnitecSPS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UnitecSPS/subscriptions","organizations_url":"https://api.github.com/users/UnitecSPS/orgs","repos_url":"https://api.github.com/users/UnitecSPS/repos","events_url":"https://api.github.com/users/UnitecSPS/events{/privacy}","received_events_url":"https://api.github.com/users/UnitecSPS/received_events","type":"Organization","site_admin":false},"repo":{"id":29735831,"name":"Programacion2_1_1_2015","full_name":"UnitecSPS/Programacion2_1_1_2015","owner":{"login":"UnitecSPS","id":812441,"avatar_url":"https://avatars.githubusercontent.com/u/812441?v=3","gravatar_id":"","url":"https://api.github.com/users/UnitecSPS","html_url":"https://github.com/UnitecSPS","followers_url":"https://api.github.com/users/UnitecSPS/followers","following_url":"https://api.github.com/users/UnitecSPS/following{/other_user}","gists_url":"https://api.github.com/users/UnitecSPS/gists{/gist_id}","starred_url":"https://api.github.com/users/UnitecSPS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UnitecSPS/subscriptions","organizations_url":"https://api.github.com/users/UnitecSPS/orgs","repos_url":"https://api.github.com/users/UnitecSPS/repos","events_url":"https://api.github.com/users/UnitecSPS/events{/privacy}","received_events_url":"https://api.github.com/users/UnitecSPS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015","description":"El proyecto de la clase de Programacion 2 Semestre 1 Trimestre 1 Año 2015","fork":false,"url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015","forks_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/forks","keys_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/teams","hooks_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/hooks","issue_events_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/events{/number}","events_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/events","assignees_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/assignees{/user}","branches_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/branches{/branch}","tags_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/tags","blobs_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/statuses/{sha}","languages_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/languages","stargazers_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/stargazers","contributors_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/contributors","subscribers_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/subscribers","subscription_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/subscription","commits_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/contents/{+path}","compare_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/merges","archive_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/downloads","issues_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues{/number}","pulls_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls{/number}","milestones_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/milestones{/number}","notifications_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/labels{/name}","releases_url":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/releases{/id}","created_at":"2015-01-23T14:24:54Z","updated_at":"2015-03-20T13:15:25Z","pushed_at":"2015-03-20T20:39:10Z","git_url":"git://github.com/UnitecSPS/Programacion2_1_1_2015.git","ssh_url":"git@github.com:UnitecSPS/Programacion2_1_1_2015.git","clone_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015.git","svn_url":"https://github.com/UnitecSPS/Programacion2_1_1_2015","homepage":null,"size":464,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6"},"html":{"href":"https://github.com/UnitecSPS/Programacion2_1_1_2015/pull/6"},"issue":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/6"},"comments":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/UnitecSPS/Programacion2_1_1_2015/statuses/34ea543dd8577a63506e992ed61ca93564cc6769"}}}}