You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BookFactory.html 17 KiB

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