vault backup: 2024-04-12 09:39:31
This commit is contained in:
1 parent
e241fe8bd6
commit
30bfa6f243
73 files changed
+760
-401
No files matched your search
Vendored
+15
-16
@@ -70,8 +70,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "horizontal",
|
"direction": "horizontal",
|
||||||
"width": 200,
|
"width": 200
|
||||||
"collapsed": true
|
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"id": "ee8f6df41634f71e",
|
"id": "ee8f6df41634f71e",
|
||||||
@@ -156,7 +155,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "horizontal",
|
"direction": "horizontal",
|
||||||
"width": 200
|
"width": 417.5
|
||||||
},
|
},
|
||||||
"left-ribbon": {
|
"left-ribbon": {
|
||||||
"hiddenItems": {
|
"hiddenItems": {
|
||||||
@@ -167,42 +166,42 @@
|
|||||||
"switcher:Open quick switcher": false
|
"switcher:Open quick switcher": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": "f5285cbbb611ecba",
|
"active": "671043c113c40804",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Semester 2/Programming 2/Assessment 4 Notes",
|
"Semester 2/Programming 2/Project/Part 2/package.bluej",
|
||||||
|
"Semester 2/Programming 2/Project/Part 2",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete.zip",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/resources/inherit.gif",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/stylesheet.css",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/resources",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-summary.html",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-list",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-frame.html",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/logfile.txt",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/index.html",
|
||||||
|
"Semester 2/Programming 2/Project/Part 4 Complete/doc/constant-values.html",
|
||||||
"images/Pasted image 20240319234142.png",
|
"images/Pasted image 20240319234142.png",
|
||||||
"images/Pasted image 20240319225420.png",
|
"images/Pasted image 20240319225420.png",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q4.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q4.md",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q5.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q5.md",
|
||||||
"images/Pasted image 20240319224232.png",
|
"images/Pasted image 20240319224232.png",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q3.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q3.md",
|
||||||
"Semester 2/Database Systems/Exercise Booklet.pdf",
|
|
||||||
"Semester 2/Database Systems/Booklet of Lecture Slides for Semester Two (2).pdf",
|
|
||||||
"Semester 2/Database Systems/Week 10/Week 10 Database Systems.md",
|
"Semester 2/Database Systems/Week 10/Week 10 Database Systems.md",
|
||||||
"images/Pasted image 20240319163053.png",
|
"images/Pasted image 20240319163053.png",
|
||||||
"images/Pasted image 20240319162824.png",
|
"images/Pasted image 20240319162824.png",
|
||||||
"images/Pasted image 20240319161202.png",
|
"images/Pasted image 20240319161202.png",
|
||||||
"images/Pasted image 20240319160609.png",
|
"images/Pasted image 20240319160609.png",
|
||||||
"Semester 2/Programming 2/Week 10 Revision/Q1.md",
|
"Semester 2/Programming 2/Week 10 Revision/Q1.md",
|
||||||
"Semester 2/Programming 2/Week 10 Revision",
|
|
||||||
"Semester 2/Database Systems/Week 2/Week 2 Database Systems.md",
|
"Semester 2/Database Systems/Week 2/Week 2 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 1/Week 1 Database Systems.md",
|
"Semester 2/Database Systems/Week 1/Week 1 Database Systems.md",
|
||||||
"Semester 1/Database Systems/Week 10/Week 10 Database Systems.md",
|
"Semester 1/Database Systems/Week 10/Week 10 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 3/Week 3 Database Systems.md",
|
"Semester 2/Database Systems/Week 3/Week 3 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 4/Week 4 Database Systems.md",
|
"Semester 2/Database Systems/Week 4/Week 4 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 10",
|
|
||||||
"Semester 2/Database Systems/Week 9/Week 9 Database Systems.md",
|
"Semester 2/Database Systems/Week 9/Week 9 Database Systems.md",
|
||||||
"images/Pasted image 20240312161933.png",
|
"images/Pasted image 20240312161933.png",
|
||||||
"images/Pasted image 20240312161927.png",
|
"images/Pasted image 20240312161927.png",
|
||||||
"images/Pasted image 20240312161656.png",
|
|
||||||
"Semester 2/Database Systems/Week 8/Week 8 Database Systems.md",
|
"Semester 2/Database Systems/Week 8/Week 8 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 9",
|
|
||||||
"Semester 2/Untitled",
|
|
||||||
"Semester 2/Programming 2/Project/Part 2/__SHELL1.class",
|
|
||||||
"Semester 2/Programming 2/Project/Part 2/__SHELL1.java",
|
|
||||||
"Semester 2/Programming 2/Project/Part 2/Library.java#",
|
|
||||||
"Semester 2/Database Systems/Week 7/Week 7 Database Systems.md",
|
"Semester 2/Database Systems/Week 7/Week 7 Database Systems.md",
|
||||||
"Semester 2/Programming 2/Project/Part 2/Book.java#",
|
|
||||||
"Semester 2/Database Systems/Week 6/Week 6 Database Systems.md",
|
"Semester 2/Database Systems/Week 6/Week 6 Database Systems.md",
|
||||||
"Semester 2/Computer Systems Internals & Linux/Week 6/Week 6 Computer Systems Internals.md",
|
"Semester 2/Computer Systems Internals & Linux/Week 6/Week 6 Computer Systems Internals.md",
|
||||||
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS3.md",
|
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS3.md",
|
||||||
|
|||||||
Binary file not shown.
@@ -1,45 +0,0 @@
|
|||||||
#BlueJ class context
|
|
||||||
comment0.params=
|
|
||||||
comment0.target=Library()
|
|
||||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ Library\n
|
|
||||||
comment1.params=item
|
|
||||||
comment1.target=void\ storeItem(LibraryItem)
|
|
||||||
comment1.text=\n\ Inserts\ object\ value\ item\ alongside\ key\ of\ @itemCode\ into\ @itemsMap.\n
|
|
||||||
comment10.params=
|
|
||||||
comment10.target=void\ writeUserData()
|
|
||||||
comment10.text=\n\ A\ method\ to\ output\ all\ user\ data\ to\ a\ file\ using\ a\ fileDialog\ to\ specify\ file\ location.\n\ \n
|
|
||||||
comment11.params=
|
|
||||||
comment11.target=void\ readLibraryReservationData()
|
|
||||||
comment11.text=\n\ Read\ Library\ Reservation\ Data\ from\ a\ file\ specified\ by\ the\ user.\n
|
|
||||||
comment12.params=
|
|
||||||
comment12.target=void\ readData()
|
|
||||||
comment12.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
|
|
||||||
comment13.params=userID\ itemCode\ startDate\ noOfDays
|
|
||||||
comment13.target=boolean\ makeLibraryReservation(java.lang.String,\ java.lang.String,\ java.lang.String,\ int)
|
|
||||||
comment13.text=\n\ Create\ a\ reservation\ to\ allow\ a\ user\ to\ reserve\ an\ item\ from\ the\ library.\n
|
|
||||||
comment14.params=reservationNo
|
|
||||||
comment14.target=void\ deleteLibraryReservation(java.lang.String)
|
|
||||||
comment2.params=user
|
|
||||||
comment2.target=void\ storeUser(LibraryUser)
|
|
||||||
comment2.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
|
|
||||||
comment3.params=reservation
|
|
||||||
comment3.target=void\ storeLibraryReservation(LibraryReservation)
|
|
||||||
comment3.text=\n\ Inserts\ object\ value\ reservation\ alongside\ key\ of\ @reservationNo\ into\ @libraryReservationMap.\n
|
|
||||||
comment4.params=
|
|
||||||
comment4.target=java.lang.String\ generateReservationNo()
|
|
||||||
comment4.text=\n\ Generate\ a\ sequential\ reservation\ number.\ Since\ Maps\ do\ not\ have\ an\ index,\ we\ cannot\ simply\ get\ the\ last\ value,\ \n\ and\ recursion\ would\ be\ too\ intensive\ for\ this\ application.\ As\ a\ placeholder\ for\ the\ file\ output,\ a\ field\ variable\n\ is\ used\ to\ hold\ the\ last\ highest\ value\ for\ the\ reservation\ number.\ Unlike\ @generateUserID,\ this\ has\ a\ maximum\ value\n\ hardcoded\ to\ the\ spec.\ This\ likely\ will\ not\ be\ an\ issue\ since\ we\ can\ still\ have\ 1,000,000\ reservations.\n
|
|
||||||
comment5.params=prefix\ length
|
|
||||||
comment5.target=java.lang.String\ generateUserID(java.lang.String,\ int)
|
|
||||||
comment5.text=\n\ Returns\ a\ random\ unique\ user\ ID\ by\ specifying\ \n\ @prefix\ -\ arbitrary\ alphanumeric\ prefix\n\ @length\ -\ length\ of\ numeric\ ID\n\ and\ returning\ a\ unique\ user\ id\n\ @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
|
|
||||||
comment6.params=
|
|
||||||
comment6.target=void\ printLibraryReservations()
|
|
||||||
comment6.text=\n\ Prints\ to\ the\ terminal,\ in\ a\ human-readable\ format,\ library\ reservation\ in\ the\ itemList\n\ \n\ Contains\ a\ marker\ at\ the\ start\ and\ end\ to\ visualise\ in\ terminal\ output.\n
|
|
||||||
comment7.params=
|
|
||||||
comment7.target=void\ printAll()
|
|
||||||
comment7.text=\n\ Prints\ to\ the\ terminal,\ in\ a\ human-readable\ format,\ all\ items\ in\ the\ itemList\n\ \n\ Contains\ a\ marker\ at\ the\ start\ and\ end\ to\ visualise\ in\ terminal\ output.\n
|
|
||||||
comment8.params=start\ end
|
|
||||||
comment8.target=void\ printDiaryEntries(java.lang.String,\ java.lang.String)
|
|
||||||
comment9.params=
|
|
||||||
comment9.target=void\ writeLibraryReservationData()
|
|
||||||
comment9.text=\n\ Write\ all\ current\ library\ reservations\ to\ a\ file\ specified\ by\ the\ user.\n
|
|
||||||
numComments=15
|
|
||||||
Binary file not shown.
@@ -1,46 +0,0 @@
|
|||||||
#BlueJ class context
|
|
||||||
comment0.params=reservationNo\ itemCode\ userID\ startDate\ noOfDays
|
|
||||||
comment0.target=LibraryReservation(java.lang.String,\ java.lang.String,\ java.lang.String,\ java.lang.String,\ int)
|
|
||||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ LibraryReservation\n
|
|
||||||
comment1.params=
|
|
||||||
comment1.target=LibraryReservation()
|
|
||||||
comment10.params=
|
|
||||||
comment10.target=int\ getNoOfDays()
|
|
||||||
comment10.text=\n\ Return\ value\ of\ @noOfDays\n
|
|
||||||
comment11.params=reservationNo
|
|
||||||
comment11.target=void\ setReservationNo(java.lang.String)
|
|
||||||
comment11.text=\n\ Set\ @reservationNo\ to\ a\ new\ value\n
|
|
||||||
comment12.params=itemCode
|
|
||||||
comment12.target=void\ setItemCode(java.lang.String)
|
|
||||||
comment12.text=\n\ Set\ @itemCode\ to\ a\ new\ value\n
|
|
||||||
comment13.params=userID
|
|
||||||
comment13.target=void\ setUserID(java.lang.String)
|
|
||||||
comment13.text=\n\ Set\ @userID\ to\ a\ new\ value\n
|
|
||||||
comment14.params=startDate
|
|
||||||
comment14.target=void\ setStartDate(java.lang.String)
|
|
||||||
comment14.text=\n\ Set\ @startDate\ to\ a\ new\ value\n
|
|
||||||
comment15.params=noOfDays
|
|
||||||
comment15.target=void\ setNoOfDays(int)
|
|
||||||
comment15.text=\n\ Set\ @noOfDays\ to\ a\ new\ value\n
|
|
||||||
comment2.params=
|
|
||||||
comment2.target=java.lang.String\ toString()
|
|
||||||
comment3.params=
|
|
||||||
comment3.target=void\ printDetails()
|
|
||||||
comment3.text=\n\ Prints\ to\ terminal,\ the\ details\ of\ the\ reservation.\n
|
|
||||||
comment4.params=writer
|
|
||||||
comment4.target=void\ writeData(java.io.PrintWriter)
|
|
||||||
comment5.params=detailScanner
|
|
||||||
comment5.target=void\ readData(java.util.Scanner)
|
|
||||||
comment6.params=
|
|
||||||
comment6.target=java.lang.String\ getReservationNo()
|
|
||||||
comment6.text=\n\ Return\ value\ of\ @reservationNo\n
|
|
||||||
comment7.params=
|
|
||||||
comment7.target=java.lang.String\ getItemCode()
|
|
||||||
comment7.text=\n\ Return\ value\ of\ @itemCode\n
|
|
||||||
comment8.params=
|
|
||||||
comment8.target=java.lang.String\ getUserID()
|
|
||||||
comment8.text=\n\ Return\ value\ of\ @userID\n
|
|
||||||
comment9.params=
|
|
||||||
comment9.target=java.util.Date\ getStartDate()
|
|
||||||
comment9.text=\n\ Return\ value\ of\ @startDate\n
|
|
||||||
numComments=16
|
|
||||||
@@ -2,6 +2,15 @@
|
|||||||
dependency1.from=Library
|
dependency1.from=Library
|
||||||
dependency1.to=Book
|
dependency1.to=Book
|
||||||
dependency1.type=UsesDependency
|
dependency1.type=UsesDependency
|
||||||
|
dependency10.from=Diary
|
||||||
|
dependency10.to=LibraryReservation
|
||||||
|
dependency10.type=UsesDependency
|
||||||
|
dependency11.from=Diary
|
||||||
|
dependency11.to=DateUtil
|
||||||
|
dependency11.type=UsesDependency
|
||||||
|
dependency12.from=Library
|
||||||
|
dependency12.to=Diary
|
||||||
|
dependency12.type=UsesDependency
|
||||||
dependency2.from=Library
|
dependency2.from=Library
|
||||||
dependency2.to=Periodical
|
dependency2.to=Periodical
|
||||||
dependency2.type=UsesDependency
|
dependency2.type=UsesDependency
|
||||||
@@ -23,157 +32,173 @@ dependency7.type=UsesDependency
|
|||||||
dependency8.from=Library
|
dependency8.from=Library
|
||||||
dependency8.to=LibraryReservation
|
dependency8.to=LibraryReservation
|
||||||
dependency8.type=UsesDependency
|
dependency8.type=UsesDependency
|
||||||
|
dependency9.from=Library
|
||||||
|
dependency9.to=DateUtil
|
||||||
|
dependency9.type=UsesDependency
|
||||||
objectbench.height=76
|
objectbench.height=76
|
||||||
objectbench.width=940
|
objectbench.width=940
|
||||||
package.editor.height=874
|
package.editor.height=874
|
||||||
package.editor.width=814
|
package.editor.width=814
|
||||||
package.editor.x=0
|
package.editor.x=861
|
||||||
package.editor.y=31
|
package.editor.y=66
|
||||||
package.numDependencies=8
|
package.numDependencies=12
|
||||||
package.numTargets=11
|
package.numTargets=12
|
||||||
package.showExtends=true
|
package.showExtends=true
|
||||||
package.showUses=true
|
package.showUses=true
|
||||||
project.charset=UTF-8
|
project.charset=UTF-8
|
||||||
target1.editor.height=700
|
target1.editor.height=786
|
||||||
target1.editor.width=900
|
target1.editor.width=960
|
||||||
target1.editor.x=1017
|
target1.editor.x=34
|
||||||
target1.editor.y=76
|
target1.editor.y=174
|
||||||
target1.height=50
|
target1.height=50
|
||||||
target1.name=PrintedItem
|
target1.name=CD
|
||||||
target1.naviview.expanded=true
|
target1.naviview.expanded=true
|
||||||
target1.showInterface=false
|
target1.showInterface=false
|
||||||
target1.type=AbstractTarget
|
target1.type=ClassTarget
|
||||||
target1.typeParameters=
|
target1.typeParameters=
|
||||||
target1.width=110
|
target1.width=80
|
||||||
target1.x=130
|
target1.x=360
|
||||||
target1.y=240
|
target1.y=340
|
||||||
target10.editor.height=700
|
target10.editor.height=1049
|
||||||
target10.editor.width=900
|
target10.editor.width=1920
|
||||||
target10.editor.x=960
|
target10.editor.x=0
|
||||||
target10.editor.y=146
|
target10.editor.y=31
|
||||||
target10.height=50
|
target10.height=50
|
||||||
target10.name=AudioVisual
|
target10.name=Book
|
||||||
target10.naviview.expanded=true
|
target10.naviview.expanded=true
|
||||||
target10.showInterface=false
|
target10.showInterface=false
|
||||||
target10.type=AbstractTarget
|
target10.type=ClassTarget
|
||||||
target10.typeParameters=
|
target10.typeParameters=
|
||||||
target10.width=110
|
target10.width=80
|
||||||
target10.x=380
|
target10.x=180
|
||||||
target10.y=240
|
target10.y=340
|
||||||
target11.editor.height=700
|
target11.editor.height=1049
|
||||||
target11.editor.width=900
|
target11.editor.width=1920
|
||||||
target11.editor.x=40
|
target11.editor.x=0
|
||||||
target11.editor.y=51
|
target11.editor.y=31
|
||||||
target11.height=50
|
target11.height=50
|
||||||
target11.name=LibraryReservation
|
target11.name=Library
|
||||||
target11.naviview.expanded=true
|
target11.naviview.expanded=true
|
||||||
target11.showInterface=false
|
target11.showInterface=false
|
||||||
target11.type=ClassTarget
|
target11.type=ClassTarget
|
||||||
target11.typeParameters=
|
target11.typeParameters=
|
||||||
target11.width=160
|
target11.width=100
|
||||||
target11.x=230
|
target11.x=260
|
||||||
target11.y=440
|
target11.y=240
|
||||||
target2.editor.height=786
|
target12.editor.height=700
|
||||||
target2.editor.width=960
|
target12.editor.width=900
|
||||||
target2.editor.x=34
|
target12.editor.x=960
|
||||||
target2.editor.y=174
|
target12.editor.y=146
|
||||||
target2.height=50
|
target12.height=50
|
||||||
target2.name=CD
|
target12.name=AudioVisual
|
||||||
|
target12.naviview.expanded=true
|
||||||
|
target12.showInterface=false
|
||||||
|
target12.type=AbstractTarget
|
||||||
|
target12.typeParameters=
|
||||||
|
target12.width=110
|
||||||
|
target12.x=380
|
||||||
|
target12.y=240
|
||||||
|
target2.editor.height=1049
|
||||||
|
target2.editor.width=1920
|
||||||
|
target2.editor.x=0
|
||||||
|
target2.editor.y=31
|
||||||
|
target2.height=60
|
||||||
|
target2.name=LibraryItem
|
||||||
target2.naviview.expanded=true
|
target2.naviview.expanded=true
|
||||||
target2.showInterface=false
|
target2.showInterface=false
|
||||||
target2.type=ClassTarget
|
target2.type=AbstractTarget
|
||||||
target2.typeParameters=
|
target2.typeParameters=
|
||||||
target2.width=80
|
target2.width=120
|
||||||
target2.x=360
|
target2.x=250
|
||||||
target2.y=340
|
target2.y=110
|
||||||
target3.editor.height=700
|
target3.editor.height=700
|
||||||
target3.editor.width=900
|
target3.editor.width=1619
|
||||||
target3.editor.x=557
|
target3.editor.x=192
|
||||||
target3.editor.y=177
|
target3.editor.y=267
|
||||||
target3.height=60
|
target3.height=50
|
||||||
target3.name=LibraryItem
|
target3.name=Periodical
|
||||||
target3.naviview.expanded=true
|
target3.naviview.expanded=true
|
||||||
target3.showInterface=false
|
target3.showInterface=false
|
||||||
target3.type=AbstractTarget
|
target3.type=ClassTarget
|
||||||
target3.typeParameters=
|
target3.typeParameters=
|
||||||
target3.width=120
|
target3.width=90
|
||||||
target3.x=250
|
target3.x=60
|
||||||
target3.y=110
|
target3.y=380
|
||||||
target4.editor.height=1049
|
target4.editor.height=700
|
||||||
target4.editor.width=1920
|
target4.editor.width=900
|
||||||
target4.editor.x=0
|
target4.editor.x=40
|
||||||
target4.editor.y=31
|
target4.editor.y=51
|
||||||
target4.height=50
|
target4.height=50
|
||||||
target4.name=DVD
|
target4.name=DateUtil
|
||||||
target4.naviview.expanded=true
|
target4.naviview.expanded=true
|
||||||
target4.showInterface=false
|
target4.showInterface=true
|
||||||
target4.type=ClassTarget
|
target4.type=ClassTarget
|
||||||
target4.typeParameters=
|
target4.typeParameters=
|
||||||
target4.width=80
|
target4.width=80
|
||||||
target4.x=470
|
target4.x=70
|
||||||
target4.y=380
|
target4.y=10
|
||||||
target5.editor.height=700
|
target5.editor.height=700
|
||||||
target5.editor.width=900
|
target5.editor.width=900
|
||||||
target5.editor.x=55
|
target5.editor.x=967
|
||||||
target5.editor.y=274
|
target5.editor.y=142
|
||||||
target5.height=50
|
target5.height=50
|
||||||
target5.name=LibraryUser
|
target5.name=Diary
|
||||||
target5.naviview.expanded=true
|
target5.naviview.expanded=true
|
||||||
target5.showInterface=false
|
target5.showInterface=false
|
||||||
target5.type=ClassTarget
|
target5.type=ClassTarget
|
||||||
target5.typeParameters=
|
target5.typeParameters=
|
||||||
target5.width=110
|
target5.width=80
|
||||||
target5.x=100
|
target5.x=530
|
||||||
target5.y=170
|
target5.y=240
|
||||||
target6.editor.height=700
|
target6.editor.height=1049
|
||||||
target6.editor.width=1619
|
target6.editor.width=960
|
||||||
target6.editor.x=192
|
target6.editor.x=960
|
||||||
target6.editor.y=267
|
target6.editor.y=31
|
||||||
target6.height=50
|
target6.height=50
|
||||||
target6.name=Periodical
|
target6.name=LibraryReservation
|
||||||
target6.naviview.expanded=true
|
target6.naviview.expanded=true
|
||||||
target6.showInterface=false
|
target6.showInterface=false
|
||||||
target6.type=ClassTarget
|
target6.type=ClassTarget
|
||||||
target6.typeParameters=
|
target6.typeParameters=
|
||||||
target6.width=90
|
target6.width=160
|
||||||
target6.x=60
|
target6.x=230
|
||||||
target6.y=380
|
target6.y=440
|
||||||
target7.editor.height=1049
|
target7.editor.height=700
|
||||||
target7.editor.width=1920
|
target7.editor.width=900
|
||||||
target7.editor.x=0
|
target7.editor.x=1017
|
||||||
target7.editor.y=31
|
target7.editor.y=76
|
||||||
target7.height=50
|
target7.height=50
|
||||||
target7.name=Book
|
target7.name=PrintedItem
|
||||||
target7.naviview.expanded=true
|
target7.naviview.expanded=true
|
||||||
target7.showInterface=false
|
target7.showInterface=false
|
||||||
target7.type=ClassTarget
|
target7.type=AbstractTarget
|
||||||
target7.typeParameters=
|
target7.typeParameters=
|
||||||
target7.width=80
|
target7.width=110
|
||||||
target7.x=180
|
target7.x=130
|
||||||
target7.y=340
|
target7.y=240
|
||||||
target8.editor.height=700
|
target8.editor.height=1049
|
||||||
target8.editor.width=900
|
target8.editor.width=1920
|
||||||
target8.editor.x=40
|
target8.editor.x=0
|
||||||
target8.editor.y=51
|
target8.editor.y=31
|
||||||
target8.height=50
|
target8.height=50
|
||||||
target8.name=DateUtil
|
target8.name=DVD
|
||||||
target8.naviview.expanded=true
|
target8.naviview.expanded=true
|
||||||
target8.showInterface=false
|
target8.showInterface=false
|
||||||
target8.type=ClassTarget
|
target8.type=ClassTarget
|
||||||
target8.typeParameters=
|
target8.typeParameters=
|
||||||
target8.width=80
|
target8.width=80
|
||||||
target8.x=70
|
target8.x=470
|
||||||
target8.y=10
|
target8.y=380
|
||||||
target9.editor.height=1049
|
target9.editor.height=1049
|
||||||
target9.editor.width=1920
|
target9.editor.width=960
|
||||||
target9.editor.x=0
|
target9.editor.x=0
|
||||||
target9.editor.y=31
|
target9.editor.y=31
|
||||||
target9.height=50
|
target9.height=50
|
||||||
target9.name=Library
|
target9.name=LibraryUser
|
||||||
target9.naviview.expanded=true
|
target9.naviview.expanded=true
|
||||||
target9.showInterface=false
|
target9.showInterface=false
|
||||||
target9.type=ClassTarget
|
target9.type=ClassTarget
|
||||||
target9.typeParameters=
|
target9.typeParameters=
|
||||||
target9.width=100
|
target9.width=110
|
||||||
target9.x=260
|
target9.x=100
|
||||||
target9.y=240
|
target9.y=170
|
||||||
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -10,4 +10,5 @@ comment2.target=void\ printDetails()
|
|||||||
comment2.text=\n\ Field\ Mutator\ End\n
|
comment2.text=\n\ Field\ Mutator\ End\n
|
||||||
comment3.params=detailScanner
|
comment3.params=detailScanner
|
||||||
comment3.target=void\ readItemData(java.util.Scanner)
|
comment3.target=void\ readItemData(java.util.Scanner)
|
||||||
|
comment3.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
numComments=4
|
numComments=4
|
||||||
+6
-1
@@ -3,7 +3,7 @@
|
|||||||
* Subclass of LibraryItem to create objects of audio and visual items in a library.
|
* Subclass of LibraryItem to create objects of audio and visual items in a library.
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @1.0
|
* @1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -41,6 +41,11 @@ public abstract class AudioVisual extends LibraryItem
|
|||||||
super.printDetails();
|
super.printDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
|
*/
|
||||||
public void readItemData( Scanner detailScanner ){
|
public void readItemData( Scanner detailScanner ){
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
this.playingTime = Integer.parseInt( detailScanner.next().trim() );
|
this.playingTime = Integer.parseInt( detailScanner.next().trim() );
|
||||||
BIN
Binary file not shown.
+1
-1
@@ -19,5 +19,5 @@ comment5.target=void\ printDetails()
|
|||||||
comment5.text=\n\ Print\ to\ terminal,\ relevant\ details\ of\ current\ object.\n
|
comment5.text=\n\ Print\ to\ terminal,\ relevant\ details\ of\ current\ object.\n
|
||||||
comment6.params=detailScanner
|
comment6.params=detailScanner
|
||||||
comment6.target=void\ readItemData(java.util.Scanner)
|
comment6.target=void\ readItemData(java.util.Scanner)
|
||||||
comment6.text=\n\ Passed\ a\ scanner\ object,\ set\ field\ variables\ to\ corresponding\ values.\n
|
comment6.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
numComments=7
|
numComments=7
|
||||||
+6
-3
@@ -3,10 +3,11 @@
|
|||||||
* Subclass of LibraryItem that emulates a Book item.
|
* Subclass of LibraryItem that emulates a Book item.
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @2.3
|
* @2.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
public class Book extends PrintedItem
|
public class Book extends PrintedItem
|
||||||
{
|
{
|
||||||
@@ -60,8 +61,10 @@ public class Book extends PrintedItem
|
|||||||
super.printDetails();
|
super.printDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a scanner object, set field variables to corresponding values.
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
*/
|
*/
|
||||||
public void readItemData( Scanner detailScanner ){
|
public void readItemData( Scanner detailScanner ){
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
BIN
Binary file not shown.
+1
-1
@@ -19,5 +19,5 @@ comment5.target=void\ printDetails()
|
|||||||
comment5.text=\n\ Print\ to\ terminal,\ relevant\ details\ of\ current\ object.\n
|
comment5.text=\n\ Print\ to\ terminal,\ relevant\ details\ of\ current\ object.\n
|
||||||
comment6.params=detailScanner
|
comment6.params=detailScanner
|
||||||
comment6.target=void\ readItemData(java.util.Scanner)
|
comment6.target=void\ readItemData(java.util.Scanner)
|
||||||
comment6.text=\n\ Passed\ a\ scanner,\ set\ the\ relevant\ details\ to\ their\ corresponding\ field\ variables.\n
|
comment6.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
numComments=7
|
numComments=7
|
||||||
+5
-3
@@ -3,7 +3,7 @@
|
|||||||
* Subclass of AudioVisual, to create objects of a CD.
|
* Subclass of AudioVisual, to create objects of a CD.
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @1.0
|
* @1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -60,8 +60,10 @@ public class CD extends AudioVisual
|
|||||||
super.printDetails();
|
super.printDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a scanner, set the relevant details to their corresponding field variables.
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
*/
|
*/
|
||||||
public void readItemData( Scanner detailScanner ){
|
public void readItemData( Scanner detailScanner ){
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
BIN
Binary file not shown.
+1
-1
@@ -13,5 +13,5 @@ comment3.target=void\ printDetails()
|
|||||||
comment3.text=\n\ Print\ relevant\ details\ of\ the\ current\ object.\n
|
comment3.text=\n\ Print\ relevant\ details\ of\ the\ current\ object.\n
|
||||||
comment4.params=detailScanner
|
comment4.params=detailScanner
|
||||||
comment4.target=void\ readItemData(java.util.Scanner)
|
comment4.target=void\ readItemData(java.util.Scanner)
|
||||||
comment4.text=\n\ Passed\ a\ scanner\ object,\ give\ the\ relevant\ variable\ a\ value.\n
|
comment4.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
numComments=5
|
numComments=5
|
||||||
+5
-3
@@ -3,7 +3,7 @@
|
|||||||
* Subclass of AudioVisual to create objects of DVD items.
|
* Subclass of AudioVisual to create objects of DVD items.
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @1.0
|
* @1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -42,8 +42,10 @@ public class DVD extends AudioVisual
|
|||||||
super.printDetails();
|
super.printDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a scanner object, give the relevant variable a value.
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
*/
|
*/
|
||||||
public void readItemData( Scanner detailScanner ){
|
public void readItemData( Scanner detailScanner ){
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
@@ -0,0 +1,65 @@
|
|||||||
|
#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
|
||||||
+171
-60
@@ -1,17 +1,17 @@
|
|||||||
// Import all required libraries. Not using .* as it is not good practice due to potential conflicts.
|
// Import all required libraries. Not using .* as it is not good practice due to potential conflicts.
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.awt.FileDialog;
|
import java.awt.FileDialog;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to create objects of a Library, which can hold and report on assets held within
|
* Class to create objects of a Library, which can hold and report on assets held within
|
||||||
@@ -51,6 +51,63 @@ public class Library
|
|||||||
diary = new Diary();
|
diary = new Diary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessor Start
|
||||||
|
*
|
||||||
|
* Possible scope creep, but thought it would be useful or even required for top marks to have accessors here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the keys of @customerMap as a list.
|
||||||
|
*/
|
||||||
|
public ArrayList getUserIDs()
|
||||||
|
{
|
||||||
|
return new ArrayList<String>( customerMap.keySet() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the keys of @itemsMap as a list.
|
||||||
|
*/
|
||||||
|
public ArrayList getItemCodes()
|
||||||
|
{
|
||||||
|
return new ArrayList<String>( itemsMap.keySet() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the keys of @libraryReservationMap as a list.
|
||||||
|
*/
|
||||||
|
public ArrayList getReservationNos()
|
||||||
|
{
|
||||||
|
return new ArrayList<String>( libraryReservationMap.keySet() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the values of @customerMap as a list.
|
||||||
|
*/
|
||||||
|
public ArrayList getUsers()
|
||||||
|
{
|
||||||
|
return new ArrayList<LibraryUser>( customerMap.values() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the values of @itemsMap as a list.
|
||||||
|
*/
|
||||||
|
public ArrayList getItems()
|
||||||
|
{
|
||||||
|
return new ArrayList<LibraryItem>( itemsMap.values() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the values of @libraryReservationMap as a list.
|
||||||
|
*/
|
||||||
|
public ArrayList getLibraryReservations()
|
||||||
|
{
|
||||||
|
return new ArrayList<LibraryReservation>( libraryReservationMap.values() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessor End
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storing Objects Start
|
* Storing Objects Start
|
||||||
@@ -79,9 +136,9 @@ public class Library
|
|||||||
customerMap.put( user.getUserID(), user ); // Store the user along with the userID.
|
customerMap.put( user.getUserID(), user ); // Store the user along with the userID.
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Inserts object value reservation alongside key of @reservationNo into @libraryReservationMap.
|
* Inserts object value reservation alongside key of @reservationNo into @libraryReservationMap.
|
||||||
*/
|
**/
|
||||||
private void storeLibraryReservation( LibraryReservation reservation )
|
private void storeLibraryReservation( LibraryReservation reservation )
|
||||||
{
|
{
|
||||||
libraryReservationMap.put( reservation.getReservationNo(), reservation );
|
libraryReservationMap.put( reservation.getReservationNo(), reservation );
|
||||||
@@ -97,13 +154,20 @@ public class Library
|
|||||||
* Generate IDs Start
|
* Generate IDs Start
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Generate a sequential reservation number. Since Maps do not have an index, we cannot simply get the last value,
|
* Generate a sequential reservation number padded with 0s to a length of 6.
|
||||||
* and recursion would be too intensive for this application. As a placeholder for the file output, a field variable
|
*
|
||||||
* is used to hold the last highest value for the reservation number. Unlike @generateUserID, this has a maximum value
|
* 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.
|
||||||
* hardcoded to the spec. This likely will not be an issue since we can still have 1,000,000 reservations.
|
* This is due to the event of program restart, if a field variable is used, the first reservation generated will be of ID "000001"
|
||||||
*/
|
* no matter what. This causes an issue if a file is read to load the reservations into the Library, since IDs will conflict and
|
||||||
public String generateReservationNo()
|
* the value will be overwritten, causing data integrity loss.
|
||||||
|
* Unlike @generateUserID, this has a maximum value hardcoded to the spec.
|
||||||
|
* This likely will not be an issue since we can still have 1,000,000 reservations.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* String @candidateNo - a proposed lowest number that is checked and interated if conflicting.
|
||||||
|
**/
|
||||||
|
private String generateReservationNo()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Originally, I did not check if the number was already taken, however the last part of step 4 introduced deletion.
|
* Originally, I did not check if the number was already taken, however the last part of step 4 introduced deletion.
|
||||||
@@ -118,12 +182,15 @@ public class Library
|
|||||||
return candidateNo;
|
return candidateNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns a random unique user ID by specifying
|
* Generate a unique user identifier to apply to users when the UUID is unknown.
|
||||||
* @prefix - arbitrary alphanumeric prefix
|
* This generates a number of @length length using the Random class, and prefixes @prefix.
|
||||||
* @length - length of numeric ID
|
*
|
||||||
* and returning a unique user id
|
* Takes Parameters
|
||||||
* @uuid - a unique string starting with @prefix, and concat. with a random number
|
* String @prefix - arbitrary alphanumeric prefix
|
||||||
|
* String @length - length of numeric ID
|
||||||
|
* Returns
|
||||||
|
* String @uuid - a unique string starting with @prefix, and concat. with a random number
|
||||||
*
|
*
|
||||||
* Example: length = 6, expected result should be under 999,999 and above 99,999.
|
* Example: length = 6, expected result should be under 999,999 and above 99,999.
|
||||||
* If we just use 10^(length), this would generate any number under 1,000,000.
|
* If we just use 10^(length), this would generate any number under 1,000,000.
|
||||||
@@ -133,7 +200,7 @@ public class Library
|
|||||||
*
|
*
|
||||||
* Note: I am aware that this is overengineered, and that several random integers of amount @length could be used,
|
* Note: I am aware that this is overengineered, and that several random integers of amount @length could be used,
|
||||||
* but this is considerably more efficient since there is no iteration involved in the creation of the ID. O(1)
|
* but this is considerably more efficient since there is no iteration involved in the creation of the ID. O(1)
|
||||||
*/
|
**/
|
||||||
private String generateUserID( String prefix, int length )
|
private String generateUserID( String prefix, int length )
|
||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
@@ -174,11 +241,11 @@ public class Library
|
|||||||
* Print Object Details Start
|
* Print Object Details Start
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Prints to the terminal, in a human-readable format, library reservation in the itemList
|
* Prints to the terminal, in a human-readable format, all LibraryReservation(s)
|
||||||
*
|
*
|
||||||
* Contains a marker at the start and end to visualise in terminal output.
|
* Contains a marker at the start and end to visualise in terminal output.
|
||||||
*/
|
**/
|
||||||
public void printLibraryReservations() {
|
public void printLibraryReservations() {
|
||||||
System.out.println( "Reservation Details Start" );
|
System.out.println( "Reservation Details Start" );
|
||||||
for ( LibraryReservation reservation : libraryReservationMap.values() ){
|
for ( LibraryReservation reservation : libraryReservationMap.values() ){
|
||||||
@@ -188,11 +255,16 @@ public class Library
|
|||||||
System.out.println( "---------------\nReservation Details End\n" );
|
System.out.println( "---------------\nReservation Details End\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Prints to the terminal, in a human-readable format, all items in the itemList
|
* Prints to the terminal, in a human-readable format, all:
|
||||||
|
* LibraryItem(s)
|
||||||
|
* LibraryUser(s)
|
||||||
|
* LibraryReservation(s)
|
||||||
*
|
*
|
||||||
* Contains a marker at the start and end to visualise in terminal output.
|
* Contains a marker at the start and end of each type to visualise in terminal output.
|
||||||
*/
|
* For printing the LibraryReservation(s), the corresponding method is called to reduce
|
||||||
|
* code duplication.
|
||||||
|
**/
|
||||||
public void printAll()
|
public void printAll()
|
||||||
{
|
{
|
||||||
System.out.println("\n\nItem Details Start");
|
System.out.println("\n\nItem Details Start");
|
||||||
@@ -212,6 +284,15 @@ public class Library
|
|||||||
printLibraryReservations();
|
printLibraryReservations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print, to the terminal all reservation entries in the diary.
|
||||||
|
* Takes Parameters
|
||||||
|
* String @start
|
||||||
|
* String @end
|
||||||
|
*
|
||||||
|
* This converts both string inputs to Date formats, and calls the printEntries
|
||||||
|
* method in the diary class.
|
||||||
|
*/
|
||||||
public void printDiaryEntries( String start, String end )
|
public void printDiaryEntries( String start, String end )
|
||||||
{
|
{
|
||||||
diary.printEntries( DateUtil.convertStringToDate( start ), DateUtil.convertStringToDate( end ) );
|
diary.printEntries( DateUtil.convertStringToDate( start ), DateUtil.convertStringToDate( end ) );
|
||||||
@@ -225,9 +306,10 @@ public class Library
|
|||||||
* Write Files Start
|
* Write Files Start
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Write all current library reservations to a file specified by the user.
|
* Write all current library reservations to a file specified by the user.
|
||||||
*/
|
* For each user, this passes a printWriter object to the writeData method of LibraryReservation.
|
||||||
|
**/
|
||||||
public void writeLibraryReservationData()
|
public void writeLibraryReservationData()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -246,19 +328,19 @@ public class Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* A method to output all user data to a file using a fileDialog to specify file location.
|
* A method to output all user data to a file using a fileDialog to specify file location.
|
||||||
*
|
* For each user, this passes a printWriter object to the writeData method of LibraryUser.
|
||||||
*/
|
**/
|
||||||
public void writeUserData()
|
public void writeUserData()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Frame frame = null; // Initialise null frame
|
Frame frame = null; // Initialise null frame
|
||||||
FileDialog fileBox = new FileDialog( frame, "Save", FileDialog.SAVE ); // Initialise file dialog box to save written data.
|
FileDialog fileBox = new FileDialog( frame, "Save", FileDialog.SAVE ); // Initialise file dialog box to save written data.
|
||||||
fileBox.setVisible( true );
|
fileBox.setVisible( true );
|
||||||
PrintWriter writer = new PrintWriter( new File( fileBox.getDirectory() + fileBox.getFile() ) );
|
PrintWriter writer = new PrintWriter( new File( fileBox.getDirectory() + fileBox.getFile() ) ); // Create PrintWriter to write user data to.
|
||||||
// for ( LibraryUser user : userList ){
|
// for ( LibraryUser user : userList ){
|
||||||
writer.println("[Library User data]");
|
writer.println("[Library User data]"); // Write the type header into the file.
|
||||||
for ( LibraryUser user : customerMap.values() ) {
|
for ( LibraryUser user : customerMap.values() ) {
|
||||||
user.writeData( writer );
|
user.writeData( writer );
|
||||||
}
|
}
|
||||||
@@ -277,9 +359,11 @@ public class Library
|
|||||||
* Read Files Start
|
* Read Files Start
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Read Library Reservation Data from a file specified by the user.
|
* Read Library Reservation Data from a file specified by the user.
|
||||||
*/
|
* This passes a scanner to the readData method in LibraryReservation for each
|
||||||
|
* line of the file.
|
||||||
|
**/
|
||||||
public void readLibraryReservationData()
|
public void readLibraryReservationData()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -300,16 +384,19 @@ public class Library
|
|||||||
catch( IOException e ) { // Catch any IO Exceptions that may occur from improper file selection.
|
catch( IOException e ) { // Catch any IO Exceptions that may occur from improper file selection.
|
||||||
System.err.println( "Caught IOException: " + e.getMessage() + "\nAn I/O Exception has occurred, please check file is readable and correct format." );
|
System.err.println( "Caught IOException: " + e.getMessage() + "\nAn I/O Exception has occurred, please check file is readable and correct format." );
|
||||||
}
|
}
|
||||||
|
catch ( NoSuchElementException e ) { // In the event of incorrect formats from a readable file, this prevents a program crash.
|
||||||
|
System.err.println( "Caught Exception: " + e.getMessage() + "\nEnsure File contains the correct information." );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* A method to read all data from files using a fileDialog to specify file location.
|
* A method to read all data from files using a fileDialog to specify file location.
|
||||||
* This will create the corresponding objects depending on flags contained in the file
|
* This will create the corresponding objects depending on flags contained in the file
|
||||||
* and populate it's fields.
|
* and populate it's fields.
|
||||||
*
|
*
|
||||||
* Default flag value: "book", to support legacy files. This will not interfere with
|
* Default flag value: "book", to support legacy files. This will not interfere with
|
||||||
* files of different flag orders.
|
* files of different flag orders.
|
||||||
*/
|
**/
|
||||||
public void readData()
|
public void readData()
|
||||||
{
|
{
|
||||||
Frame frame = null; // Initialise a null frame
|
Frame frame = null; // Initialise a null frame
|
||||||
@@ -318,7 +405,7 @@ public class Library
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Scanner fileScanner = new Scanner( new File( fileBox.getDirectory() + fileBox.getFile() ) );
|
Scanner fileScanner = new Scanner( new File( fileBox.getDirectory() + fileBox.getFile() ) );
|
||||||
String typeFlag = "book"; // Set a default flag to support legacy files.
|
String itemType = "book"; // Set a default flag to support legacy files.
|
||||||
|
|
||||||
while( fileScanner.hasNextLine() ) {
|
while( fileScanner.hasNextLine() ) {
|
||||||
|
|
||||||
@@ -331,18 +418,18 @@ public class Library
|
|||||||
else if ( lineItem.startsWith("[" ) ) {
|
else if ( lineItem.startsWith("[" ) ) {
|
||||||
|
|
||||||
if ( lineItem.toLowerCase().contains("book") )
|
if ( lineItem.toLowerCase().contains("book") )
|
||||||
typeFlag = "book";
|
itemType = "book";
|
||||||
else if ( lineItem.toLowerCase().contains("periodical") )
|
else if ( lineItem.toLowerCase().contains("periodical") )
|
||||||
typeFlag = "periodical";
|
itemType = "periodical";
|
||||||
else if ( lineItem.toLowerCase().contains("cd") )
|
else if ( lineItem.toLowerCase().contains("cd") )
|
||||||
typeFlag = "cd";
|
itemType = "cd";
|
||||||
else if ( lineItem.toLowerCase().contains("dvd") )
|
else if ( lineItem.toLowerCase().contains("dvd") )
|
||||||
typeFlag = "dvd";
|
itemType = "dvd";
|
||||||
else if ( lineItem.toLowerCase().contains("user") )
|
else if ( lineItem.toLowerCase().contains("user") )
|
||||||
typeFlag = "user";
|
itemType = "user";
|
||||||
else {
|
else {
|
||||||
System.out.println( "Flag detected, but no accepted format...\n Cannot store item in Library. Changing Flag to generic and skipping the following: ");
|
System.out.println( "Flag detected, but no accepted format...\n Cannot store item in Library. Changing Flag to generic and skipping the following: ");
|
||||||
typeFlag = "generic";
|
itemType = "generic";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -352,36 +439,36 @@ public class Library
|
|||||||
else {
|
else {
|
||||||
Scanner detailScanner = new Scanner ( lineItem ).useDelimiter(","); // Create a new scanner to grab the values in a comma separated list
|
Scanner detailScanner = new Scanner ( lineItem ).useDelimiter(","); // Create a new scanner to grab the values in a comma separated list
|
||||||
LibraryItem item = null; // Initialise LibraryItem object. Java compiler was being cautious here, so I have to assign the value null.
|
LibraryItem item = null; // Initialise LibraryItem object. Java compiler was being cautious here, so I have to assign the value null.
|
||||||
if ( typeFlag.equals( "book" ) ) {
|
if ( itemType.equals( "book" ) ) {
|
||||||
// Process Book Data
|
// Process Book Data
|
||||||
item = new Book();
|
item = new Book();
|
||||||
}
|
}
|
||||||
else if ( typeFlag.equals( "periodical" ) ) {
|
else if ( itemType.equals( "periodical" ) ) {
|
||||||
// Process Periodic Data
|
// Process Periodic Data
|
||||||
item = new Periodical();
|
item = new Periodical();
|
||||||
}
|
}
|
||||||
else if ( typeFlag.equals( "cd" ) ) {
|
else if ( itemType.equals( "cd" ) ) {
|
||||||
//Process CD Data
|
//Process CD Data
|
||||||
item = new CD();
|
item = new CD();
|
||||||
}
|
}
|
||||||
else if ( typeFlag.equals( "dvd" ) ) {
|
else if ( itemType.equals( "dvd" ) ) {
|
||||||
//Process DVD Data
|
//Process DVD Data
|
||||||
item = new DVD();
|
item = new DVD();
|
||||||
}
|
}
|
||||||
else if ( typeFlag.equals( "user" ) ) {
|
else if ( itemType.equals( "user" ) ) {
|
||||||
//Process User Data
|
//Process User Data
|
||||||
LibraryUser user = new LibraryUser();
|
LibraryUser user = new LibraryUser();
|
||||||
user.readData( detailScanner );
|
user.readData( detailScanner );
|
||||||
storeUser( user );
|
storeUser( user );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ( typeFlag.equals( "generic" ) ) {
|
else if ( itemType.equals( "generic" ) ) {
|
||||||
// Output unaccepted lines to terminal
|
// Output unaccepted lines to terminal
|
||||||
System.out.println( lineItem );
|
System.out.println( lineItem );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.readItemData( detailScanner );
|
item.readItemData( detailScanner ); // Deduped from if statements
|
||||||
storeItem( item );
|
storeItem( item );
|
||||||
detailScanner.close();
|
detailScanner.close();
|
||||||
}
|
}
|
||||||
@@ -391,6 +478,9 @@ public class Library
|
|||||||
catch( IOException e ) { // Catch any IO Exceptions that may occur from improper file selection.
|
catch( IOException e ) { // Catch any IO Exceptions that may occur from improper file selection.
|
||||||
System.err.println( "Caught IOException: " + e.getMessage() + "\nAn I/O Exception has occurred, please check file is readable and correct format." );
|
System.err.println( "Caught IOException: " + e.getMessage() + "\nAn I/O Exception has occurred, please check file is readable and correct format." );
|
||||||
}
|
}
|
||||||
|
catch ( NoSuchElementException e ) { // In the event of incorrect formats from a readable file, this prevents a program crash.
|
||||||
|
System.err.println( "Caught Exception: " + e.getMessage() + "\nEnsure File contains the correct information." );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -401,9 +491,18 @@ public class Library
|
|||||||
* Other Methods
|
* Other Methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Create a reservation to allow a user to reserve an item from the library.
|
* Create a reservation to allow a user to reserve an item from the library. Ensures a reservation is not already
|
||||||
*/
|
* in place for a conflicting itemCode.
|
||||||
|
* Takes parameters
|
||||||
|
* String @userID
|
||||||
|
* String @itemCode
|
||||||
|
* String @startDate
|
||||||
|
* int @noOfDays
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* boolean
|
||||||
|
**/
|
||||||
public boolean makeLibraryReservation( String userID, String itemCode, String startDate, int noOfDays )
|
public boolean makeLibraryReservation( String userID, String itemCode, String startDate, int noOfDays )
|
||||||
{
|
{
|
||||||
if ( !customerMap.containsKey( userID ) )
|
if ( !customerMap.containsKey( userID ) )
|
||||||
@@ -433,8 +532,8 @@ public class Library
|
|||||||
* Unneeded, since addReservations returns any item currently on loan. Dates do not need to be checked for every day in loan.
|
* Unneeded, since addReservations returns any item currently on loan. Dates do not need to be checked for every day in loan.
|
||||||
* Date end = DateUtil.incrementDate( start, noOfDays-1 );
|
* Date end = DateUtil.incrementDate( start, noOfDays-1 );
|
||||||
*/
|
*/
|
||||||
String rID = generateReservationNo();
|
String rID = generateReservationNo(); // Generate a sequential ID for the reservation.
|
||||||
LibraryReservation reservation = new LibraryReservation( rID, itemCode, userID, startDate, noOfDays );
|
LibraryReservation reservation = new LibraryReservation( rID, itemCode, userID, startDate, noOfDays ); // Create new reservation, passing parameters to the constructor.
|
||||||
/** Instead of the following For loop, I could've implemented
|
/** Instead of the following For loop, I could've implemented
|
||||||
* Arrays.asList( diary.getReservation( start, end ).contains( reservation )
|
* Arrays.asList( diary.getReservation( start, end ).contains( reservation )
|
||||||
* Although this would've been easier, this implementation is more in the scope of what we have learned.
|
* Although this would've been easier, this implementation is more in the scope of what we have learned.
|
||||||
@@ -443,20 +542,32 @@ public class Library
|
|||||||
{
|
{
|
||||||
if ( diaryReservation.toString().equals( reservation.toString() ) )
|
if ( diaryReservation.toString().equals( reservation.toString() ) )
|
||||||
{
|
{
|
||||||
return false;
|
System.err.println( "This item is already reserved" );
|
||||||
|
return false; // Reservation unsuccessful
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storeLibraryReservation( reservation );
|
storeLibraryReservation( reservation );
|
||||||
return true;
|
itemsMap.get( itemCode ).setOnLoan( true ); // Set the loan status for the item when the reservation is made
|
||||||
|
return true; // Reservation successful
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows the deletion of a library reservation.
|
||||||
|
*
|
||||||
|
* Takes Parameter
|
||||||
|
* String @reservationNo
|
||||||
|
*
|
||||||
|
* Removes the corresponding value from the hashMap and diary.
|
||||||
|
*/
|
||||||
public void deleteLibraryReservation( String reservationNo )
|
public void deleteLibraryReservation( String reservationNo )
|
||||||
{
|
{
|
||||||
if ( libraryReservationMap.containsKey( reservationNo ) )
|
if ( libraryReservationMap.containsKey( reservationNo ) )
|
||||||
{
|
{
|
||||||
diary.deleteReservation( libraryReservationMap.get( reservationNo ) );
|
// Since the application does not know the time, or use timers, this is the best I can do to remove the loan status.
|
||||||
libraryReservationMap.remove( reservationNo );
|
itemsMap.get ( libraryReservationMap.get( reservationNo ).getItemCode() ).setOnLoan( false );
|
||||||
|
diary.deleteReservation( libraryReservationMap.get( reservationNo ) ); // Remove the reservation from the diary
|
||||||
|
libraryReservationMap.remove( reservationNo ); // Remove the reservation from the Map.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
Binary file not shown.
+2
-2
@@ -6,10 +6,10 @@ comment1.params=
|
|||||||
comment1.target=java.lang.String\ getItemCode()
|
comment1.target=java.lang.String\ getItemCode()
|
||||||
comment10.params=
|
comment10.params=
|
||||||
comment10.target=void\ printDetails()
|
comment10.target=void\ printDetails()
|
||||||
comment10.text=\n\ Print\ to\ terminal,\ relevant\ field\ variables\n
|
comment10.text=\n\ Forms\ field\ variables\ in\ a\ desired\ format,\ prints\n\ to\ the\ PrintWriter,\ and\ flush\ to\ the\ file.\n\ Takes\ Parameter\n\ \ PrintWriter\ @writer\n
|
||||||
comment11.params=detailScanner
|
comment11.params=detailScanner
|
||||||
comment11.target=void\ readItemData(java.util.Scanner)
|
comment11.target=void\ readItemData(java.util.Scanner)
|
||||||
comment11.text=\n\ Passed\ a\ scanner\ object,\ assign\ values\ to\ relevant\ field\ variables\n
|
comment11.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
comment2.params=
|
comment2.params=
|
||||||
comment2.target=int\ getCost()
|
comment2.target=int\ getCost()
|
||||||
comment3.params=
|
comment3.params=
|
||||||
+10
-6
@@ -1,12 +1,11 @@
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Superclass of items / assets stored in a Library.
|
* Superclass of items / assets stored in a Library.
|
||||||
*
|
*
|
||||||
* @author George Wilkinson
|
* @author George Wilkinson
|
||||||
* @version 3.1
|
* @version 4.1
|
||||||
*/
|
*/
|
||||||
public abstract class LibraryItem
|
public abstract class LibraryItem
|
||||||
{
|
{
|
||||||
@@ -80,8 +79,11 @@ public abstract class LibraryItem
|
|||||||
* Field Mutator End
|
* Field Mutator End
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Print to terminal, relevant field variables
|
* Forms field variables in a desired format, prints
|
||||||
|
* to the PrintWriter, and flush to the file.
|
||||||
|
* Takes Parameter
|
||||||
|
* PrintWriter @writer
|
||||||
*/
|
*/
|
||||||
public void printDetails()
|
public void printDetails()
|
||||||
{
|
{
|
||||||
@@ -95,8 +97,10 @@ public abstract class LibraryItem
|
|||||||
System.out.println( "Available to Loan");
|
System.out.println( "Available to Loan");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a scanner object, assign values to relevant field variables
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
*/
|
*/
|
||||||
public void readItemData( Scanner detailScanner ) {
|
public void readItemData( Scanner detailScanner ) {
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,42 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=reservationNo\ itemCode\ userID\ startDate\ noOfDays
|
||||||
|
comment0.target=LibraryReservation(java.lang.String,\ java.lang.String,\ java.lang.String,\ java.lang.String,\ int)
|
||||||
|
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ LibraryReservation\n
|
||||||
|
comment1.params=
|
||||||
|
comment1.target=LibraryReservation()
|
||||||
|
comment1.text=\n\ Default\ Constructor\ for\ objects\ of\ class\ LibraryReservation\n
|
||||||
|
comment10.params=startDate
|
||||||
|
comment10.target=void\ setStartDate(java.lang.String)
|
||||||
|
comment11.params=noOfDays
|
||||||
|
comment11.target=void\ setNoOfDays(int)
|
||||||
|
comment12.params=
|
||||||
|
comment12.target=java.lang.String\ toString()
|
||||||
|
comment12.text=\n\ Concatenates\ values\ to\ output\ a\ formatted\ string.\n
|
||||||
|
comment13.params=
|
||||||
|
comment13.target=void\ printDetails()
|
||||||
|
comment13.text=\n\ Prints\ to\ terminal,\ the\ details\ of\ the\ reservation.\n
|
||||||
|
comment14.params=writer
|
||||||
|
comment14.target=void\ writeData(java.io.PrintWriter)
|
||||||
|
comment14.text=\n\ Forms\ field\ variables\ in\ a\ desired\ format,\ prints\n\ to\ the\ PrintWriter,\ and\ flush\ to\ the\ file.\n\ Takes\ Parameter\n\ \ PrintWriter\ @writer\n
|
||||||
|
comment15.params=detailScanner
|
||||||
|
comment15.target=void\ readData(java.util.Scanner)
|
||||||
|
comment15.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
|
comment2.params=
|
||||||
|
comment2.target=java.lang.String\ getReservationNo()
|
||||||
|
comment2.text=\n\ Accessor\ Start\n
|
||||||
|
comment3.params=
|
||||||
|
comment3.target=java.lang.String\ getItemCode()
|
||||||
|
comment4.params=
|
||||||
|
comment4.target=java.lang.String\ userID()
|
||||||
|
comment5.params=
|
||||||
|
comment5.target=java.util.Date\ getStartDate()
|
||||||
|
comment6.params=
|
||||||
|
comment6.target=int\ getNoOfDays()
|
||||||
|
comment7.params=reservationNo
|
||||||
|
comment7.target=void\ setReservationNo(java.lang.String)
|
||||||
|
comment7.text=\n\ Mutator\ Start\n
|
||||||
|
comment8.params=itemCode
|
||||||
|
comment8.target=void\ setItemCode(java.lang.String)
|
||||||
|
comment9.params=userID
|
||||||
|
comment9.target=void\ setUserID(java.lang.String)
|
||||||
|
numComments=16
|
||||||
+84
-95
@@ -31,14 +31,86 @@ public class LibraryReservation
|
|||||||
this.noOfDays = noOfDays;
|
this.noOfDays = noOfDays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor for objects of class LibraryReservation
|
||||||
|
*/
|
||||||
public LibraryReservation(){}
|
public LibraryReservation(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessor Start
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getReservationNo()
|
||||||
|
{
|
||||||
|
return reservationNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemCode()
|
||||||
|
{
|
||||||
|
return itemCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String userID()
|
||||||
|
{
|
||||||
|
return userID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStartDate()
|
||||||
|
{
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNoOfDays()
|
||||||
|
{
|
||||||
|
return noOfDays;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessor End
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mutator Start
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setReservationNo( String reservationNo )
|
||||||
|
{
|
||||||
|
this.reservationNo = reservationNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemCode( String itemCode )
|
||||||
|
{
|
||||||
|
this.itemCode = itemCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserID( String userID )
|
||||||
|
{
|
||||||
|
this.userID = userID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate( String startDate )
|
||||||
|
{
|
||||||
|
this.startDate = DateUtil.convertStringToDate( startDate );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoOfDays( int noOfDays )
|
||||||
|
{
|
||||||
|
this.noOfDays = noOfDays;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mutator End
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concatenates values to output a formatted string.
|
||||||
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return reservationNo + " " + userID + " " + itemCode;
|
return reservationNo + " " + userID + " " + itemCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Prints to terminal, the details of the reservation.
|
* Prints to terminal, the details of the reservation.
|
||||||
*/
|
*/
|
||||||
public void printDetails()
|
public void printDetails()
|
||||||
@@ -50,12 +122,23 @@ public class LibraryReservation
|
|||||||
"\nDuration: " + noOfDays + " days" );
|
"\nDuration: " + noOfDays + " days" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forms field variables in a desired format, prints
|
||||||
|
* to the PrintWriter, and flush to the file.
|
||||||
|
* Takes Parameter
|
||||||
|
* PrintWriter @writer
|
||||||
|
*/
|
||||||
public void writeData( PrintWriter writer )
|
public void writeData( PrintWriter writer )
|
||||||
{
|
{
|
||||||
writer.print( reservationNo + "," + itemCode + "," + userID + "," + DateUtil.convertDateToShortString( startDate ) + "," + noOfDays );
|
writer.print( reservationNo + "," + itemCode + "," + userID + "," + DateUtil.convertDateToShortString( startDate ) + "," + noOfDays );
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
|
*/
|
||||||
public void readData( Scanner detailScanner )
|
public void readData( Scanner detailScanner )
|
||||||
{
|
{
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
@@ -66,98 +149,4 @@ public class LibraryReservation
|
|||||||
this.noOfDays = Integer.parseInt( detailScanner.next().trim() );
|
this.noOfDays = Integer.parseInt( detailScanner.next().trim() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Start Accessor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return value of @reservationNo
|
|
||||||
*/
|
|
||||||
public String getReservationNo()
|
|
||||||
{
|
|
||||||
return reservationNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return value of @itemCode
|
|
||||||
*/
|
|
||||||
public String getItemCode()
|
|
||||||
{
|
|
||||||
return itemCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return value of @userID
|
|
||||||
*/
|
|
||||||
public String getUserID()
|
|
||||||
{
|
|
||||||
return userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return value of @startDate
|
|
||||||
*/
|
|
||||||
public Date getStartDate()
|
|
||||||
{
|
|
||||||
return startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return value of @noOfDays
|
|
||||||
*/
|
|
||||||
public int getNoOfDays()
|
|
||||||
{
|
|
||||||
return noOfDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* End Accessor
|
|
||||||
*
|
|
||||||
* Start Mutator
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set @reservationNo to a new value
|
|
||||||
*/
|
|
||||||
public void setReservationNo( String reservationNo )
|
|
||||||
{
|
|
||||||
this.reservationNo = reservationNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set @itemCode to a new value
|
|
||||||
*/
|
|
||||||
public void setItemCode( String itemCode )
|
|
||||||
{
|
|
||||||
this.itemCode = itemCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set @userID to a new value
|
|
||||||
*/
|
|
||||||
public void setUserID( String userID )
|
|
||||||
{
|
|
||||||
this.userID = userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set @startDate to a new value
|
|
||||||
*/
|
|
||||||
public void setStartDate( String startDate )
|
|
||||||
{
|
|
||||||
this.startDate = DateUtil.convertStringToDate( startDate );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set @noOfDays to a new value
|
|
||||||
*/
|
|
||||||
public void setNoOfDays( int noOfDays )
|
|
||||||
{
|
|
||||||
this.noOfDays = noOfDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* End Mutator
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
BIN
Binary file not shown.
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
#BlueJ class context
|
#BlueJ class context
|
||||||
comment0.params=
|
comment0.params=
|
||||||
comment0.target=LibraryUser()
|
comment0.target=LibraryUser()
|
||||||
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ LibraryUser.\ As\ fields\ \n
|
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ LibraryUser.\n
|
||||||
comment1.params=
|
comment1.params=
|
||||||
comment1.target=java.lang.String\ getUserID()
|
comment1.target=java.lang.String\ getUserID()
|
||||||
comment1.text=\n\ Accessor\ start\ -\ return\ values\ of\ corresponding\ variables.\n
|
comment1.text=\n\ Accessor\ start\ -\ return\ values\ of\ corresponding\ variables.\n
|
||||||
@@ -9,13 +9,13 @@ comment10.params=title
|
|||||||
comment10.target=void\ setTitle(java.lang.String)
|
comment10.target=void\ setTitle(java.lang.String)
|
||||||
comment11.params=writer
|
comment11.params=writer
|
||||||
comment11.target=void\ writeData(java.io.PrintWriter)
|
comment11.target=void\ writeData(java.io.PrintWriter)
|
||||||
comment11.text=\n\ Passed\ a\ PrintWriter,\ append\ field\ variables\ in\ a\ set\ format,\ and\ flush\ the\ buffer.\n
|
comment11.text=\n\ Forms\ field\ variables\ in\ a\ desired\ format,\ prints\n\ to\ the\ PrintWriter,\ and\ flush\ to\ the\ file.\n\ Takes\ Parameter\n\ \ PrintWriter\ @writer\n
|
||||||
comment12.params=
|
comment12.params=
|
||||||
comment12.target=void\ printDetails()
|
comment12.target=void\ printDetails()
|
||||||
comment12.text=\n\ Print\ to\ terminal,\ all\ relevant\ fields.\n
|
comment12.text=\n\ Print\ to\ terminal\ all\ relevant\ fields.\n
|
||||||
comment13.params=detailScanner
|
comment13.params=detailScanner
|
||||||
comment13.target=void\ readData(java.util.Scanner)
|
comment13.target=void\ readData(java.util.Scanner)
|
||||||
comment13.text=\n\ Passed\ a\ scanner\ object,\ assign\ relevant\ values\ to\ field\ variables.\n
|
comment13.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
comment2.params=
|
comment2.params=
|
||||||
comment2.target=java.lang.String\ getSurname()
|
comment2.target=java.lang.String\ getSurname()
|
||||||
comment3.params=
|
comment3.params=
|
||||||
+32
-17
@@ -3,7 +3,7 @@
|
|||||||
* Class LibraryUser to create a user of a library.
|
* Class LibraryUser to create a user of a library.
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @1.0
|
* @2.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -15,30 +15,35 @@ public class LibraryUser
|
|||||||
private String userID, surname, firstName, otherInitials, title;
|
private String userID, surname, firstName, otherInitials, title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for objects of class LibraryUser. As fields
|
* Constructor for objects of class LibraryUser.
|
||||||
*/
|
*/
|
||||||
public LibraryUser(){}
|
public LibraryUser(){}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accessor start - return values of corresponding variables.
|
* Accessor start - return values of corresponding variables.
|
||||||
*/
|
*/
|
||||||
public String getUserID(){
|
public String getUserID()
|
||||||
|
{
|
||||||
return userID;
|
return userID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSurname(){
|
public String getSurname()
|
||||||
|
{
|
||||||
return surname;
|
return surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFirstName(){
|
public String getFirstName()
|
||||||
|
{
|
||||||
return firstName;
|
return firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOtherInitials(){
|
public String getOtherInitials()
|
||||||
|
{
|
||||||
return otherInitials;
|
return otherInitials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle(){
|
public String getTitle()
|
||||||
|
{
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,23 +52,28 @@ public class LibraryUser
|
|||||||
* Mutator Start - Set value of corresponding variables
|
* Mutator Start - Set value of corresponding variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setUserID( String userID ){
|
public void setUserID( String userID )
|
||||||
|
{
|
||||||
this.userID = userID;
|
this.userID = userID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSurname( String surname ){
|
public void setSurname( String surname )
|
||||||
|
{
|
||||||
this.surname = surname;
|
this.surname = surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFirstName( String firstName ){
|
public void setFirstName( String firstName )
|
||||||
|
{
|
||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOtherInitials( String otherInitials ){
|
public void setOtherInitials( String otherInitials )
|
||||||
|
{
|
||||||
this.otherInitials = otherInitials;
|
this.otherInitials = otherInitials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle( String title ){
|
public void setTitle( String title )
|
||||||
|
{
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +81,11 @@ public class LibraryUser
|
|||||||
* Mutator End
|
* Mutator End
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a PrintWriter, append field variables in a set format, and flush the buffer.
|
* Forms field variables in a desired format, prints
|
||||||
|
* to the PrintWriter, and flush to the file.
|
||||||
|
* Takes Parameter
|
||||||
|
* PrintWriter @writer
|
||||||
*/
|
*/
|
||||||
public void writeData( PrintWriter writer )
|
public void writeData( PrintWriter writer )
|
||||||
{
|
{
|
||||||
@@ -81,7 +94,7 @@ public class LibraryUser
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print to terminal, all relevant fields.
|
* Print to terminal all relevant fields.
|
||||||
*/
|
*/
|
||||||
public void printDetails()
|
public void printDetails()
|
||||||
{
|
{
|
||||||
@@ -89,8 +102,10 @@ public class LibraryUser
|
|||||||
"\nName: " + title + " " + firstName + " " + otherInitials + " " + surname );
|
"\nName: " + title + " " + firstName + " " + otherInitials + " " + surname );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a scanner object, assign relevant values to field variables.
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
*/
|
*/
|
||||||
public void readData( Scanner detailScanner )
|
public void readData( Scanner detailScanner )
|
||||||
{
|
{
|
||||||
BIN
Binary file not shown.
+1
-1
@@ -13,5 +13,5 @@ comment3.target=void\ printDetails()
|
|||||||
comment3.text=\n\ Print\ to\ terminal,\ relevant\ field\ variable's\ values.\n
|
comment3.text=\n\ Print\ to\ terminal,\ relevant\ field\ variable's\ values.\n
|
||||||
comment4.params=detailScanner
|
comment4.params=detailScanner
|
||||||
comment4.target=void\ readItemData(java.util.Scanner)
|
comment4.target=void\ readItemData(java.util.Scanner)
|
||||||
comment4.text=\n\ Passed\ a\ scanner,\ assign\ relevant\ values\ to\ field\ variables.\n
|
comment4.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
numComments=5
|
numComments=5
|
||||||
+5
-3
@@ -3,7 +3,7 @@
|
|||||||
* Subclass of LibraryItem to create a periodical ( e.g. newspaper, tabloid ).
|
* Subclass of LibraryItem to create a periodical ( e.g. newspaper, tabloid ).
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @2.3
|
* @2.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -42,8 +42,10 @@ public class Periodical extends PrintedItem
|
|||||||
super.printDetails();
|
super.printDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Passed a scanner, assign relevant values to field variables.
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
*/
|
*/
|
||||||
public void readItemData( Scanner detailScanner ){
|
public void readItemData( Scanner detailScanner ){
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
BIN
Binary file not shown.
+1
@@ -14,4 +14,5 @@ comment4.target=void\ printDetails()
|
|||||||
comment4.text=\n\ Field\ Mutator\ End\n
|
comment4.text=\n\ Field\ Mutator\ End\n
|
||||||
comment5.params=detailScanner
|
comment5.params=detailScanner
|
||||||
comment5.target=void\ readItemData(java.util.Scanner)
|
comment5.target=void\ readItemData(java.util.Scanner)
|
||||||
|
comment5.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
|
||||||
numComments=6
|
numComments=6
|
||||||
+6
-1
@@ -3,7 +3,7 @@
|
|||||||
* Subclass of LibraryItem to create objects of printed items in a library.
|
* Subclass of LibraryItem to create objects of printed items in a library.
|
||||||
*
|
*
|
||||||
* @George Wilkinson
|
* @George Wilkinson
|
||||||
* @1.0
|
* @1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -52,6 +52,11 @@ public abstract class PrintedItem extends LibraryItem
|
|||||||
super.printDetails();
|
super.printDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate the fields with details from the scanner
|
||||||
|
* Takes Parameters
|
||||||
|
* Scanner @detailScanner
|
||||||
|
*/
|
||||||
public void readItemData( Scanner detailScanner ){
|
public void readItemData( Scanner detailScanner ){
|
||||||
if ( detailScanner != null ) {
|
if ( detailScanner != null ) {
|
||||||
this.noOfPages = Integer.parseInt( detailScanner.next().trim() );
|
this.noOfPages = Integer.parseInt( detailScanner.next().trim() );
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,179 @@
|
|||||||
|
#BlueJ package file
|
||||||
|
dependency1.from=Library
|
||||||
|
dependency1.to=Book
|
||||||
|
dependency1.type=UsesDependency
|
||||||
|
dependency2.from=Library
|
||||||
|
dependency2.to=Periodical
|
||||||
|
dependency2.type=UsesDependency
|
||||||
|
dependency3.from=Library
|
||||||
|
dependency3.to=LibraryItem
|
||||||
|
dependency3.type=UsesDependency
|
||||||
|
dependency4.from=Library
|
||||||
|
dependency4.to=CD
|
||||||
|
dependency4.type=UsesDependency
|
||||||
|
dependency5.from=Library
|
||||||
|
dependency5.to=DVD
|
||||||
|
dependency5.type=UsesDependency
|
||||||
|
dependency6.from=Library
|
||||||
|
dependency6.to=LibraryUser
|
||||||
|
dependency6.type=UsesDependency
|
||||||
|
dependency7.from=LibraryReservation
|
||||||
|
dependency7.to=DateUtil
|
||||||
|
dependency7.type=UsesDependency
|
||||||
|
dependency8.from=Library
|
||||||
|
dependency8.to=LibraryReservation
|
||||||
|
dependency8.type=UsesDependency
|
||||||
|
objectbench.height=76
|
||||||
|
objectbench.width=940
|
||||||
|
package.editor.height=874
|
||||||
|
package.editor.width=814
|
||||||
|
package.editor.x=0
|
||||||
|
package.editor.y=31
|
||||||
|
package.numDependencies=8
|
||||||
|
package.numTargets=11
|
||||||
|
package.showExtends=true
|
||||||
|
package.showUses=true
|
||||||
|
project.charset=UTF-8
|
||||||
|
target1.editor.height=700
|
||||||
|
target1.editor.width=900
|
||||||
|
target1.editor.x=1017
|
||||||
|
target1.editor.y=76
|
||||||
|
target1.height=50
|
||||||
|
target1.name=PrintedItem
|
||||||
|
target1.naviview.expanded=true
|
||||||
|
target1.showInterface=false
|
||||||
|
target1.type=AbstractTarget
|
||||||
|
target1.typeParameters=
|
||||||
|
target1.width=110
|
||||||
|
target1.x=130
|
||||||
|
target1.y=240
|
||||||
|
target10.editor.height=700
|
||||||
|
target10.editor.width=900
|
||||||
|
target10.editor.x=960
|
||||||
|
target10.editor.y=146
|
||||||
|
target10.height=50
|
||||||
|
target10.name=AudioVisual
|
||||||
|
target10.naviview.expanded=true
|
||||||
|
target10.showInterface=false
|
||||||
|
target10.type=AbstractTarget
|
||||||
|
target10.typeParameters=
|
||||||
|
target10.width=110
|
||||||
|
target10.x=380
|
||||||
|
target10.y=240
|
||||||
|
target11.editor.height=700
|
||||||
|
target11.editor.width=900
|
||||||
|
target11.editor.x=40
|
||||||
|
target11.editor.y=51
|
||||||
|
target11.height=50
|
||||||
|
target11.name=LibraryReservation
|
||||||
|
target11.naviview.expanded=true
|
||||||
|
target11.showInterface=false
|
||||||
|
target11.type=ClassTarget
|
||||||
|
target11.typeParameters=
|
||||||
|
target11.width=160
|
||||||
|
target11.x=230
|
||||||
|
target11.y=440
|
||||||
|
target2.editor.height=786
|
||||||
|
target2.editor.width=960
|
||||||
|
target2.editor.x=34
|
||||||
|
target2.editor.y=174
|
||||||
|
target2.height=50
|
||||||
|
target2.name=CD
|
||||||
|
target2.naviview.expanded=true
|
||||||
|
target2.showInterface=false
|
||||||
|
target2.type=ClassTarget
|
||||||
|
target2.typeParameters=
|
||||||
|
target2.width=80
|
||||||
|
target2.x=360
|
||||||
|
target2.y=340
|
||||||
|
target3.editor.height=700
|
||||||
|
target3.editor.width=900
|
||||||
|
target3.editor.x=557
|
||||||
|
target3.editor.y=177
|
||||||
|
target3.height=60
|
||||||
|
target3.name=LibraryItem
|
||||||
|
target3.naviview.expanded=true
|
||||||
|
target3.showInterface=false
|
||||||
|
target3.type=AbstractTarget
|
||||||
|
target3.typeParameters=
|
||||||
|
target3.width=120
|
||||||
|
target3.x=250
|
||||||
|
target3.y=110
|
||||||
|
target4.editor.height=1049
|
||||||
|
target4.editor.width=1920
|
||||||
|
target4.editor.x=0
|
||||||
|
target4.editor.y=31
|
||||||
|
target4.height=50
|
||||||
|
target4.name=DVD
|
||||||
|
target4.naviview.expanded=true
|
||||||
|
target4.showInterface=false
|
||||||
|
target4.type=ClassTarget
|
||||||
|
target4.typeParameters=
|
||||||
|
target4.width=80
|
||||||
|
target4.x=470
|
||||||
|
target4.y=380
|
||||||
|
target5.editor.height=700
|
||||||
|
target5.editor.width=900
|
||||||
|
target5.editor.x=55
|
||||||
|
target5.editor.y=274
|
||||||
|
target5.height=50
|
||||||
|
target5.name=LibraryUser
|
||||||
|
target5.naviview.expanded=true
|
||||||
|
target5.showInterface=false
|
||||||
|
target5.type=ClassTarget
|
||||||
|
target5.typeParameters=
|
||||||
|
target5.width=110
|
||||||
|
target5.x=100
|
||||||
|
target5.y=170
|
||||||
|
target6.editor.height=700
|
||||||
|
target6.editor.width=1619
|
||||||
|
target6.editor.x=192
|
||||||
|
target6.editor.y=267
|
||||||
|
target6.height=50
|
||||||
|
target6.name=Periodical
|
||||||
|
target6.naviview.expanded=true
|
||||||
|
target6.showInterface=false
|
||||||
|
target6.type=ClassTarget
|
||||||
|
target6.typeParameters=
|
||||||
|
target6.width=90
|
||||||
|
target6.x=60
|
||||||
|
target6.y=380
|
||||||
|
target7.editor.height=1049
|
||||||
|
target7.editor.width=1920
|
||||||
|
target7.editor.x=0
|
||||||
|
target7.editor.y=31
|
||||||
|
target7.height=50
|
||||||
|
target7.name=Book
|
||||||
|
target7.naviview.expanded=true
|
||||||
|
target7.showInterface=false
|
||||||
|
target7.type=ClassTarget
|
||||||
|
target7.typeParameters=
|
||||||
|
target7.width=80
|
||||||
|
target7.x=180
|
||||||
|
target7.y=340
|
||||||
|
target8.editor.height=700
|
||||||
|
target8.editor.width=900
|
||||||
|
target8.editor.x=40
|
||||||
|
target8.editor.y=51
|
||||||
|
target8.height=50
|
||||||
|
target8.name=DateUtil
|
||||||
|
target8.naviview.expanded=true
|
||||||
|
target8.showInterface=false
|
||||||
|
target8.type=ClassTarget
|
||||||
|
target8.typeParameters=
|
||||||
|
target8.width=80
|
||||||
|
target8.x=70
|
||||||
|
target8.y=10
|
||||||
|
target9.editor.height=1049
|
||||||
|
target9.editor.width=1920
|
||||||
|
target9.editor.x=0
|
||||||
|
target9.editor.y=31
|
||||||
|
target9.height=50
|
||||||
|
target9.name=Library
|
||||||
|
target9.naviview.expanded=true
|
||||||
|
target9.showInterface=false
|
||||||
|
target9.type=ClassTarget
|
||||||
|
target9.typeParameters=
|
||||||
|
target9.width=100
|
||||||
|
target9.x=260
|
||||||
|
target9.y=240
|
||||||
Reference in new issue
Block a user