Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc (1.8.0_131) on Mon Jun 05 21:49:32 MST 2017 -->
  6. <title>BookFactory (LibrarySystem - BinHong Lee)</title>
  7. <meta name="date" content="2017-06-05">
  8. <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
  9. <script type="text/javascript" src="../script.js"></script>
  10. </head>
  11. <body>
  12. <script type="text/javascript"><!--
  13. try {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="BookFactory (LibrarySystem - BinHong Lee)";
  16. }
  17. }
  18. catch(err) {
  19. }
  20. //-->
  21. var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10};
  22. var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
  23. var altColor = "altColor";
  24. var rowColor = "rowColor";
  25. var tableTab = "tableTab";
  26. var activeTableTab = "activeTableTab";
  27. </script>
  28. <noscript>
  29. <div>JavaScript is disabled on your browser.</div>
  30. </noscript>
  31. <!-- ========= START OF TOP NAVBAR ======= -->
  32. <div class="topNav"><a name="navbar.top">
  33. <!-- -->
  34. </a>
  35. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  36. <a name="navbar.top.firstrow">
  37. <!-- -->
  38. </a>
  39. <ul class="navList" title="Navigation">
  40. <li><a href="../libsys/package-summary.html">Package</a></li>
  41. <li class="navBarCell1Rev">Class</li>
  42. <li><a href="package-tree.html">Tree</a></li>
  43. <li><a href="../index-files/index-1.html">Index</a></li>
  44. <li><a href="../help-doc.html">Help</a></li>
  45. </ul>
  46. </div>
  47. <div class="subNav">
  48. <ul class="navList">
  49. <li><a href="../libsys/Book.html" title="class in libsys"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  50. <li><a href="../libsys/BookFactoryTest.html" title="class in libsys"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  51. </ul>
  52. <ul class="navList">
  53. <li><a href="../index.html?libsys/BookFactory.html" target="_top">Frames</a></li>
  54. <li><a href="BookFactory.html" target="_top">No&nbsp;Frames</a></li>
  55. </ul>
  56. <ul class="navList" id="allclasses_navbar_top">
  57. <li><a href="../allclasses-noframe.html">All&nbsp;Classes</a></li>
  58. </ul>
  59. <div>
  60. <script type="text/javascript"><!--
  61. allClassesLink = document.getElementById("allclasses_navbar_top");
  62. if(window==top) {
  63. allClassesLink.style.display = "block";
  64. }
  65. else {
  66. allClassesLink.style.display = "none";
  67. }
  68. //-->
  69. </script>
  70. </div>
  71. <div>
  72. <ul class="subNavList">
  73. <li>Summary:&nbsp;</li>
  74. <li>Nested&nbsp;|&nbsp;</li>
  75. <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
  76. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  77. <li><a href="#method.summary">Method</a></li>
  78. </ul>
  79. <ul class="subNavList">
  80. <li>Detail:&nbsp;</li>
  81. <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
  82. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  83. <li><a href="#method.detail">Method</a></li>
  84. </ul>
  85. </div>
  86. <a name="skip.navbar.top">
  87. <!-- -->
  88. </a></div>
  89. <!-- ========= END OF TOP NAVBAR ========= -->
  90. <!-- ======== START OF CLASS DATA ======== -->
  91. <div class="header">
  92. <div class="subTitle">libsys</div>
  93. <h2 title="Class BookFactory" class="title">Class BookFactory</h2>
  94. </div>
  95. <div class="contentContainer">
  96. <ul class="inheritance">
  97. <li>java.lang.Object</li>
  98. <li>
  99. <ul class="inheritance">
  100. <li>libsys.BookFactory</li>
  101. </ul>
  102. </li>
  103. </ul>
  104. <div class="description">
  105. <ul class="blockList">
  106. <li class="blockList">
  107. <hr>
  108. <br>
  109. <pre>public class <span class="typeNameLabel">BookFactory</span>
  110. extends java.lang.Object</pre>
  111. <div class="block">Handles all the Book(s)</div>
  112. </li>
  113. </ul>
  114. </div>
  115. <div class="summary">
  116. <ul class="blockList">
  117. <li class="blockList">
  118. <!-- =========== FIELD SUMMARY =========== -->
  119. <ul class="blockList">
  120. <li class="blockList"><a name="field.summary">
  121. <!-- -->
  122. </a>
  123. <h3>Field Summary</h3>
  124. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
  125. <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
  126. <tr>
  127. <th class="colFirst" scope="col">Modifier and Type</th>
  128. <th class="colLast" scope="col">Field and Description</th>
  129. </tr>
  130. <tr class="altColor">
  131. <td class="colFirst"><code>private java.lang.String</code></td>
  132. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#bookFilename">bookFilename</a></span></code>&nbsp;</td>
  133. </tr>
  134. <tr class="rowColor">
  135. <td class="colFirst"><code>private java.util.List&lt;<a href="../libsys/Book.html" title="class in libsys">Book</a>&gt;</code></td>
  136. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#books">books</a></span></code>&nbsp;</td>
  137. </tr>
  138. <tr class="altColor">
  139. <td class="colFirst"><code>private int</code></td>
  140. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#id">id</a></span></code>&nbsp;</td>
  141. </tr>
  142. </table>
  143. </li>
  144. </ul>
  145. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  146. <ul class="blockList">
  147. <li class="blockList"><a name="constructor.summary">
  148. <!-- -->
  149. </a>
  150. <h3>Constructor Summary</h3>
  151. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
  152. <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
  153. <tr>
  154. <th class="colOne" scope="col">Constructor and Description</th>
  155. </tr>
  156. <tr class="altColor">
  157. <td class="colOne"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#BookFactory--">BookFactory</a></span>()</code>
  158. <div class="block">Create a new empty BookFactory</div>
  159. </td>
  160. </tr>
  161. <tr class="rowColor">
  162. <td class="colOne"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#BookFactory-java.lang.String-">BookFactory</a></span>(java.lang.String&nbsp;bookFilename)</code>
  163. <div class="block">Create a new BookFactory and fill it with information from a JSON file</div>
  164. </td>
  165. </tr>
  166. </table>
  167. </li>
  168. </ul>
  169. <!-- ========== METHOD SUMMARY =========== -->
  170. <ul class="blockList">
  171. <li class="blockList"><a name="method.summary">
  172. <!-- -->
  173. </a>
  174. <h3>Method Summary</h3>
  175. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  176. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  177. <tr>
  178. <th class="colFirst" scope="col">Modifier and Type</th>
  179. <th class="colLast" scope="col">Method and Description</th>
  180. </tr>
  181. <tr id="i0" class="altColor">
  182. <td class="colFirst"><code><a href="../libsys/Book.html" title="class in libsys">Book</a></code></td>
  183. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#getBook-int-">getBook</a></span>(int&nbsp;index)</code>
  184. <div class="block">Looks for a Book with the given id</div>
  185. </td>
  186. </tr>
  187. <tr id="i1" class="rowColor">
  188. <td class="colFirst"><code><a href="../libsys/Book.html" title="class in libsys">Book</a></code></td>
  189. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#getBook-java.lang.String-">getBook</a></span>(java.lang.String&nbsp;title)</code>
  190. <div class="block">Linear search through the array list for Book with the given Title</div>
  191. </td>
  192. </tr>
  193. <tr id="i2" class="altColor">
  194. <td class="colFirst"><code>(package private) <a href="../libsys/Book.html" title="class in libsys">Book</a></code></td>
  195. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#newBook-java.lang.String-java.lang.String-">newBook</a></span>(java.lang.String&nbsp;title,
  196. java.lang.String&nbsp;status)</code>
  197. <div class="block">Adds a new Book into this class</div>
  198. </td>
  199. </tr>
  200. <tr id="i3" class="rowColor">
  201. <td class="colFirst"><code>private <a href="../libsys/Book.html" title="class in libsys">Book</a></code></td>
  202. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#search-int-int-int-">search</a></span>(int&nbsp;index,
  203. int&nbsp;start,
  204. int&nbsp;end)</code>
  205. <div class="block">Recursive binary search through the array list for the Book with the given id</div>
  206. </td>
  207. </tr>
  208. <tr id="i4" class="altColor">
  209. <td class="colFirst"><code>(package private) void</code></td>
  210. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#setBookFileName-java.lang.String-">setBookFileName</a></span>(java.lang.String&nbsp;bookFilename)</code>
  211. <div class="block">Update the output filename for the object</div>
  212. </td>
  213. </tr>
  214. <tr id="i5" class="rowColor">
  215. <td class="colFirst"><code>(package private) void</code></td>
  216. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#toJsonFile--">toJsonFile</a></span>()</code>
  217. <div class="block">Output the data into a JSON file replacing the input file (or if filename not given, "books.json")</div>
  218. </td>
  219. </tr>
  220. <tr id="i6" class="altColor">
  221. <td class="colFirst"><code>void</code></td>
  222. <td class="colLast"><code><span class="memberNameLink"><a href="../libsys/BookFactory.html#update-libsys.Book-libsys.Book-">update</a></span>(<a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;oldBook,
  223. <a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;newBook)</code>
  224. <div class="block">Replacing a Book in the array list with a new Book</div>
  225. </td>
  226. </tr>
  227. </table>
  228. <ul class="blockList">
  229. <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
  230. <!-- -->
  231. </a>
  232. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  233. <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
  234. </ul>
  235. </li>
  236. </ul>
  237. </li>
  238. </ul>
  239. </div>
  240. <div class="details">
  241. <ul class="blockList">
  242. <li class="blockList">
  243. <!-- ============ FIELD DETAIL =========== -->
  244. <ul class="blockList">
  245. <li class="blockList"><a name="field.detail">
  246. <!-- -->
  247. </a>
  248. <h3>Field Detail</h3>
  249. <a name="bookFilename">
  250. <!-- -->
  251. </a>
  252. <ul class="blockList">
  253. <li class="blockList">
  254. <h4>bookFilename</h4>
  255. <pre>private&nbsp;java.lang.String bookFilename</pre>
  256. </li>
  257. </ul>
  258. <a name="books">
  259. <!-- -->
  260. </a>
  261. <ul class="blockList">
  262. <li class="blockList">
  263. <h4>books</h4>
  264. <pre>private&nbsp;java.util.List&lt;<a href="../libsys/Book.html" title="class in libsys">Book</a>&gt; books</pre>
  265. </li>
  266. </ul>
  267. <a name="id">
  268. <!-- -->
  269. </a>
  270. <ul class="blockListLast">
  271. <li class="blockList">
  272. <h4>id</h4>
  273. <pre>private&nbsp;int id</pre>
  274. </li>
  275. </ul>
  276. </li>
  277. </ul>
  278. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  279. <ul class="blockList">
  280. <li class="blockList"><a name="constructor.detail">
  281. <!-- -->
  282. </a>
  283. <h3>Constructor Detail</h3>
  284. <a name="BookFactory--">
  285. <!-- -->
  286. </a>
  287. <ul class="blockList">
  288. <li class="blockList">
  289. <h4>BookFactory</h4>
  290. <pre>public&nbsp;BookFactory()</pre>
  291. <div class="block">Create a new empty BookFactory</div>
  292. </li>
  293. </ul>
  294. <a name="BookFactory-java.lang.String-">
  295. <!-- -->
  296. </a>
  297. <ul class="blockListLast">
  298. <li class="blockList">
  299. <h4>BookFactory</h4>
  300. <pre>public&nbsp;BookFactory(java.lang.String&nbsp;bookFilename)</pre>
  301. <div class="block">Create a new BookFactory and fill it with information from a JSON file</div>
  302. <dl>
  303. <dt><span class="paramLabel">Parameters:</span></dt>
  304. <dd><code>bookFilename</code> - Name of the input JSON file</dd>
  305. </dl>
  306. </li>
  307. </ul>
  308. </li>
  309. </ul>
  310. <!-- ============ METHOD DETAIL ========== -->
  311. <ul class="blockList">
  312. <li class="blockList"><a name="method.detail">
  313. <!-- -->
  314. </a>
  315. <h3>Method Detail</h3>
  316. <a name="getBook-int-">
  317. <!-- -->
  318. </a>
  319. <ul class="blockList">
  320. <li class="blockList">
  321. <h4>getBook</h4>
  322. <pre>public&nbsp;<a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;getBook(int&nbsp;index)</pre>
  323. <div class="block">Looks for a Book with the given id</div>
  324. <dl>
  325. <dt><span class="paramLabel">Parameters:</span></dt>
  326. <dd><code>index</code> - id of the Book to be found</dd>
  327. <dt><span class="returnLabel">Returns:</span></dt>
  328. <dd>Book with the given id</dd>
  329. </dl>
  330. </li>
  331. </ul>
  332. <a name="getBook-java.lang.String-">
  333. <!-- -->
  334. </a>
  335. <ul class="blockList">
  336. <li class="blockList">
  337. <h4>getBook</h4>
  338. <pre>public&nbsp;<a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;getBook(java.lang.String&nbsp;title)</pre>
  339. <div class="block">Linear search through the array list for Book with the given Title</div>
  340. <dl>
  341. <dt><span class="paramLabel">Parameters:</span></dt>
  342. <dd><code>title</code> - Title of the Book to be found</dd>
  343. <dt><span class="returnLabel">Returns:</span></dt>
  344. <dd>Book with the given title</dd>
  345. </dl>
  346. </li>
  347. </ul>
  348. <a name="newBook-java.lang.String-java.lang.String-">
  349. <!-- -->
  350. </a>
  351. <ul class="blockList">
  352. <li class="blockList">
  353. <h4>newBook</h4>
  354. <pre><a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;newBook(java.lang.String&nbsp;title,
  355. java.lang.String&nbsp;status)</pre>
  356. <div class="block">Adds a new Book into this class</div>
  357. <dl>
  358. <dt><span class="paramLabel">Parameters:</span></dt>
  359. <dd><code>title</code> - Title of the Book</dd>
  360. <dd><code>status</code> - Status of the Book</dd>
  361. <dt><span class="returnLabel">Returns:</span></dt>
  362. <dd>The new Book that is just created</dd>
  363. </dl>
  364. </li>
  365. </ul>
  366. <a name="search-int-int-int-">
  367. <!-- -->
  368. </a>
  369. <ul class="blockList">
  370. <li class="blockList">
  371. <h4>search</h4>
  372. <pre>private&nbsp;<a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;search(int&nbsp;index,
  373. int&nbsp;start,
  374. int&nbsp;end)</pre>
  375. <div class="block">Recursive binary search through the array list for the Book with the given id</div>
  376. <dl>
  377. <dt><span class="paramLabel">Parameters:</span></dt>
  378. <dd><code>index</code> - id of the Book to be found</dd>
  379. <dd><code>start</code> - Starting point to search</dd>
  380. <dd><code>end</code> - Ending point to search</dd>
  381. <dt><span class="returnLabel">Returns:</span></dt>
  382. <dd>Book with the given id</dd>
  383. </dl>
  384. </li>
  385. </ul>
  386. <a name="setBookFileName-java.lang.String-">
  387. <!-- -->
  388. </a>
  389. <ul class="blockList">
  390. <li class="blockList">
  391. <h4>setBookFileName</h4>
  392. <pre>void&nbsp;setBookFileName(java.lang.String&nbsp;bookFilename)</pre>
  393. <div class="block">Update the output filename for the object</div>
  394. <dl>
  395. <dt><span class="paramLabel">Parameters:</span></dt>
  396. <dd><code>bookFilename</code> - The new filename</dd>
  397. </dl>
  398. </li>
  399. </ul>
  400. <a name="toJsonFile--">
  401. <!-- -->
  402. </a>
  403. <ul class="blockList">
  404. <li class="blockList">
  405. <h4>toJsonFile</h4>
  406. <pre>void&nbsp;toJsonFile()</pre>
  407. <div class="block">Output the data into a JSON file replacing the input file (or if filename not given, "books.json")</div>
  408. </li>
  409. </ul>
  410. <a name="update-libsys.Book-libsys.Book-">
  411. <!-- -->
  412. </a>
  413. <ul class="blockListLast">
  414. <li class="blockList">
  415. <h4>update</h4>
  416. <pre>public&nbsp;void&nbsp;update(<a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;oldBook,
  417. <a href="../libsys/Book.html" title="class in libsys">Book</a>&nbsp;newBook)</pre>
  418. <div class="block">Replacing a Book in the array list with a new Book</div>
  419. <dl>
  420. <dt><span class="paramLabel">Parameters:</span></dt>
  421. <dd><code>oldBook</code> - Book to be replaced</dd>
  422. <dd><code>newBook</code> - Book replacing it</dd>
  423. </dl>
  424. </li>
  425. </ul>
  426. </li>
  427. </ul>
  428. </li>
  429. </ul>
  430. </div>
  431. </div>
  432. <!-- ========= END OF CLASS DATA ========= -->
  433. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  434. <div class="bottomNav"><a name="navbar.bottom">
  435. <!-- -->
  436. </a>
  437. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  438. <a name="navbar.bottom.firstrow">
  439. <!-- -->
  440. </a>
  441. <ul class="navList" title="Navigation">
  442. <li><a href="../libsys/package-summary.html">Package</a></li>
  443. <li class="navBarCell1Rev">Class</li>
  444. <li><a href="package-tree.html">Tree</a></li>
  445. <li><a href="../index-files/index-1.html">Index</a></li>
  446. <li><a href="../help-doc.html">Help</a></li>
  447. </ul>
  448. </div>
  449. <div class="subNav">
  450. <ul class="navList">
  451. <li><a href="../libsys/Book.html" title="class in libsys"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  452. <li><a href="../libsys/BookFactoryTest.html" title="class in libsys"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  453. </ul>
  454. <ul class="navList">
  455. <li><a href="../index.html?libsys/BookFactory.html" target="_top">Frames</a></li>
  456. <li><a href="BookFactory.html" target="_top">No&nbsp;Frames</a></li>
  457. </ul>
  458. <ul class="navList" id="allclasses_navbar_bottom">
  459. <li><a href="../allclasses-noframe.html">All&nbsp;Classes</a></li>
  460. </ul>
  461. <div>
  462. <script type="text/javascript"><!--
  463. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  464. if(window==top) {
  465. allClassesLink.style.display = "block";
  466. }
  467. else {
  468. allClassesLink.style.display = "none";
  469. }
  470. //-->
  471. </script>
  472. </div>
  473. <div>
  474. <ul class="subNavList">
  475. <li>Summary:&nbsp;</li>
  476. <li>Nested&nbsp;|&nbsp;</li>
  477. <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
  478. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  479. <li><a href="#method.summary">Method</a></li>
  480. </ul>
  481. <ul class="subNavList">
  482. <li>Detail:&nbsp;</li>
  483. <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
  484. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  485. <li><a href="#method.detail">Method</a></li>
  486. </ul>
  487. </div>
  488. <a name="skip.navbar.bottom">
  489. <!-- -->
  490. </a></div>
  491. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  492. </body>
  493. </html>