Files
G4G0-1/Semester 2/Programming 2/Project/Part 4 Complete/Library.ctxt

66 lines
7.0 KiB
Plaintext

#BlueJ class context
comment0.params=
comment0.target=Library()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ Library\n
comment1.params=
comment1.target=java.util.ArrayList\ getUserIDs()
comment1.text=\n\ Return\ the\ keys\ of\ @customerMap\ as\ a\ list.\n
comment10.params=
comment10.target=java.lang.String\ generateReservationNo()
comment10.text=\n\ Generate\ a\ sequential\ reservation\ number\ padded\ with\ 0s\ to\ a\ length\ of\ 6.\n\ \n\ Since\ we\ are\ not\ storing\ in\ a\ file\ at\ this\ point,\ we\ obtain\ the\ size\ of\ the\ Map,\ and\ add\ 1\ to\ determine\ the\ current\ number.\n\ This\ is\ due\ to\ the\ event\ of\ program\ restart,\ if\ a\ field\ variable\ is\ used,\ the\ first\ reservation\ generated\ will\ be\ of\ ID\ "000001"\n\ no\ matter\ what.\ This\ causes\ an\ issue\ if\ a\ file\ is\ read\ to\ load\ the\ reservations\ into\ the\ Library,\ since\ IDs\ will\ conflict\ and\ \n\ the\ value\ will\ be\ overwritten,\ causing\ data\ integrity\ loss.\n\ Unlike\ @generateUserID,\ this\ has\ a\ maximum\ value\ hardcoded\ to\ the\ spec.\ \n\ This\ likely\ will\ not\ be\ an\ issue\ since\ we\ can\ still\ have\ 1,000,000\ reservations.\n\ \n\ Returns\n\ \ String\ @candidateNo\ -\ a\ proposed\ lowest\ number\ that\ is\ checked\ and\ interated\ if\ conflicting.\n
comment11.params=prefix\ length
comment11.target=java.lang.String\ generateUserID(java.lang.String,\ int)
comment11.text=\n\ Generate\ a\ unique\ user\ identifier\ to\ apply\ to\ users\ when\ the\ UUID\ is\ unknown.\n\ This\ generates\ a\ number\ of\ @length\ length\ using\ the\ Random\ class,\ and\ prefixes\ @prefix.\n\ \n\ Takes\ Parameters\n\ \ String\ @prefix\ -\ arbitrary\ alphanumeric\ prefix\n\ \ String\ @length\ -\ length\ of\ numeric\ ID\n\ Returns\n\ \ String\ @uuid\ -\ a\ unique\ string\ starting\ with\ @prefix,\ and\ concat.\ with\ a\ random\ number\n\ \n\ Example\:\ length\ \=\ 6,\ expected\ result\ should\ be\ under\ 999,999\ and\ above\ 99,999.\n\ If\ we\ just\ use\ 10^(length),\ this\ would\ generate\ any\ number\ under\ 1,000,000.\n\ This\ is\ an\ issue\ since\ any\ integers\ below\ 100,000\ can\ be\ used,\ which\ would\ be\ incorrect.\n\ By\ using\ the\ offset\ of\ a\ factor\ of\ 10\ below\ the\ desired\ length\ we\ can\ generate\ between\ 0\ and\ 899,999.\n\ After\ this,\ we\ can\ add\ 100,000\ back\ to\ the\ number\ to\ ensure\ a\ baseline\ length\ is\ maintained.\n\ \n\ Note\:\ I\ am\ aware\ that\ this\ is\ overengineered,\ and\ that\ several\ random\ integers\ of\ amount\ @length\ could\ be\ used,\ \n\ but\ this\ is\ considerably\ more\ efficient\ since\ there\ is\ no\ iteration\ involved\ in\ the\ creation\ of\ the\ ID.\ O(1)\n
comment12.params=
comment12.target=void\ printLibraryReservations()
comment12.text=\n\ Prints\ to\ the\ terminal,\ in\ a\ human-readable\ format,\ all\ LibraryReservation(s)\n\ \n\ Contains\ a\ marker\ at\ the\ start\ and\ end\ to\ visualise\ in\ terminal\ output.\n
comment13.params=
comment13.target=void\ printAll()
comment13.text=\n\ Prints\ to\ the\ terminal,\ in\ a\ human-readable\ format,\ all\:\n\ \ LibraryItem(s)\n\ \ LibraryUser(s)\n\ \ LibraryReservation(s)\n\ \n\ Contains\ a\ marker\ at\ the\ start\ and\ end\ of\ each\ type\ to\ visualise\ in\ terminal\ output.\n\ For\ printing\ the\ LibraryReservation(s),\ the\ corresponding\ method\ is\ called\ to\ reduce\n\ code\ duplication.\n
comment14.params=start\ end
comment14.target=void\ printDiaryEntries(java.lang.String,\ java.lang.String)
comment14.text=\n\ Print,\ to\ the\ terminal\ all\ reservation\ entries\ in\ the\ diary.\n\ Takes\ Parameters\n\ \ String\ @start\n\ \ String\ @end\n\ \n\ This\ converts\ both\ string\ inputs\ to\ Date\ formats,\ and\ calls\ the\ printEntries\n\ method\ in\ the\ diary\ class.\n
comment15.params=
comment15.target=void\ writeLibraryReservationData()
comment15.text=\n\ Write\ all\ current\ library\ reservations\ to\ a\ file\ specified\ by\ the\ user.\n\ For\ each\ user,\ this\ passes\ a\ printWriter\ object\ to\ the\ writeData\ method\ of\ LibraryReservation.\n
comment16.params=
comment16.target=void\ writeUserData()
comment16.text=\n\ A\ method\ to\ output\ all\ user\ data\ to\ a\ file\ using\ a\ fileDialog\ to\ specify\ file\ location.\n\ For\ each\ user,\ this\ passes\ a\ printWriter\ object\ to\ the\ writeData\ method\ of\ LibraryUser.\n
comment17.params=
comment17.target=void\ readLibraryReservationData()
comment17.text=\n\ Read\ Library\ Reservation\ Data\ from\ a\ file\ specified\ by\ the\ user.\n\ This\ passes\ a\ scanner\ to\ the\ readData\ method\ in\ LibraryReservation\ for\ each\n\ line\ of\ the\ file.\n
comment18.params=
comment18.target=void\ readData()
comment18.text=\n\ A\ method\ to\ read\ all\ data\ from\ files\ using\ a\ fileDialog\ to\ specify\ file\ location.\n\ This\ will\ create\ the\ corresponding\ objects\ depending\ on\ flags\ contained\ in\ the\ file\n\ and\ populate\ it's\ fields.\n\ \n\ Default\ flag\ value\:\ "book",\ to\ support\ legacy\ files.\ This\ will\ not\ interfere\ with\ \n\ files\ of\ different\ flag\ orders.\n
comment19.params=userID\ itemCode\ startDate\ noOfDays
comment19.target=boolean\ makeLibraryReservation(java.lang.String,\ java.lang.String,\ java.lang.String,\ int)
comment19.text=\n\ Create\ a\ reservation\ to\ allow\ a\ user\ to\ reserve\ an\ item\ from\ the\ library.\ Ensures\ a\ reservation\ is\ not\ already\n\ in\ place\ for\ a\ conflicting\ itemCode.\n\ Takes\ parameters\n\ \ String\ @userID\ \n\ \ String\ @itemCode\n\ \ String\ @startDate\n\ \ int\ @noOfDays\n\ \ \n\ Returns\n\ \ boolean\n
comment2.params=
comment2.target=java.util.ArrayList\ getItemCodes()
comment2.text=\n\ Return\ the\ keys\ of\ @itemsMap\ as\ a\ list.\n
comment20.params=reservationNo
comment20.target=void\ deleteLibraryReservation(java.lang.String)
comment20.text=\n\ Allows\ the\ deletion\ of\ a\ library\ reservation.\ \n\ \n\ Takes\ Parameter\n\ \ String\ @reservationNo\n\ \ \n\ Removes\ the\ corresponding\ value\ from\ the\ hashMap\ and\ diary.\n
comment3.params=
comment3.target=java.util.ArrayList\ getReservationNos()
comment3.text=\n\ Return\ the\ keys\ of\ @libraryReservationMap\ as\ a\ list.\n
comment4.params=
comment4.target=java.util.ArrayList\ getUsers()
comment4.text=\n\ Return\ the\ values\ of\ @customerMap\ as\ a\ list.\n
comment5.params=
comment5.target=java.util.ArrayList\ getItems()
comment5.text=\n\ Return\ the\ values\ of\ @itemsMap\ as\ a\ list.\n
comment6.params=
comment6.target=java.util.ArrayList\ getLibraryReservations()
comment6.text=\n\ Return\ the\ values\ of\ @libraryReservationMap\ as\ a\ list.\n
comment7.params=item
comment7.target=void\ storeItem(LibraryItem)
comment7.text=\n\ Inserts\ object\ value\ item\ alongside\ key\ of\ @itemCode\ into\ @itemsMap.\n
comment8.params=user
comment8.target=void\ storeUser(LibraryUser)
comment8.text=\n\ Inserts\ object\ value\ user\ alongside\ key\ of\ @userID\ into\ @customerMap.\n\ If\ the\ userID\ is\ set\ to\ unknown,\ it\ will\ call\ @generateUserID.\n
comment9.params=reservation
comment9.target=void\ storeLibraryReservation(LibraryReservation)
comment9.text=\n\ Inserts\ object\ value\ reservation\ alongside\ key\ of\ @reservationNo\ into\ @libraryReservationMap.\n
numComments=21