vault backup: 2024-09-05 17:56:43

This commit is contained in:
2024-09-05 17:56:43 +01:00
parent 73d081e6b1
commit f92e45c2bf
100 changed files with 16047 additions and 16337 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,11 @@
{
"id": "dataview",
"name": "Dataview",
"version": "0.5.59",
"version": "0.5.67",
"minAppVersion": "0.13.11",
"description": "Complex data views for the data-obsessed.",
"author": "Michael Brenan <blacksmithgu@gmail.com>",
"authorUrl": "https://github.com/blacksmithgu",
"helpUrl": "https://blacksmithgu.github.io/obsidian-dataview/",
"isDesktopOnly": false
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"id": "local-backup",
"name": "Local Backup",
"version": "0.0.5",
"version": "0.1.7",
"minAppVersion": "0.15.0",
"description": "Automatically creates a local backup of the vault.",
"author": "GC Chen",

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,10 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Obsidian Git",
"description": "Backup your vault with Git.",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"js": "main.js",
"version": "2.22.0"
"version": "2.26.0"
}

View File

@@ -8,20 +8,20 @@
}
}
.workspace-leaf-content[data-type='git-view'] .button-border {
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type='git-view'] .view-content {
.workspace-leaf-content[data-type="git-view"] .view-content {
padding: 0;
}
.workspace-leaf-content[data-type='git-history-view'] .view-content {
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding: 0;
}
.loading>svg {
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
@@ -77,6 +77,22 @@
height: auto;
}
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
display: none;
}
@@ -228,12 +244,18 @@
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del {
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
del {
background-color: #ffb6ba;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del {
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
del {
background-color: #8d232881;
}
@@ -249,13 +271,19 @@
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
ins {
background-color: #97f295;
text-align: left;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
ins {
background-color: #1d921996;
text-align: left;
}
@@ -376,19 +404,31 @@
color: var(--text-normal);
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-file-diff .d2h-del.d2h-change {
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-del.d2h-change {
background-color: #fdf2d0;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-file-diff .d2h-del.d2h-change {
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-del.d2h-change {
background-color: #55492480;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-file-diff .d2h-ins.d2h-change {
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-ins.d2h-change {
background-color: #ded;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-file-diff .d2h-ins.d2h-change {
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-ins.d2h-change {
background-color: rgba(37, 78, 37, 0.418);
}
@@ -401,7 +441,9 @@
text-decoration: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a:visited {
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-list-wrapper
a:visited {
color: #3572b0;
}
@@ -427,13 +469,13 @@
padding: 0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list>li {
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list>li:last-child {
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
border-bottom: none;
}
@@ -501,12 +543,20 @@
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div, .line-author-settings-preview {
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,11 @@
{
"id": "obsidian-linter",
"name": "Linter",
"version": "1.20.0",
"minAppVersion": "0.15.6",
"version": "1.26.0",
"minAppVersion": "1.5.7",
"description": "Formats and styles your notes. It can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular markdown contents like list, italics, and bold styles; and more with the use of custom rule options as well.",
"author": "Victor Tao",
"authorUrl": "https://github.com/platers",
"helpUrl": "https://platers.github.io/obsidian-linter/",
"isDesktopOnly": false
}

View File

@@ -185,7 +185,7 @@ textarea.full-width {
/**
* Custom regex replacement
*/
.linter-custom-regex-replacement-container div:last-child{
.linter-custom-regex-replacement-container div:last-child {
border: none;
}
.linter-custom-regex-replacement {
@@ -210,6 +210,25 @@ textarea.full-width {
width: 50%;
}
/**
* Files to ignore
*/
.linter-files-to-ignore-container div:last-child {
border: none;
}
.linter-files-to-ignore {
margin-bottom: 15px;
border: none;
border-bottom: var(--hr-thickness) solid;
border-color: var(--hr-color);
}
.linter-files-to-ignore-normal-input {
width: 40%;
}
.linter-files-to-ignore-flags {
width: 15%;
}
/**
* Setting item no border
*/

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-style-settings",
"name": "Style Settings",
"version": "1.0.8",
"version": "1.0.9",
"minAppVersion": "0.11.5",
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
"author": "mgmeyers",

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,15 @@
{
"useCache": true,
"hideExcluded": false,
"downrankedFoldersFilters": [],
"ignoreDiacritics": true,
"ignoreArabicDiacritics": false,
"indexedFileTypes": [],
"displayTitle": "",
"PDFIndexing": false,
"officeIndexing": false,
"imagesIndexing": false,
"aiImageIndexing": false,
"unsupportedFilesIndexing": "no",
"splitCamelCase": true,
"openInNewPane": false,
@@ -16,6 +21,7 @@
"highlight": true,
"showPreviousQueryResults": true,
"simpleSearch": false,
"tokenizeUrls": false,
"fuzziness": "1",
"weightBasename": 3,
"weightDirectory": 2,
@@ -23,6 +29,12 @@
"weightH2": 1.3,
"weightH3": 1.1,
"weightUnmarkedTags": 1.1,
"welcomeMessage": "1.10.1",
"verboseLogging": false
"weightCustomProperties": [],
"httpApiEnabled": false,
"httpApiPort": "51361",
"httpApiNotice": true,
"welcomeMessage": "1.21.0",
"verboseLogging": false,
"DANGER_httpHost": null,
"DANGER_forceSaveCache": false
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"id": "omnisearch",
"name": "Omnisearch",
"version": "1.17.1",
"version": "1.24.1",
"minAppVersion": "1.3.0",
"description": "A search engine that just works",
"author": "Simon Cambier",

View File

@@ -25,7 +25,6 @@
}
.omnisearch-result__title > span {
}
.omnisearch-result__folder-path {
@@ -37,9 +36,9 @@
}
.omnisearch-result__extension {
font-size: 0.7rem;
color: var(--text-muted);
}
font-size: 0.7rem;
color: var(--text-muted);
}
.omnisearch-result__counter {
font-size: 0.7rem;
@@ -57,12 +56,12 @@
-webkit-box-orient: vertical;
color: var(--text-muted);
margin-left: 0.5em;
margin-inline-start: 0.5em;
}
.omnisearch-result__image-container {
flex-basis: 20%;
text-align: right
text-align: end;
}
.omnisearch-highlight {
@@ -78,6 +77,7 @@
.omnisearch-input-container {
display: flex;
align-items: center;
flex-direction: row;
gap: 5px;
}
@@ -86,6 +86,23 @@
.omnisearch-input-container {
flex-direction: column;
}
.omnisearch-input-container__buttons {
display: flex;
flex-direction: row;
width: 100%;
padding: 0 1em 0 1em;
gap: 1em;
}
.omnisearch-input-container__buttons > button {
flex-grow: 1;
}
}
@media only screen and (min-width: 600px) {
.omnisearch-input-container__buttons {
margin-inline-end: 1em;
}
}
.omnisearch-input-field {

View File

@@ -93,7 +93,7 @@
}
],
"direction": "horizontal",
"width": 200
"width": 262.5
},
"right": {
"id": "ee8f6df41634f71e",
@@ -178,15 +178,16 @@
}
],
"direction": "horizontal",
"width": 211.5
"width": 371.5
},
"left-ribbon": {
"hiddenItems": {
"obsidian-full-calendar:Open Full Calendar": false,
"omnisearch:Omnisearch": false,
"graph:Open graph view": false,
"command-palette:Open command palette": false,
"switcher:Open quick switcher": false
"switcher:Open quick switcher": false,
"obsidian-full-calendar:Open Full Calendar": false,
"omnisearch:Omnisearch": false,
"obsidian-git:Open Git source control": false
}
},
"active": "3ed058b7ba32ddc0",

BIN
Unsorted/Business Idea.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

5560
Unsorted/HW4_final_marks.csv Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,14 @@
#BlueJ class context
comment0.params=
comment0.target=int\ getPlayingTime()
comment0.text=\n\ Field\ Accessor\ Start\n
comment1.params=playingTime
comment1.target=void\ setPlayingTime(int)
comment1.text=\n\ Field\ Accessor\ End\n\ \n\ Field\ Mutator\ Start\n
comment2.params=
comment2.target=void\ printDetails()
comment2.text=\n\ Field\ Mutator\ End\n
comment3.params=detailScanner
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

View File

@@ -0,0 +1,55 @@
/**
* Subclass of LibraryItem to create objects of audio and visual items in a library.
*
* @George Wilkinson
* @1.2
*/
import java.util.Scanner;
public abstract class AudioVisual extends LibraryItem
{
private int playingTime;
/*
* Field Accessor Start
*/
public int getPlayingTime()
{
return playingTime;
}
/*
* Field Accessor End
*
* Field Mutator Start
*/
public void setPlayingTime( int playingTime )
{
this.playingTime = playingTime;
}
/*
* Field Mutator End
*/
public void printDetails()
{
System.out.println( "Playing Time: " + playingTime );
super.printDetails();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.playingTime = Integer.parseInt( detailScanner.next().trim() );
super.readItemData( detailScanner );
}
}
}

View File

@@ -0,0 +1,23 @@
#BlueJ class context
comment0.params=
comment0.target=Book()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ Book\n\ Since\ all\ field\ variables\ initialise\ as\ null,\ nothing\ should\ happen\ here.\n
comment1.params=
comment1.target=java.lang.String\ getAuthor()
comment1.text=\n\ Return\ value\ of\ @author\n
comment2.params=
comment2.target=java.lang.String\ getIsbn()
comment2.text=\n\ Return\ value\ of\ @isbn.\n
comment3.params=author
comment3.target=void\ setAuthor(java.lang.String)
comment3.text=\n\ Set\ value\ of\ @author.\n
comment4.params=isbn
comment4.target=void\ setIsbn(java.lang.String)
comment4.text=\n\ Set\ value\ of\ @isbn\n
comment5.params=
comment5.target=void\ printDetails()
comment5.text=\n\ Print\ to\ terminal,\ relevant\ details\ of\ current\ object.\n
comment6.params=detailScanner
comment6.target=void\ readItemData(java.util.Scanner)
comment6.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
numComments=7

View File

@@ -0,0 +1,76 @@
/**
* Subclass of LibraryItem that emulates a Book item.
*
* @George Wilkinson
* @2.5
*/
import java.util.Scanner;
import java.util.NoSuchElementException;
public class Book extends PrintedItem
{
private String author;
private String isbn;
/**
* Constructor for objects of class Book
* Since all field variables initialise as null, nothing should happen here.
*/
public Book(){}
/*
* Return value of @author
*/
public String getAuthor()
{
return author;
}
/*
* Return value of @isbn.
*/
public String getIsbn()
{
return isbn;
}
/*
* Set value of @author.
*/
public void setAuthor( String author )
{
this.author = author;
}
/*
* Set value of @isbn
*/
public void setIsbn( String isbn )
{
this.isbn = isbn;
}
/*
* Print to terminal, relevant details of current object.
*/
public void printDetails() {
System.out.println( "ISBN: " + isbn +
"\nAuthor: " + author );
super.printDetails();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.author = detailScanner.next().trim();
this.isbn = detailScanner.next().trim();
super.readItemData( detailScanner );
}
}
}

View File

@@ -0,0 +1,23 @@
#BlueJ class context
comment0.params=
comment0.target=CD()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ CD\n\ Since\ all\ field\ variables\ initialise\ as\ null,\ nothing\ should\ happen\ here.\n
comment1.params=
comment1.target=java.lang.String\ getArtist()
comment1.text=\n\ Return\ value\ of\ @artist.\n
comment2.params=
comment2.target=int\ noOfTracks()
comment2.text=\n\ Return\ value\ of\ @noOfTracks\n
comment3.params=artist
comment3.target=void\ setArtist(java.lang.String)
comment3.text=\n\ Set\ value\ of\ @artist.\n
comment4.params=noOfTracks
comment4.target=void\ setNoOfTracks(int)
comment4.text=\n\ Set\ value\ of\ @noOfTracks.\n
comment5.params=
comment5.target=void\ printDetails()
comment5.text=\n\ Print\ to\ terminal,\ relevant\ details\ of\ current\ object.\n
comment6.params=detailScanner
comment6.target=void\ readItemData(java.util.Scanner)
comment6.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
numComments=7

View File

@@ -0,0 +1,76 @@
/**
* Subclass of AudioVisual, to create objects of a CD.
*
* @George Wilkinson
* @1.2
*/
import java.util.Scanner;
public class CD extends AudioVisual
{
private String artist;
private int noOfTracks;
/**
* Constructor for objects of class CD
* Since all field variables initialise as null, nothing should happen here.
*/
public CD(){}
/*
* Return value of @artist.
*/
public String getArtist()
{
return artist;
}
/*
* Return value of @noOfTracks
*/
public int noOfTracks()
{
return noOfTracks;
}
/*
* Set value of @artist.
*/
public void setArtist( String artist )
{
this.artist = artist;
}
/*
* Set value of @noOfTracks.
*/
public void setNoOfTracks( int noOfTracks )
{
this.noOfTracks = noOfTracks;
}
/*
* Print to terminal, relevant details of current object.
*/
public void printDetails() {
System.out.println( "Artist: " + artist +
"\nTrack Count: " + noOfTracks );
super.printDetails();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.artist = detailScanner.next().trim();
this.noOfTracks = Integer.parseInt( detailScanner.next().trim() );
super.readItemData( detailScanner );
}
}
}

View File

@@ -0,0 +1,17 @@
#BlueJ class context
comment0.params=
comment0.target=DVD()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ DVD\n\ Since\ all\ field\ variables\ initialise\ as\ null,\ nothing\ should\ happen\ here.\n
comment1.params=
comment1.target=java.lang.String\ getDirector()
comment1.text=\n\ Return\ value\ of\ @director.\n
comment2.params=director
comment2.target=void\ setDirector(java.lang.String)
comment2.text=\n\ Set\ value\ of\ @director.\n
comment3.params=
comment3.target=void\ printDetails()
comment3.text=\n\ Print\ relevant\ details\ of\ the\ current\ object.\n
comment4.params=detailScanner
comment4.target=void\ readItemData(java.util.Scanner)
comment4.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
numComments=5

View File

@@ -0,0 +1,56 @@
/**
* Subclass of AudioVisual to create objects of DVD items.
*
* @George Wilkinson
* @1.2
*/
import java.util.Scanner;
public class DVD extends AudioVisual
{
private String director;
/**
* Constructor for objects of class DVD
* Since all field variables initialise as null, nothing should happen here.
*/
public DVD(){}
/*
* Return value of @director.
*/
public String getDirector()
{
return director;
}
/*
* Set value of @director.
*/
public void setDirector( String director )
{
this.director = director;
}
/*
* Print relevant details of the current object.
*/
public void printDetails() {
System.out.println( "Director: " + director );
super.printDetails();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.director = detailScanner.next().trim();
super.readItemData( detailScanner );
}
}
}

View File

@@ -0,0 +1,26 @@
#BlueJ class context
comment0.params=date
comment0.target=java.lang.String\ convertDateToLongString(java.util.Date)
comment0.text=\n\ Converts\ a\ Date\ object\ to\ a\ corresponding\ String\ in\n\ the\ long\ date\ pattern\ style\ "Saturday,\ 25\ March\ 2023".\n\n\ @param\ \ \ \ \ date\ \ a\ Date\ object\n\n\ @return\ \ \ \ a\ String,\ containing\ a\ long\ date\ pattern\n
comment1.params=date
comment1.target=java.lang.String\ convertDateToShortString(java.util.Date)
comment1.text=\n\ Converts\ a\ Date\ object\ to\ a\ corresponding\ String\ in\n\ the\ short\ date\ pattern\ style\ "25-03-2023".\n\n\ @param\ \ \ \ \ date\ \ a\ Date\ object\n\n\ @return\ \ \ \ a\ String,\ containing\ a\ short\ date\ pattern\n
comment2.params=dateString
comment2.target=java.util.Date\ convertStringToDate(java.lang.String)
comment2.text=\n\ Converts\ a\ string\ in\ the\ short\ date\ pattern\ style\ "25-03-2023"\n\ to\ a\ corresponding\ Date\ object.\n\n\ Any\ leading\ or\ trailing\ spaces\ are\ first\ removed\ from\ the\ date\ string.\n\ The\ String\ parameter\ that\ represent\ a\ date\ as\ a\ string\ must\ be\ in\ the\n\ format\ dd-mm-yyy\ (e.g.\ 25-03-2023\ or\ 25-3-2023)\ where\ dd\ represents\n\ one\ or\ two\ digits\ representing\ the\ day\ in\ the\ month,\ similarly\ for\n\ mm\ representing\ the\ month\ in\ the\ year\ and\ yyyy\ represents\ the\ four\n\ digits\ for\ the\ year.\n\n\ A\ RuntimeException\ is\ thrown\ if\ the\ date\ string\ is\ not\ recognised\ as\n\ a\ valid\ date.\ Such\ exceptions\ do\ not\ need\ to\ be\ caught\ or\ thrown\ as\ \n\ they\ are\ unchecked\ exceptions,\ but\ can\ be\ caught\ if\ necessary.\n\n\ @param\ \ \ \ \ dateString\ \ a\ Date\ object\n\n\ @return\ \ \ \ the\ Date\ object\n
comment3.params=startDate\ endDate
comment3.target=int\ daysBetween(java.util.Date,\ java.util.Date)
comment3.text=\n\ Calculates\ the\ number\ of\ days\ between\ two\ given\ dates,\ startDate\ and\ endDate.\n\n\ If\ startDate\ is\ after\ endDate\ then\ the\ number\ of\ days\ returned\ will\ be\ negative.\n\n\ @param\ \ \ \ \ startDate\ \ \ a\ Date\ object\n\ @param\ \ \ \ \ endDate\ \ \ \ \ a\ Date\ object\n\n\ @return\ \ \ \ an\ int,\ number\ of\ days\ between\ the\ dates\n
comment4.params=date\ noOfDays
comment4.target=java.util.Date\ incrementDate(java.util.Date,\ int)
comment4.text=\n\ Given\ date,\ a\ Date\ object,\ and\ noOfDays,\ an\ int,\ the\ method\ returns\n\ a\ Date\ object\ corresponding\ to\ noOfDays\ later\ than\ date.\n\n\ If\ noOfDays\ is\ negative,\ the\ resulting\ Date\ object\ will\ be\ before\ date.\n\n\ @param\ \ \ \ \ date\ \ \ \ \ \ a\ Date\ object\n\ @param\ \ \ \ \ noOfDays\ \ an\ int\n\n\ @return\ \ \ \ a\ Date\n
comment5.params=year
comment5.target=boolean\ isLeapYear(int)
comment5.text=\n\ Given\ year,\ an\ int,\ the\ method\ checks\ to\ see\ if\ the\ year\n\ is\ a\ leap\ year.\n\n\ @param\ \ \ \ \ year,\ \ an\ int\n\n\ @return\ \ \ \ a\ boolean,\ true\ only\ if\ the\ year\ is\ a\ leap\ year.\n
comment6.params=dateString
comment6.target=boolean\ isValidDateString(java.lang.String)
comment6.text=\n\ Given\ dateString,\ a\ String,\ the\ method\ checks\ to\ see\ if\ string\n\ corresponds\ to\ a\ valid\ shortDatePattern.\ \n\n\ @param\ \ \ \ \ dateString,\ a\ String\n\n\ @return\ \ \ \ a\ boolean,\ true\ only\ if\ the\ dateString\ is\ a\ valid\ pattern\n
comment7.params=date
comment7.target=java.util.Date\ nextDate(java.util.Date)
comment7.text=\n\ Given\ date,\ a\ Date\ object,\ the\ method\ returns\n\ a\ Date\ object\ corresponding\ to\ the\ next\ day.\n\n\ @param\ \ \ \ \ noOfDays\ \ an\ int\n\n\ @return\ \ \ \ a\ Date\n
numComments=8

View File

@@ -0,0 +1,263 @@
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
/**
*
* A class DateUtil with the following methods for dealing with dates.
*
* public static String convertDateToLongString(Date date)
* public static String convertDateToShortString(Date date)
* public static Date convertStringToDate(String dateString)
* public static int daysBetween(Date startDate, Date endDate)
* public static Date incrementDate(Date date, int noOfDays)
* public static boolean isLeapYear(int year)
* public static boolean isValidDateString(String dateString)
* public static Date nextDate(Date date)
*
* @author D E Newton
*
*/
public class DateUtil
{
public static SimpleDateFormat dateFormatter;
private static String longDatePattern;
private static String shortDatePattern;
/**
* initializer block -- useful for
* initializing static fields
*/
static
{
shortDatePattern = "dd-MM-yyyy"; // dd = day, MM = month, yyyy = year (as 2, 2 and 4 digits respectively)
longDatePattern = "EEEE, d MMMM yyyy"; // e.g. Saturday, 25 March 2023
// EEEE (4 or more) = day in week, in full e.g.Saturday
// MMMMM (4 or more) = month name as text in full e.g. March
// d = day as 1 or 2 digits e.g. 25th of month -> 25, 23rd -> 23
//
// some alternatives below to help understanding (see documentation for SimpleDateFormat class)
// EE (3 or less) -> Tue
// MMMM = month name as text in short e.g. Oct
// M (or MM) = month as digits e.g. 1 (or 01) would correspond to January
dateFormatter = new SimpleDateFormat(shortDatePattern); // default pattern set
dateFormatter.setLenient(false); // default is true and impossible dates such
// as 31-09-2023 would be accepted but interpreted as 01-10-2023
}
/**
* Converts a Date object to a corresponding String in
* the long date pattern style "Saturday, 25 March 2023".
*
* @param date a Date object
*
* @return a String, containing a long date pattern
*/
public static String convertDateToLongString(Date date)
{
dateFormatter.applyPattern(longDatePattern);
String dateString = dateFormatter.format(date);
dateFormatter.applyPattern(shortDatePattern); // reset pattern
return dateString;
}
/**
* Converts a Date object to a corresponding String in
* the short date pattern style "25-03-2023".
*
* @param date a Date object
*
* @return a String, containing a short date pattern
*/
public static String convertDateToShortString(Date date)
{
return dateFormatter.format(date);
}
/**
* Converts a string in the short date pattern style "25-03-2023"
* to a corresponding Date object.
*
* Any leading or trailing spaces are first removed from the date string.
* The String parameter that represent a date as a string must be in the
* format dd-mm-yyy (e.g. 25-03-2023 or 25-3-2023) where dd represents
* one or two digits representing the day in the month, similarly for
* mm representing the month in the year and yyyy represents the four
* digits for the year.
*
* A RuntimeException is thrown if the date string is not recognised as
* a valid date. Such exceptions do not need to be caught or thrown as
* they are unchecked exceptions, but can be caught if necessary.
*
* @param dateString a Date object
*
* @return the Date object
*/
public static Date convertStringToDate(String dateString)
{
dateString = dateString.trim();
ParsePosition posn = new ParsePosition(0); // initialise posn to the beginning of the string to be parsed
Date date = dateFormatter.parse(dateString, posn);
int endIndex = posn.getIndex(); // posn after parsing
String message = "Date string <" + dateString + "> not recognised";
if( date==null )
{
// parsing failed because string not recognised
message += ".";
throw new RuntimeException(message);
}
else if( endIndex!=dateString.length() )
{
// parsing failed because parsing did not "consume" all the characters
// in the string, indicating the complete string was not recognised
message += " because it contains extra characters after a date.";
throw new RuntimeException(message);
}
else
return date;
}
/**
* Calculates the number of days between two given dates, startDate and endDate.
*
* If startDate is after endDate then the number of days returned will be negative.
*
* @param startDate a Date object
* @param endDate a Date object
*
* @return an int, number of days between the dates
*/
public static int daysBetween(Date startDate, Date endDate)
{
// first check that startDate is not after endDate
boolean outOfOrder;
Date temp;
if( startDate.compareTo(endDate)<=0 )
{
outOfOrder = false;
}
else
{
outOfOrder = true;
temp = startDate;
startDate = endDate;
endDate = temp;
}
int daysBetween = 0;
Calendar calendar = new GregorianCalendar();
calendar.setTime(startDate); // initialised at start date
Calendar calendarEndDate = new GregorianCalendar();
calendarEndDate.setTime(endDate);
// First advance calendar a year at a time without advancing past the end date.
// This is much quicker, for dates that are years apart, than simply relying on the
// later "day at a time" loop. Advancing "a month at a time" before the "day at a
// time" loop would be even better but complex because of the varying month lengths.
Calendar prevYearCalendar = (Calendar) calendar.clone();
calendar.add(Calendar.YEAR, 1);
// advance calendar a year at a time until end date reached
while( !calendar.getTime().after(endDate) )
{
if( isLeapYear(prevYearCalendar.get(Calendar.YEAR)) &&
prevYearCalendar.get(Calendar.MONTH)<Calendar.MARCH )
// advancing past a leap year day
daysBetween += 366;
else
daysBetween += 365;
prevYearCalendar = (Calendar) calendar.clone();
calendar.add(Calendar.YEAR, 1);
}
calendar = prevYearCalendar; // calendar always advances too far, so need to correct
// now advance calendar a day at a time until end date reached
while( calendar.getTime().before(endDate) )
{
calendar.add(Calendar.DAY_OF_MONTH, 1);
daysBetween++;
}
if( outOfOrder )
daysBetween = -daysBetween;
return daysBetween;
}
/**
* Given date, a Date object, and noOfDays, an int, the method returns
* a Date object corresponding to noOfDays later than date.
*
* If noOfDays is negative, the resulting Date object will be before date.
*
* @param date a Date object
* @param noOfDays an int
*
* @return a Date
*/
public static Date incrementDate(Date date, int noOfDays)
{
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, noOfDays);
return calendar.getTime();
}
/**
* Given year, an int, the method checks to see if the year
* is a leap year.
*
* @param year, an int
*
* @return a boolean, true only if the year is a leap year.
*/
public static boolean isLeapYear(int year)
{
GregorianCalendar calendar = new GregorianCalendar();
return calendar.isLeapYear(year);
}
/**
* Given dateString, a String, the method checks to see if string
* corresponds to a valid shortDatePattern.
*
* @param dateString, a String
*
* @return a boolean, true only if the dateString is a valid pattern
*/
public static boolean isValidDateString(String dateString)
{
try
{
Date d = DateUtil.convertStringToDate(dateString);
return true;
}
catch(RuntimeException ex)
{
return false;
}
}
/**
* Given date, a Date object, the method returns
* a Date object corresponding to the next day.
*
* @param noOfDays an int
*
* @return a Date
*/
public static Date nextDate(Date date)
{
return incrementDate(date, 1);
}
}

View File

@@ -0,0 +1,17 @@
#BlueJ class context
comment0.params=
comment0.target=Diary()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ Diary\n
comment1.params=itemReservation
comment1.target=void\ addReservation(LibraryReservation)
comment1.text=\n\ Method\ for\ adding\ a\ reservation\ to\ the\ diary.\ \n\ @parameter\ itemReservation,\ of\ type\ ItemReservation\ \n
comment2.params=startDate\ endDate
comment2.target=void\ printEntries(java.util.Date,\ java.util.Date)
comment2.text=\n\ Method\ for\ displaying\ the\ reservations\ between\ specified\ dates.\ \n\n\ @parameter\ \ \ \ \ startDate,\ of\ type\ Date\n\ @parameter\ \ \ \ \ endDate,\ of\ type\ Date\n
comment3.params=itemReservation
comment3.target=void\ deleteReservation(LibraryReservation)
comment3.text=\n\ Method\ for\ deleting\ a\ reservation\ from\ the\ diary.\ \n\ @parameter\ itemReservation,\ of\ type\ ItemReservation\ \n
comment4.params=date
comment4.target=LibraryReservation[]\ getReservations(java.util.Date)
comment4.text=\n\ Accessor\ method\ for\ returning\ all\ reservations\ that\ have\ entries\ \n\ in\ the\ diary\ for\ a\ particular\ date.\ \n\n\ @parameter\ \ \ \ \ date,\ of\ type\ Date\ \n\ @return\ \ \ \ \ \ \ \ an\ array\ of\ reservations,\ or\ null\ if\ no\ entry\ for\ that\ date\n
numComments=5

View File

@@ -0,0 +1,205 @@
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
/**
* A class Diary that represents a "diary" of library item reservations.
*
* The diary is structured as a Map of entries in which each entry corresponds
* to a specific day. As the map is not accessed in a sequential fashion, it
* doesn't matter whether the actual map class is a TreeMap or a HashMap.
*
* @author D E Newton
*
*/
public class Diary
{
private Map<Date, DayInDiary> dayInDiaryMap;
/**
* Constructor for objects of class Diary
*/
public Diary()
{
// create diary as a map
dayInDiaryMap = new HashMap<Date, DayInDiary>();
}
/**
* Method for adding a reservation to the diary.
* @parameter itemReservation, of type ItemReservation
*/
public void addReservation(LibraryReservation itemReservation)
{
Date date = itemReservation.getStartDate();
for(int day=1; day<=itemReservation.getNoOfDays(); day++)
{
if( !dayInDiaryMap.containsKey(date) )
{
// add new day to diary if no previous entries for this day
dayInDiaryMap.put(date, new DayInDiary(date));
}
dayInDiaryMap.get(date).addEntry(itemReservation, day);
date = DateUtil.nextDate(date);
}
}
/**
* Method for displaying the reservations between specified dates.
*
* @parameter startDate, of type Date
* @parameter endDate, of type Date
*/
public void printEntries(Date startDate, Date endDate)
{
if( DateUtil.daysBetween(startDate, endDate)<0 )
{
// startDate after endDate
System.out.println("*** Error in method displayEntries(): The specified end date is before the start date ***");
}
else
{
System.out.println("\n\nDiary: Reservations for period " + DateUtil.convertDateToShortString(startDate)
+ " to " + DateUtil.convertDateToShortString(endDate) + " inclusive");
System.out.println("=================================================================");
for(Date date=startDate; date.compareTo(endDate)<=0; date = DateUtil.nextDate(date))
{
String longDate = DateUtil.convertDateToLongString(date);
System.out.print(longDate + ":");
if( dayInDiaryMap.containsKey(date) )
{
DayInDiary dayInDiary = dayInDiaryMap.get(date);
dayInDiary.printEntries();
}
else
System.out.println(" No reservations\n");
}
}
}
/**
* Method for deleting a reservation from the diary.
* @parameter itemReservation, of type ItemReservation
*/
public void deleteReservation(LibraryReservation itemReservation)
{
Date date = itemReservation.getStartDate();
for(int day=1; day<=itemReservation.getNoOfDays(); day++)
{
DayInDiary dayInDiary = dayInDiaryMap.get(date);
dayInDiary.deleteEntry(itemReservation);
if( dayInDiary.getDaysEntries().size()==0 )
dayInDiaryMap.remove(date);
date = DateUtil.nextDate(date);
}
}
/**
* Accessor method for returning all reservations that have entries
* in the diary for a particular date.
*
* @parameter date, of type Date
* @return an array of reservations, or null if no entry for that date
*/
public LibraryReservation[] getReservations(Date date)
{
DayInDiary dayinDiary = dayInDiaryMap.get(date);
if( dayinDiary==null )
return null;
else
return dayinDiary.getReservations();
}
// inner class, only needed in the Diary class
private class DayInDiary
{
// reservations for the day
private ArrayList<Entry> daysEntries;
private Date date;
/*
* Constructor for objects of class DayInDiary
*/
private DayInDiary(Date date)
{
this.date = date;
daysEntries = new ArrayList<Entry>();
}
private ArrayList<Entry> getDaysEntries()
{
return daysEntries;
}
private LibraryReservation[] getReservations()
{
int noOfEntries = daysEntries.size();
LibraryReservation[] itemReservations = new LibraryReservation[noOfEntries];
for(int i=0; i<noOfEntries; i++)
itemReservations[i] = daysEntries.get(i).getReservation();
return itemReservations;
}
private void addEntry(LibraryReservation itemReservation, int dayNo)
{
daysEntries.add(new Entry(itemReservation, dayNo));
}
private void deleteEntry(LibraryReservation itemReservation)
{
// find the entry for this reservation and delete it
Entry toBeDeletedEntry = null;
for(Entry entry : daysEntries)
{
if( entry.getReservation()==itemReservation ) // in this situation, this is better than using "equals()"
{
toBeDeletedEntry = entry;
break;
}
}
daysEntries.remove(toBeDeletedEntry);
}
private void printEntries()
{
int size = daysEntries.size();
if( size>0 )
{
System.out.println(" " + size + " reservation(s)");
for( Entry entry: daysEntries )
{
LibraryReservation itemReservation = entry.getReservation();
int reservationDay = DateUtil.daysBetween(itemReservation.getStartDate(), date) + 1;;
System.out.println(" " + itemReservation + ", day " + reservationDay + " of " + itemReservation.getNoOfDays());
}
}
else
{
System.out.println("*** Unexpected error in displayEntries() ***");
System.out.println("*** No entries for this date so it should not be in the diary ***");
}
System.out.println();
}
// an inner class of the DaysDiary class
private class Entry
{
private LibraryReservation itemReservation;
private int reservationDay; // e.g. second day is day 2 of 4 for a reservation spanning 4 days
private Entry(LibraryReservation itemReservation, int reservationDay)
{
this.itemReservation = itemReservation;
this.reservationDay = reservationDay;
}
private LibraryReservation getReservation()
{
return itemReservation;
}
}
}
}

View File

@@ -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

View File

@@ -0,0 +1,573 @@
// Import all required libraries. Not using .* as it is not good practice due to potential conflicts.
import java.util.Scanner;
import java.util.Random;
import java.util.Map;
import java.util.HashMap;
import java.util.Date;
import java.util.NoSuchElementException;
import java.io.File;
import java.io.IOException;
import java.awt.FileDialog;
import java.awt.Frame;
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
*
* @author George Wilkinson
* @version 3.0
*/
public class Library
{
// private List<LibraryItem> itemList; // Initialise an ArrayList of name itemList to store Library Items
// private List<LibraryUser> userList; // Initialise an ArrayList of name userList to store Library Users
/* No longer needed, as we can use the keys of customerMap.
private HashSet<String> uuidSet; // Initialise a Hash Set of name uuidSet ( unique user identifier ) to store unique user IDs for efficient O(1) searching
*/
private Map<String, LibraryUser> customerMap;
private Map<String, LibraryItem> itemsMap;
private Map<String, LibraryReservation> libraryReservationMap;
private Diary diary;
/*
* Constructor for objects of class Library
*/
public Library()
{
// itemList = new ArrayList<LibraryItem>();
// userList = new ArrayList<LibraryUser>();
/* No longer needed, can use keys of customerMap.
uuidSet = new HashSet<String>();
*/
customerMap = new HashMap<String, LibraryUser>();
itemsMap = new HashMap<String, LibraryItem>();
libraryReservationMap = new HashMap<String, LibraryReservation>();
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
*/
/*
* Inserts object value item alongside key of @itemCode into @itemsMap.
*/
private void storeItem( LibraryItem item )
{
// itemList.add( item );
itemsMap.put( item.getItemCode(), item );
}
/*
* Inserts object value user alongside key of @userID into @customerMap.
* If the userID is set to unknown, it will call @generateUserID.
*/
private void storeUser( LibraryUser user )
{
// userList.add( user );
if ( user.getUserID().equals( "unknown" ) )
{
user.setUserID( generateUserID( "AB-", 6 ) );
}
customerMap.put( user.getUserID(), user ); // Store the user along with the userID.
}
/**
* Inserts object value reservation alongside key of @reservationNo into @libraryReservationMap.
**/
private void storeLibraryReservation( LibraryReservation reservation )
{
libraryReservationMap.put( reservation.getReservationNo(), reservation );
diary.addReservation( reservation );
}
/**
* Storing Objects End
*/
/**
* Generate IDs Start
*/
/**
* Generate a sequential reservation number padded with 0s to a length of 6.
*
* 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.
* 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
* 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.
* When a reservation is deleted that does not have the highest reservation number, conflicting reservation numbers are generated.
* e.g. 5 reservations, reservation 3 ID: 000003 is deleted. The next reservation number would be 000004, as the size + 1 = 4
*/
String candidateNo = String.format("%06d", libraryReservationMap.size() + 1);
for ( int i = 1; libraryReservationMap.containsKey( candidateNo ); i++ )
{
candidateNo = String.format( "%06d", libraryReservationMap.size() + i );
}
return candidateNo;
}
/**
* Generate a unique user identifier to apply to users when the UUID is unknown.
* This generates a number of @length length using the Random class, and prefixes @prefix.
*
* Takes Parameters
* 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.
* If we just use 10^(length), this would generate any number under 1,000,000.
* This is an issue since any integers below 100,000 can be used, which would be incorrect.
* By using the offset of a factor of 10 below the desired length we can generate between 0 and 899,999.
* After this, we can add 100,000 back to the number to ensure a baseline length is maintained.
*
* 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)
**/
private String generateUserID( String prefix, int length )
{
Random random = new Random();
final int offset = (int) Math.pow( 10, (length-1) ); // Static integer equal to 10^(length-1) lower than length. This will allow for the factor to be consistent.
int intLength = (int) ( Math.pow( 10, length ) ) - offset ; // Integer equal to 10^(length) minus the offset. This creates a ceiling for the ID range.
if ( customerMap.size() == intLength ) {
System.out.println("Too many user IDs delegated for current range, increasing ID range by a factor of 10");
return generateUserID( prefix, length+1 );
/*
* This is essential for eliminating a stack overflow error when the specified range is full. This would be incorrect to catch.
* By incrementing the length value when the ID range is full, roughly 2.1 billion users can be created without running into an overflow error.
*/
}
String uuid = prefix + ( random.nextInt( intLength ) + offset );
/*
* Sets the uid to the prefix, concat. with a random integer of specified length
* Add the offset to a random number, to create a floor to the ID range.
*/
if ( customerMap.containsKey( uuid ) ) // Previously uuidSet.contains, replaced to de-dupe held data.
{
generateUserID( prefix, length ); // If the ID generated is already contained in the hashset, the method should be called again.
}
/* No longer needed, as we add the user and the ID to the customerMap when storing.
* uuidSet.add( uuid )
*/
return uuid;
}
/**
* Generate IDs End
*/
/**
* Print Object Details Start
*/
/**
* 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.
**/
public void printLibraryReservations() {
System.out.println( "Reservation Details Start" );
for ( LibraryReservation reservation : libraryReservationMap.values() ){
System.out.println("---------------");
reservation.printDetails();
}
System.out.println( "---------------\nReservation Details End\n" );
}
/**
* Prints to the terminal, in a human-readable format, all:
* LibraryItem(s)
* LibraryUser(s)
* LibraryReservation(s)
*
* 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()
{
System.out.println("\n\nItem Details Start");
for( LibraryItem item : itemsMap.values() )
{
System.out.println("---------------");
item.printDetails();
}
System.out.println("---------------");
System.out.println("Items Details End\n\n---------------\n\nUser Details Start\n");
for ( LibraryUser user : customerMap.values() )
{
System.out.println("---------------");
user.printDetails();
}
System.out.println("---------------\nUser Details End\n");
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 )
{
diary.printEntries( DateUtil.convertStringToDate( start ), DateUtil.convertStringToDate( end ) );
}
/**
* Print Object Details End
*/
/**
* Write Files Start
*/
/**
* 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()
{
try {
Frame frame = null; // Initialise null frame
FileDialog fileBox = new FileDialog( frame, "Save", FileDialog.SAVE ); // Initialise file dialog box to save written data.
fileBox.setVisible( true );
PrintWriter writer = new PrintWriter( new File( fileBox.getDirectory() + fileBox.getFile() ) );
for ( LibraryReservation reservation : libraryReservationMap.values() ) {
reservation.writeData( writer );
}
writer.close();
}
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." );
}
}
/**
* 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()
{
try {
Frame frame = null; // Initialise null frame
FileDialog fileBox = new FileDialog( frame, "Save", FileDialog.SAVE ); // Initialise file dialog box to save written data.
fileBox.setVisible( true );
PrintWriter writer = new PrintWriter( new File( fileBox.getDirectory() + fileBox.getFile() ) ); // Create PrintWriter to write user data to.
// for ( LibraryUser user : userList ){
writer.println("[Library User data]"); // Write the type header into the file.
for ( LibraryUser user : customerMap.values() ) {
user.writeData( writer );
}
writer.close();
}
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." );
}
}
/**
* Write Files End
*/
/**
* Read Files Start
*/
/**
* 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()
{
try {
Frame frame = null; // Initialise null frame
FileDialog fileBox = new FileDialog( frame, "Load", FileDialog.LOAD ); // Initialise file dialog box to save written data.
fileBox.setVisible( true );
Scanner reservationScanner = new Scanner ( new File( fileBox.getDirectory() + fileBox.getFile() ) );
while ( reservationScanner.hasNextLine() )
{
Scanner detailScanner = new Scanner( reservationScanner.nextLine() ).useDelimiter(",");
LibraryReservation reservation = new LibraryReservation();
reservation.readData( detailScanner );
storeLibraryReservation( reservation );
detailScanner.close();
}
reservationScanner.close(); // Close Scanner
}
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." );
}
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.
* This will create the corresponding objects depending on flags contained in the file
* and populate it's fields.
*
* Default flag value: "book", to support legacy files. This will not interfere with
* files of different flag orders.
**/
public void readData()
{
Frame frame = null; // Initialise a null frame
FileDialog fileBox = new FileDialog( frame, "Open", FileDialog.LOAD ); // Initialise filebox with the null frame pointer
fileBox.setVisible( true ); // Open a file selection dialog to the user.
try {
Scanner fileScanner = new Scanner( new File( fileBox.getDirectory() + fileBox.getFile() ) );
String itemType = "book"; // Set a default flag to support legacy files.
while( fileScanner.hasNextLine() ) {
String lineItem = fileScanner.nextLine();
// Ensure no comments or empty lines are included
if ( lineItem.contains( "//" ) || lineItem.trim().isEmpty() ){}
// Check current line is a candidate flag
else if ( lineItem.startsWith("[" ) ) {
if ( lineItem.toLowerCase().contains("book") )
itemType = "book";
else if ( lineItem.toLowerCase().contains("periodical") )
itemType = "periodical";
else if ( lineItem.toLowerCase().contains("cd") )
itemType = "cd";
else if ( lineItem.toLowerCase().contains("dvd") )
itemType = "dvd";
else if ( lineItem.toLowerCase().contains("user") )
itemType = "user";
else {
System.out.println( "Flag detected, but no accepted format...\n Cannot store item in Library. Changing Flag to generic and skipping the following: ");
itemType = "generic";
}
}
// Unfortunately cannot use switch case with string comparisons in Java 8.
// Check current flag for data processing.
else {
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.
if ( itemType.equals( "book" ) ) {
// Process Book Data
item = new Book();
}
else if ( itemType.equals( "periodical" ) ) {
// Process Periodic Data
item = new Periodical();
}
else if ( itemType.equals( "cd" ) ) {
//Process CD Data
item = new CD();
}
else if ( itemType.equals( "dvd" ) ) {
//Process DVD Data
item = new DVD();
}
else if ( itemType.equals( "user" ) ) {
//Process User Data
LibraryUser user = new LibraryUser();
user.readData( detailScanner );
storeUser( user );
continue;
}
else if ( itemType.equals( "generic" ) ) {
// Output unaccepted lines to terminal
System.out.println( lineItem );
continue;
}
item.readItemData( detailScanner ); // Deduped from if statements
storeItem( item );
detailScanner.close();
}
}
fileScanner.close();
}
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." );
}
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." );
}
}
/**
* Read Files End
*/
/**
* Other Methods
*/
/**
* 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 )
{
if ( !customerMap.containsKey( userID ) )
{
System.out.println( "User does not exist" );
return false;
}
if ( !itemsMap.containsKey( itemCode ) )
{
System.out.println( "Item does not exist in library" );
return false;
}
if ( !DateUtil.isValidDateString( startDate ) )
{
System.out.println( "Date is not valid" );
return false;
}
if ( !(noOfDays > 0) )
{
System.out.println( "Reservation must be more than 0 days" );
return false;
}
Date start = DateUtil.convertStringToDate( startDate );
/*
* 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 );
*/
String rID = generateReservationNo(); // Generate a sequential ID for the reservation.
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
* 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.
**/
for ( LibraryReservation diaryReservation : diary.getReservations( start ) )
{
if ( diaryReservation.toString().equals( reservation.toString() ) )
{
System.err.println( "This item is already reserved" );
return false; // Reservation unsuccessful
}
}
storeLibraryReservation( reservation );
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 )
{
if ( libraryReservationMap.containsKey( reservationNo ) )
{
// Since the application does not know the time, or use timers, this is the best I can do to remove the loan status.
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.
}
}
}

View File

@@ -0,0 +1,30 @@
#BlueJ class context
comment0.params=
comment0.target=java.lang.String\ getTitle()
comment0.text=\n\ Field\ Accessor\ Start\n
comment1.params=
comment1.target=java.lang.String\ getItemCode()
comment10.params=
comment10.target=void\ printDetails()
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.target=void\ readItemData(java.util.Scanner)
comment11.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
comment2.params=
comment2.target=int\ getCost()
comment3.params=
comment3.target=int\ getTimesBorrowed()
comment4.params=
comment4.target=boolean\ getOnLoan()
comment5.params=title
comment5.target=void\ setTitle(java.lang.String)
comment5.text=\n\ Field\ Accessor\ End\n\ \n\ Field\ Mutator\ Start\n
comment6.params=itemCode
comment6.target=void\ setItemCode(java.lang.String)
comment7.params=cost
comment7.target=void\ setCost(int)
comment8.params=timesBorrowed
comment8.target=void\ setTimesBorrowed(int)
comment9.params=onLoan
comment9.target=void\ setOnLoan(boolean)
numComments=12

View File

@@ -0,0 +1,115 @@
import java.util.Scanner;
import java.util.NoSuchElementException;
/**
* Superclass of items / assets stored in a Library.
*
* @author George Wilkinson
* @version 4.1
*/
public abstract class LibraryItem
{
// instance variables
private String title;
private String itemCode;
private int cost;
private int timesBorrowed;
private boolean onLoan;
/*
* Field Accessor Start
*/
public String getTitle()
{
return title;
}
public String getItemCode()
{
return itemCode;
}
public int getCost()
{
return cost;
}
public int getTimesBorrowed()
{
return timesBorrowed;
}
public boolean getOnLoan()
{
return onLoan;
}
/*
* Field Accessor End
*
* Field Mutator Start
*/
public void setTitle( String title )
{
this.title = title;
}
public void setItemCode( String itemCode )
{
this.itemCode = itemCode;
}
public void setCost( int cost )
{
this.cost = cost;
}
public void setTimesBorrowed( int timesBorrowed )
{
this.timesBorrowed = timesBorrowed;
}
public void setOnLoan( boolean onLoan )
{
this.onLoan = onLoan;
}
/*
* Field Mutator End
*/
/**
* Forms field variables in a desired format, prints
* to the PrintWriter, and flush to the file.
* Takes Parameter
* PrintWriter @writer
*/
public void printDetails()
{
System.out.println("Item Code: " + itemCode +
"\nTitle: " + title +
"\nCost: £" + ( ( float )( cost ) )/100 + // Convert cost in pence to £pounds.pence to be more readable.
"\nBorrowed " + getTimesBorrowed() + " times." );
if( getOnLoan() )
System.out.println( "On Loan");
else
System.out.println( "Available to Loan");
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ) {
if ( detailScanner != null ) {
this.title = detailScanner.next().trim();
this.itemCode = detailScanner.next().trim();
this.cost = Integer.parseInt( detailScanner.next().trim() );
this.timesBorrowed = Integer.parseInt( detailScanner.next().trim() );
this.onLoan = Boolean.parseBoolean( detailScanner.next().trim() );
}
}
}

View File

@@ -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

View File

@@ -0,0 +1,152 @@
/**
* A class to track and allow for reservations in a Library
*
* @George Wilkinson
* @1.0
*/
import java.util.Date;
import java.io.PrintWriter;
import java.util.Scanner;
public class LibraryReservation
{
// instance variables
private String reservationNo;
private String itemCode;
private String userID;
private Date startDate;
private int noOfDays;
/**
* Constructor for objects of class LibraryReservation
*/
public LibraryReservation( String reservationNo, String itemCode, String userID, String startDate, int noOfDays )
{
this.reservationNo = reservationNo;
this.itemCode = itemCode;
this.userID = userID;
this.startDate = DateUtil.convertStringToDate( startDate );
this.noOfDays = noOfDays;
}
/**
* Default Constructor for objects of class 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()
{
return reservationNo + " " + userID + " " + itemCode;
}
/**
* Prints to terminal, the details of the reservation.
*/
public void printDetails()
{
System.out.println( "Reservation Number: " + reservationNo +
"\nItem Code: " + itemCode +
"\nUser ID: " + userID +
"\nDate Commencing: " + DateUtil.convertDateToShortString( startDate ) +
"\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 )
{
writer.print( reservationNo + "," + itemCode + "," + userID + "," + DateUtil.convertDateToShortString( startDate ) + "," + noOfDays );
writer.flush();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readData( Scanner detailScanner )
{
if ( detailScanner != null ) {
this.reservationNo = detailScanner.next().trim();
this.itemCode = detailScanner.next().trim();
this.userID = detailScanner.next().trim();
this.startDate = DateUtil.convertStringToDate( detailScanner.next().trim() );
this.noOfDays = Integer.parseInt( detailScanner.next().trim() );
}
}
}

View File

@@ -0,0 +1,36 @@
#BlueJ class context
comment0.params=
comment0.target=LibraryUser()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ LibraryUser.\n
comment1.params=
comment1.target=java.lang.String\ getUserID()
comment1.text=\n\ Accessor\ start\ -\ return\ values\ of\ corresponding\ variables.\n
comment10.params=title
comment10.target=void\ setTitle(java.lang.String)
comment11.params=writer
comment11.target=void\ writeData(java.io.PrintWriter)
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.target=void\ printDetails()
comment12.text=\n\ Print\ to\ terminal\ all\ relevant\ fields.\n
comment13.params=detailScanner
comment13.target=void\ readData(java.util.Scanner)
comment13.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
comment2.params=
comment2.target=java.lang.String\ getSurname()
comment3.params=
comment3.target=java.lang.String\ getFirstName()
comment4.params=
comment4.target=java.lang.String\ getOtherInitials()
comment5.params=
comment5.target=java.lang.String\ getTitle()
comment6.params=userID
comment6.target=void\ setUserID(java.lang.String)
comment6.text=\n\ Accessor\ End\n\ Mutator\ Start\ -\ Set\ value\ of\ corresponding\ variables\n
comment7.params=surname
comment7.target=void\ setSurname(java.lang.String)
comment8.params=firstName
comment8.target=void\ setFirstName(java.lang.String)
comment9.params=otherInitials
comment9.target=void\ setOtherInitials(java.lang.String)
numComments=14

View File

@@ -0,0 +1,121 @@
/**
* Class LibraryUser to create a user of a library.
*
* @George Wilkinson
* @2.3
*/
import java.util.Scanner;
import java.io.PrintWriter;
public class LibraryUser
{
// instance variables
private String userID, surname, firstName, otherInitials, title;
/**
* Constructor for objects of class LibraryUser.
*/
public LibraryUser(){}
/*
* Accessor start - return values of corresponding variables.
*/
public String getUserID()
{
return userID;
}
public String getSurname()
{
return surname;
}
public String getFirstName()
{
return firstName;
}
public String getOtherInitials()
{
return otherInitials;
}
public String getTitle()
{
return title;
}
/*
* Accessor End
* Mutator Start - Set value of corresponding variables
*/
public void setUserID( String userID )
{
this.userID = userID;
}
public void setSurname( String surname )
{
this.surname = surname;
}
public void setFirstName( String firstName )
{
this.firstName = firstName;
}
public void setOtherInitials( String otherInitials )
{
this.otherInitials = otherInitials;
}
public void setTitle( String title )
{
this.title = title;
}
/*
* Mutator End
*/
/**
* 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 )
{
writer.print(userID + ", " + surname + ", " + firstName + ", " + otherInitials + ", " + title + "\n");
writer.flush();
}
/*
* Print to terminal all relevant fields.
*/
public void printDetails()
{
System.out.println( "ID: " + userID +
"\nName: " + title + " " + firstName + " " + otherInitials + " " + surname );
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readData( Scanner detailScanner )
{
if ( detailScanner != null ) {
this.userID = detailScanner.next().trim();
this.surname = detailScanner.next().trim();
this.firstName = detailScanner.next().trim();
this.otherInitials = detailScanner.next().trim();
this.title = detailScanner.next().trim();
}
}
}

View File

@@ -0,0 +1,17 @@
#BlueJ class context
comment0.params=
comment0.target=Periodical()
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ Periodical\n\ Since\ all\ field\ variables\ initialise\ as\ null,\ nothing\ should\ happen\ here.\n
comment1.params=
comment1.target=java.lang.String\ getPublicationDate()
comment1.text=\n\ Return\ value\ of\ @publicationDate\n
comment2.params=publicationDate
comment2.target=void\ setPublicationDate(java.lang.String)
comment2.text=\n\ Set\ value\ of\ @publicationDate\n
comment3.params=
comment3.target=void\ printDetails()
comment3.text=\n\ Print\ to\ terminal,\ relevant\ field\ variable's\ values.\n
comment4.params=detailScanner
comment4.target=void\ readItemData(java.util.Scanner)
comment4.text=\n\ Populate\ the\ fields\ with\ details\ from\ the\ scanner\n\ Takes\ Parameters\n\ \ Scanner\ @detailScanner\n
numComments=5

View File

@@ -0,0 +1,56 @@
/**
* Subclass of LibraryItem to create a periodical ( e.g. newspaper, tabloid ).
*
* @George Wilkinson
* @2.5
*/
import java.util.Scanner;
public class Periodical extends PrintedItem
{
private String publicationDate;
/**
* Constructor for objects of class Periodical
* Since all field variables initialise as null, nothing should happen here.
*/
public Periodical(){}
/*
* Return value of @publicationDate
*/
public String getPublicationDate()
{
return publicationDate;
}
/*
* Set value of @publicationDate
*/
public void setPublicationDate( String publicationDate )
{
this.publicationDate = publicationDate;
}
/*
* Print to terminal, relevant field variable's values.
*/
public void printDetails() {
System.out.println( "Publication Date: " + publicationDate );
super.printDetails();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.publicationDate = detailScanner.next().trim();
super.readItemData( detailScanner );
}
}
}

View File

@@ -0,0 +1,18 @@
#BlueJ class context
comment0.params=
comment0.target=int\ getNoOfPages()
comment0.text=\n\ Field\ Accessor\ Start\n
comment1.params=
comment1.target=java.lang.String\ getPublisher()
comment2.params=noOfPages
comment2.target=void\ setNoOfPages(int)
comment2.text=\n\ Field\ Accessor\ End\n\ \n\ Field\ Mutator\ Start\n
comment3.params=publisher
comment3.target=void\ setPublisher(java.lang.String)
comment4.params=
comment4.target=void\ printDetails()
comment4.text=\n\ Field\ Mutator\ End\n
comment5.params=detailScanner
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

View File

@@ -0,0 +1,67 @@
/**
* Subclass of LibraryItem to create objects of printed items in a library.
*
* @George Wilkinson
* @1.1
*/
import java.util.Scanner;
public abstract class PrintedItem extends LibraryItem
{
private int noOfPages;
private String publisher;
/*
* Field Accessor Start
*/
public int getNoOfPages()
{
return noOfPages;
}
public String getPublisher()
{
return publisher;
}
/*
* Field Accessor End
*
* Field Mutator Start
*/
public void setNoOfPages( int noOfPages )
{
this.noOfPages = noOfPages;
}
public void setPublisher( String publisher )
{
this.publisher = publisher;
}
/*
* Field Mutator End
*/
public void printDetails()
{
System.out.println("Page Count: " + noOfPages +
"\nPublisher: " + publisher);
super.printDetails();
}
/**
* Populate the fields with details from the scanner
* Takes Parameters
* Scanner @detailScanner
*/
public void readItemData( Scanner detailScanner ){
if ( detailScanner != null ) {
this.noOfPages = Integer.parseInt( detailScanner.next().trim() );
this.publisher = detailScanner.next().trim();
super.readItemData( detailScanner );
}
}
}

View File

@@ -0,0 +1,12 @@
------------------------------------------------------------------------
This is the project README file. Here, you should describe your project.
Tell the reader (someone who does not know anything about this project)
all he/she needs to know. The comments should usually include at least:
------------------------------------------------------------------------
PROJECT TITLE:
PURPOSE OF PROJECT:
VERSION or DATE:
HOW TO START THIS PROJECT:
AUTHORS:
USER INSTRUCTIONS:

View File

@@ -0,0 +1,12 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
// data is title, itemCode, cost, timesBorrowed, onLoan
Objects First with Java, LM002411,3989,781,true
Compilers: Principles Techniques and Tools, LM002711,599,0,FALSE
C# How to Program, LM002876,4599,45,TRUE
Unix Made Easy: The Basics and Beyond (Made Easy), LM002468,6395,0,TRUE
Galerkin Finite Element Methods for Parabolic Problems, LM002153,4554,0,FALSE

View File

@@ -0,0 +1,12 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
// data is author, isbn, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
Barnes and Kolling, 9780131976290,480, Pearson, Objects First with Java, LM002411,3989,781,true
Aho Sethi and Ullman, 9780201101942,795, Addison-Wesley, Compilers: Principles Techniques and Tools, LM002711,599,0,FALSE
Harvey Paul and Jeffrey, 9780130622211,1568, Prentice Hall, C# How to Program, LM002876,4599,45,TRUE
Muster, 9780072193145,1011, McGraw-Hill, Unix Made Easy: The Basics and Beyond (Made Easy), LM002468,6395,0,TRUE
Thomee, 9783540331216,370, Springer Verlag, Galerkin Finite Element Methods for Parabolic Problems, LM002153,4554,0,FALSE

View File

@@ -0,0 +1,18 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
[Book data]
// data is author, isbn, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
Barnes and Kolling, 9780131976290,480, Pearson, Objects First with Java, LM002411,3989,781,true
Aho Sethi and Ullman, 9780201101942,795, Addison-Wesley, Compilers: Principles Techniques and Tools, LM002711,599,0,FALSE
Harvey Paul and Jeffrey, 9780130622211,1568, Prentice Hall, C# How to Program, LM002876,4599,45,TRUE
Muster, 9780072193145,1011, McGraw-Hill, Unix Made Easy: The Basics and Beyond (Made Easy), LM002468,6395,0,TRUE
Thomee, 9783540331216,370, Springer Verlag, Galerkin Finite Element Methods for Parabolic Problems, LM002153,4554,0,FALSE
[periodical data]
// data is publicationDate, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
25-03-20,70, News International, The Times, LM005447,80,250000,FALSE
26-03-20,70, News International, The Times, LM005002,80,560562,false
26-04-20, 70, Associated Newspapers, Daily Mail, LM005177,75,478908,false

View File

@@ -0,0 +1,23 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
[Book data]
// data is author, isbn, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
Barnes and Kolling, 9780131976290,480, Pearson, Objects First with Java, LM002411,3989,781,true
Aho Sethi and Ullman, 9780201101942,795, Addison-Wesley, Compilers: Principles Techniques and Tools, LM002711,599,0,FALSE
Harvey Paul and Jeffrey, 9780130622211,1568, Prentice Hall, C# How to Program, LM002876,4599,45,TRUE
Muster, 9780072193145,1011, McGraw-Hill, Unix Made Easy: The Basics and Beyond (Made Easy), LM002468,6395,0,TRUE
Thomee, 9783540331216,370, Springer Verlag, Galerkin Finite Element Methods for Parabolic Problems, LM002153,4554,0,FALSE
[periodical data]
// data is publicationDate, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
25-03-20,70, News International, The Times, LM005447,80,250000,FALSE
26-03-20,70, News International, The Times, LM005002,80,560562,false
26-04-20, 70, Associated Newspapers, Daily Mail, LM005177,75,478908,false
[misc data]
25-03-20,70, News International, The Times, LM005447,80,250000,FALSE
26-03-20,70, News International, The Times, LM005002,80,560562,false
26-04-20, 70, Associated Newspapers, Daily Mail, LM005177,75,478908,false

View File

@@ -0,0 +1,43 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
[Book data]
// data is author, isbn, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
Barnes and Kolling, 9780131976290,480, Pearson, Objects First with Java, LM002411,3989,781,true
Aho Sethi and Ullman, 9780201101942,795, Addison-Wesley, Compilers: Principles Techniques and Tools, LM002711,599,500,FALSE
Harvey Paul and Jeffrey, 9780130622211,1568, Prentice Hall, C# How to Program, LM002876,4599,45,TRUE
Muster, 9780072193145,1011, McGraw-Hill, Unix Made Easy: The Basics and Beyond (Made Easy), LM002468,6395,678,TRUE
Thomee, 9783540331216,370, Springer Verlag, Galerkin Finite Element Methods for Parabolic Problems, LM002153,4554,543,FALSE
[periodical data]
// data is publicationDate, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
25-03-20,70, News International, The Times, LM005447,80,250000,FALSE
26-03-20,70, News International, The Times, LM005002,80,560562,false
26-04-20, 70, Associated Newspapers, Daily Mail, LM005177,75,478908,false
[CD data]
// data is artist, noOfTracks, playingTime, title, itemCode, cost, timesBorrowed, onLoan
James Blunt,15,68, Back to Bedlam, LM003604,498,234,true
Duffy,10,73, Rockferry, LM003553,898,90,false
Adele,12,19,75, LM003580,798,87,FALSE
Robert Plant and Alison Krauss,13,72, Raising Sand, LM003750,898,89,tRUE
Goldfrapp,10,72, Seventh Tree, LM003873,1299,9876,true
Amy Winehouse,11,70, Back To Black, LM003698,698,8765,false
Jack Johnson,15,67, Sleep Through The Static, LM003773,898,54,True
Mark Ronson,14,74, Version, LM003365,698,56,true
Radiohead,10,75, In Rainbows , LM003771,798,6543,FALSE
Nick Cave,11,68, Dig!!! Lazarus Dig!!!, LM003751,1199,90,False
Nickelback,11,72, All the Right Reasons, LM003915,598,32,true
[DVD data]
// data is director, playingTime, title, itemCode, cost, timesBorrowed, onLoan
Chris Miller,92, Shrek The Third, LM004314,1026,900,TRUE
Robert Zemeckis,114, Beowulf , LM004079,900,87,FALSE
Phyllida Lloyd,118, Mamma Mia, LM004984,798,566,true
Joe Wright,130, Atonement, LM004720,1293,66,true
Andrew Adamson,125, The Chronicles of Narnia: Prince Caspian, LM004178,345,45,FALSE

View File

@@ -0,0 +1,48 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
[Book data]
// data is author, isbn, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
Barnes and Kolling, 9780131976290,480, Pearson, Objects First with Java, LM002411,3989,781,true
Aho Sethi and Ullman, 9780201101942,795, Addison-Wesley, Compilers: Principles Techniques and Tools, LM002711,599,890,FALSE
Harvey Paul and Jeffrey, 9780130622211,1568, Prentice Hall, C# How to Program, LM002876,4599,45,TRUE
Muster, 9780072193145,1011, McGraw-Hill, Unix Made Easy: The Basics and Beyond (Made Easy), LM002468,6395,8765,TRUE
Thomee, 9783540331216,370, Springer Verlag, Galerkin Finite Element Methods for Parabolic Problems, LM002153,4554,780,FALSE
[CD data]
// data is artist, noOfTracks, playingTime, title, itemCode, cost, timesBorrowed, onLoan
James Blunt,15,68, Back to Bedlam, LM003604,498,234,true
Duffy,10,73, Rockferry, LM003553,898,90,false
Adele,12,19,75, LM003580,798,87,FALSE
Robert Plant and Alison Krauss,13,72, Raising Sand, LM003750,898,89,tRUE
Goldfrapp,10,72, Seventh Tree, LM003873,1299,9876,true
Amy Winehouse,11,70, Back To Black, LM003698,698,8765,false
Jack Johnson,15,67, Sleep Through The Static, LM003773,898,54,True
Mark Ronson,14,74, Version, LM003365,698,56,true
Radiohead,10,75, In Rainbows , LM003771,798,6543,FALSE
Nick Cave,11,68, Dig!!! Lazarus Dig!!!, LM003751,1199,90,False
Nickelback,11,72, All the Right Reasons, LM003915,598,32,true
[DVD data]
// data is director, playingTime, title, itemCode, cost, timesBorrowed, onLoan
Chris Miller,92, Shrek The Third, LM004314,1026,900,TRUE
Robert Zemeckis,114, Beowulf , LM004079,900,87,FALSE
Phyllida Lloyd,118, Mamma Mia, LM004984,798,566,true
Joe Wright,130, Atonement, LM004720,1293,66,true
Andrew Adamson,125, The Chronicles of Narnia: Prince Caspian, LM004178,345,45,FALSE
[periodical data]
// data is publicationDate, noOfPages, publisher, title, itemCode, cost, timesBorrowed, onLoan
25-03-08,70, News International, The Times, LM005447,80,0,FALSE
26-03-08,70, News International, The Times, LM005002,80,0,false
26-03-08,60, Associated Newspapers, Daily Mail, LM005177,40,0,false
[Library User Data]
// data is userID, surname, firstName, otherInitials, title
unknown, Newton, David, E, Dr
unknown, Gregson, Brian, R T, Mr
unknown, Evans, David, , Dr
unknown, Smith, Sara, C, Ms

View File

@@ -0,0 +1,12 @@
// this is a comment, any lines that start with //
// (and blank lines) should be ignored
// New user data
// data is userID, surname, firstName, otherInitials, title
[Library User Data]
unknown, Newton, David, E, Dr
unknown, Gregson, Brian, R T, Mr
unknown, Evans, David, , Dr
unknown, Smith, Sara, C, Ms

View File

@@ -0,0 +1 @@
0,LM005002,AB-217000,24-03-2024,3

View File

@@ -0,0 +1,5 @@
[Library User data]
AB-217000, Gregson, Brian, R T, Mr
AB-711612, Smith, Sara, C, Ms
AB-861906, Evans, David, , Dr
AB-573164, Newton, David, E, Dr

View File

@@ -0,0 +1,183 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_392) on Thu Feb 29 11:54:14 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Book
</TITLE>
<META NAME="date" CONTENT="2024-02-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Book";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class Book</H2>
<PRE>
java.lang.Object
<IMG SRC="./resources/inherit.gif" ALT="extended by ">LibraryItem
<IMG SRC="./resources/inherit.gif" ALT="extended by ">PrintedItem
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>Book</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Book</B><DT>extends PrintedItem</DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="Book.html#Book()">Book</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor for objects of class Book</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Book.html#printDetails()">printDetails</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Book.html#readItemData(java.util.Scanner)">readItemData</A></B>(java.util.Scanner&nbsp;detailScanner)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_PrintedItem"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class PrintedItem</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>getNoOfPages, getPublisher, setNoOfPages, setPublisher</CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_LibraryItem"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class LibraryItem</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>getCost, getItemCode, getOnLoan, getTimesBorrowed, getTitle, setCost, setItemCode, setOnLoan, setTimesBorrowed, setTitle</CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Book()"><!-- --></A><H3>
Book</H3>
<PRE>
public <B>Book</B>()</PRE>
<DL>
<DD>Constructor for objects of class Book
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="printDetails()"><!-- --></A><H3>
printDetails</H3>
<PRE>
public void <B>printDetails</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>printDetails</CODE> in class <CODE>LibraryItem</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readItemData(java.util.Scanner)"><!-- --></A><H3>
readItemData</H3>
<PRE>
public void <B>readItemData</B>(java.util.Scanner&nbsp;detailScanner)</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>readItemData</CODE> in class <CODE>PrintedItem</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,379 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 22:06:18 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
DateUtil
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="DateUtil";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class DateUtil</H2>
<PRE>
java.lang.Object
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>DateUtil</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>DateUtil</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
A class DateUtil with the following methods for dealing with dates.
public static String convertDateToLongString(Date date)
public static String convertDateToShortString(Date date)
public static Date convertStringToDate(String dateString)
public static int daysBetween(Date startDate, Date endDate)
public static Date incrementDate(Date date, int noOfDays)
public static boolean isLeapYear(int year)
public static boolean isValidDateString(String dateString)
public static Date nextDate(Date date)
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>D E Newton</DD>
</DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.text.SimpleDateFormat</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#dateFormatter">dateFormatter</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="DateUtil.html#DateUtil()">DateUtil</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#convertDateToLongString(java.util.Date)">convertDateToLongString</A></B>(java.util.Date&nbsp;date)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a Date object to a corresponding String in
the long date pattern style "Saturday, 25 March 2023".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#convertDateToShortString(java.util.Date)">convertDateToShortString</A></B>(java.util.Date&nbsp;date)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a Date object to a corresponding String in
the short date pattern style "25-03-2023".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.util.Date</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#convertStringToDate(java.lang.String)">convertStringToDate</A></B>(java.lang.String&nbsp;dateString)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a string in the short date pattern style "25-03-2023"
to a corresponding Date object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#daysBetween(java.util.Date, java.util.Date)">daysBetween</A></B>(java.util.Date&nbsp;startDate,
java.util.Date&nbsp;endDate)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Calculates the number of days between two given dates, startDate and endDate.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.util.Date</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#incrementDate(java.util.Date, int)">incrementDate</A></B>(java.util.Date&nbsp;date,
int&nbsp;noOfDays)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given date, a Date object, and noOfDays, an int, the method returns
a Date object corresponding to noOfDays later than date.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#isLeapYear(int)">isLeapYear</A></B>(int&nbsp;year)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given year, an int, the method checks to see if the year
is a leap year.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#isValidDateString(java.lang.String)">isValidDateString</A></B>(java.lang.String&nbsp;dateString)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given dateString, a String, the method checks to see if string
corresponds to a valid shortDatePattern.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.util.Date</CODE></FONT></TD>
<TD><CODE><B><A HREF="DateUtil.html#nextDate(java.util.Date)">nextDate</A></B>(java.util.Date&nbsp;date)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given date, a Date object, the method returns
a Date object corresponding to the next day.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="dateFormatter"><!-- --></A><H3>
dateFormatter</H3>
<PRE>
public static java.text.SimpleDateFormat <B>dateFormatter</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="DateUtil()"><!-- --></A><H3>
DateUtil</H3>
<PRE>
public <B>DateUtil</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="convertDateToLongString(java.util.Date)"><!-- --></A><H3>
convertDateToLongString</H3>
<PRE>
public static java.lang.String <B>convertDateToLongString</B>(java.util.Date&nbsp;date)</PRE>
<DL>
<DD>Converts a Date object to a corresponding String in
the long date pattern style "Saturday, 25 March 2023".
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>date</CODE> - a Date object
<DT><B>Returns:</B><DD>a String, containing a long date pattern</DL>
</DD>
</DL>
<HR>
<A NAME="convertDateToShortString(java.util.Date)"><!-- --></A><H3>
convertDateToShortString</H3>
<PRE>
public static java.lang.String <B>convertDateToShortString</B>(java.util.Date&nbsp;date)</PRE>
<DL>
<DD>Converts a Date object to a corresponding String in
the short date pattern style "25-03-2023".
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>date</CODE> - a Date object
<DT><B>Returns:</B><DD>a String, containing a short date pattern</DL>
</DD>
</DL>
<HR>
<A NAME="convertStringToDate(java.lang.String)"><!-- --></A><H3>
convertStringToDate</H3>
<PRE>
public static java.util.Date <B>convertStringToDate</B>(java.lang.String&nbsp;dateString)</PRE>
<DL>
<DD>Converts a string in the short date pattern style "25-03-2023"
to a corresponding Date object.
Any leading or trailing spaces are first removed from the date string.
The String parameter that represent a date as a string must be in the
format dd-mm-yyy (e.g. 25-03-2023 or 25-3-2023) where dd represents
one or two digits representing the day in the month, similarly for
mm representing the month in the year and yyyy represents the four
digits for the year.
A RuntimeException is thrown if the date string is not recognised as
a valid date. Such exceptions do not need to be caught or thrown as
they are unchecked exceptions, but can be caught if necessary.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dateString</CODE> - a Date object
<DT><B>Returns:</B><DD>the Date object</DL>
</DD>
</DL>
<HR>
<A NAME="daysBetween(java.util.Date, java.util.Date)"><!-- --></A><H3>
daysBetween</H3>
<PRE>
public static int <B>daysBetween</B>(java.util.Date&nbsp;startDate,
java.util.Date&nbsp;endDate)</PRE>
<DL>
<DD>Calculates the number of days between two given dates, startDate and endDate.
If startDate is after endDate then the number of days returned will be negative.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>startDate</CODE> - a Date object<DD><CODE>endDate</CODE> - a Date object
<DT><B>Returns:</B><DD>an int, number of days between the dates</DL>
</DD>
</DL>
<HR>
<A NAME="incrementDate(java.util.Date, int)"><!-- --></A><H3>
incrementDate</H3>
<PRE>
public static java.util.Date <B>incrementDate</B>(java.util.Date&nbsp;date,
int&nbsp;noOfDays)</PRE>
<DL>
<DD>Given date, a Date object, and noOfDays, an int, the method returns
a Date object corresponding to noOfDays later than date.
If noOfDays is negative, the resulting Date object will be before date.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>date</CODE> - a Date object<DD><CODE>noOfDays</CODE> - an int
<DT><B>Returns:</B><DD>a Date</DL>
</DD>
</DL>
<HR>
<A NAME="isLeapYear(int)"><!-- --></A><H3>
isLeapYear</H3>
<PRE>
public static boolean <B>isLeapYear</B>(int&nbsp;year)</PRE>
<DL>
<DD>Given year, an int, the method checks to see if the year
is a leap year.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>year,</CODE> - an int
<DT><B>Returns:</B><DD>a boolean, true only if the year is a leap year.</DL>
</DD>
</DL>
<HR>
<A NAME="isValidDateString(java.lang.String)"><!-- --></A><H3>
isValidDateString</H3>
<PRE>
public static boolean <B>isValidDateString</B>(java.lang.String&nbsp;dateString)</PRE>
<DL>
<DD>Given dateString, a String, the method checks to see if string
corresponds to a valid shortDatePattern.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dateString,</CODE> - a String
<DT><B>Returns:</B><DD>a boolean, true only if the dateString is a valid pattern</DL>
</DD>
</DL>
<HR>
<A NAME="nextDate(java.util.Date)"><!-- --></A><H3>
nextDate</H3>
<PRE>
public static java.util.Date <B>nextDate</B>(java.util.Date&nbsp;date)</PRE>
<DL>
<DD>Given date, a Date object, the method returns
a Date object corresponding to the next day.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>noOfDays</CODE> - an int
<DT><B>Returns:</B><DD>a Date</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,220 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 21:31:47 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Diary
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Diary";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class Diary</H2>
<PRE>
java.lang.Object
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>Diary</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Diary</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
A class Diary that represents a "diary" of library item reservations.
The diary is structured as a Map of entries in which each entry corresponds
to a specific day. As the map is not accessed in a sequential fashion, it
doesn't matter whether the actual map class is a TreeMap or a HashMap.
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>D E Newton</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="Diary.html#Diary()">Diary</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor for objects of class Diary</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Diary.html#addReservation(LibraryReservation)">addReservation</A></B>(LibraryReservation&nbsp;itemReservation)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method for adding a reservation to the diary.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Diary.html#deleteReservation(LibraryReservation)">deleteReservation</A></B>(LibraryReservation&nbsp;itemReservation)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method for deleting a reservation from the diary.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;LibraryReservation[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="Diary.html#getReservations(java.util.Date)">getReservations</A></B>(java.util.Date&nbsp;date)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accessor method for returning all reservations that have entries
in the diary for a particular date.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Diary.html#printEntries(java.util.Date, java.util.Date)">printEntries</A></B>(java.util.Date&nbsp;startDate,
java.util.Date&nbsp;endDate)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method for displaying the reservations between specified dates.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Diary()"><!-- --></A><H3>
Diary</H3>
<PRE>
public <B>Diary</B>()</PRE>
<DL>
<DD>Constructor for objects of class Diary
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="addReservation(LibraryReservation)"><!-- --></A><H3>
addReservation</H3>
<PRE>
public void <B>addReservation</B>(LibraryReservation&nbsp;itemReservation)</PRE>
<DL>
<DD>Method for adding a reservation to the diary.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="deleteReservation(LibraryReservation)"><!-- --></A><H3>
deleteReservation</H3>
<PRE>
public void <B>deleteReservation</B>(LibraryReservation&nbsp;itemReservation)</PRE>
<DL>
<DD>Method for deleting a reservation from the diary.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getReservations(java.util.Date)"><!-- --></A><H3>
getReservations</H3>
<PRE>
public LibraryReservation[] <B>getReservations</B>(java.util.Date&nbsp;date)</PRE>
<DL>
<DD>Accessor method for returning all reservations that have entries
in the diary for a particular date.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>an array of reservations, or null if no entry for that date</DL>
</DD>
</DL>
<HR>
<A NAME="printEntries(java.util.Date, java.util.Date)"><!-- --></A><H3>
printEntries</H3>
<PRE>
public void <B>printEntries</B>(java.util.Date&nbsp;startDate,
java.util.Date&nbsp;endDate)</PRE>
<DL>
<DD>Method for displaying the reservations between specified dates.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,174 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 11:36:09 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Library
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Library";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class Library</H2>
<PRE>
java.lang.Object
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>Library</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Library</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="Library.html#Library()">Library</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Library.html#printAll()">printAll</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Library.html#readData()">readData</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="Library.html#writeUserData()">writeUserData</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Library()"><!-- --></A><H3>
Library</H3>
<PRE>
public <B>Library</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="printAll()"><!-- --></A><H3>
printAll</H3>
<PRE>
public void <B>printAll</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readData()"><!-- --></A><H3>
readData</H3>
<PRE>
public void <B>readData</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="writeUserData()"><!-- --></A><H3>
writeUserData</H3>
<PRE>
public void <B>writeUserData</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,421 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_392) on Fri Feb 16 14:05:03 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
LibraryItem
</TITLE>
<META NAME="date" CONTENT="2024-02-16">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="LibraryItem";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class LibraryItem</H2>
<PRE>
java.lang.Object
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>LibraryItem</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>LibraryItem</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="LibraryItem.html#LibraryItem()">LibraryItem</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getCost()">getCost</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getItemCode()">getItemCode</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getNoOfPages()">getNoOfPages</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getOnLoan()">getOnLoan</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getPublisher()">getPublisher</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getTimesBorrowed()">getTimesBorrowed</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#getTitle()">getTitle</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#printDetails()">printDetails</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#readItemData(java.util.Scanner)">readItemData</A></B>(java.util.Scanner&nbsp;detailScanner)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setCost(int)">setCost</A></B>(int&nbsp;cost)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setItemCode(java.lang.String)">setItemCode</A></B>(java.lang.String&nbsp;itemCode)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setNoOfPages(int)">setNoOfPages</A></B>(int&nbsp;noOfPages)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setOnLoan(boolean)">setOnLoan</A></B>(boolean&nbsp;onLoan)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setPublisher(java.lang.String)">setPublisher</A></B>(java.lang.String&nbsp;publisher)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setTimesBorrowed(int)">setTimesBorrowed</A></B>(int&nbsp;timesBorrowed)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="LibraryItem.html#setTitle(java.lang.String)">setTitle</A></B>(java.lang.String&nbsp;title)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="LibraryItem()"><!-- --></A><H3>
LibraryItem</H3>
<PRE>
public <B>LibraryItem</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getCost()"><!-- --></A><H3>
getCost</H3>
<PRE>
public int <B>getCost</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getItemCode()"><!-- --></A><H3>
getItemCode</H3>
<PRE>
public java.lang.String <B>getItemCode</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getNoOfPages()"><!-- --></A><H3>
getNoOfPages</H3>
<PRE>
public int <B>getNoOfPages</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getOnLoan()"><!-- --></A><H3>
getOnLoan</H3>
<PRE>
public boolean <B>getOnLoan</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getPublisher()"><!-- --></A><H3>
getPublisher</H3>
<PRE>
public java.lang.String <B>getPublisher</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getTimesBorrowed()"><!-- --></A><H3>
getTimesBorrowed</H3>
<PRE>
public int <B>getTimesBorrowed</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getTitle()"><!-- --></A><H3>
getTitle</H3>
<PRE>
public java.lang.String <B>getTitle</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="printDetails()"><!-- --></A><H3>
printDetails</H3>
<PRE>
public void <B>printDetails</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="readItemData(java.util.Scanner)"><!-- --></A><H3>
readItemData</H3>
<PRE>
public void <B>readItemData</B>(java.util.Scanner&nbsp;detailScanner)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setCost(int)"><!-- --></A><H3>
setCost</H3>
<PRE>
public void <B>setCost</B>(int&nbsp;cost)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setItemCode(java.lang.String)"><!-- --></A><H3>
setItemCode</H3>
<PRE>
public void <B>setItemCode</B>(java.lang.String&nbsp;itemCode)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setNoOfPages(int)"><!-- --></A><H3>
setNoOfPages</H3>
<PRE>
public void <B>setNoOfPages</B>(int&nbsp;noOfPages)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setOnLoan(boolean)"><!-- --></A><H3>
setOnLoan</H3>
<PRE>
public void <B>setOnLoan</B>(boolean&nbsp;onLoan)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setPublisher(java.lang.String)"><!-- --></A><H3>
setPublisher</H3>
<PRE>
public void <B>setPublisher</B>(java.lang.String&nbsp;publisher)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setTimesBorrowed(int)"><!-- --></A><H3>
setTimesBorrowed</H3>
<PRE>
public void <B>setTimesBorrowed</B>(int&nbsp;timesBorrowed)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setTitle(java.lang.String)"><!-- --></A><H3>
setTitle</H3>
<PRE>
public void <B>setTitle</B>(java.lang.String&nbsp;title)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,32 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 22:06:18 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
All Classes
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameHeadingFont">
<B>All Classes</B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="DateUtil.html" title="class in &lt;Unnamed&gt;" target="classFrame">DateUtil</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>

View File

@@ -0,0 +1,32 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 22:06:18 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
All Classes
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameHeadingFont">
<B>All Classes</B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="DateUtil.html" title="class in &lt;Unnamed&gt;">DateUtil</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>

View File

@@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 22:06:18 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Constant Field Values
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Constant Field Values";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<CENTER>
<H1>
Constant Field Values</H1>
</CENTER>
<HR SIZE="4" NOSHADE>
<B>Contents</B><UL>
</UL>
<HR>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Mar 21 22:06:18 GMT 2024-->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Generated Documentation (Untitled)
</TITLE>
<SCRIPT type="text/javascript">
targetPage = "" + window.location.search;
if (targetPage != "" && targetPage != "undefined")
targetPage = targetPage.substring(1);
if (targetPage.indexOf(":") != -1)
targetPage = "undefined";
function loadFrames() {
if (targetPage != "" && targetPage != "undefined")
top.classFrame.location = top.targetPage;
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames()">
<FRAME src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)">
<FRAME src="DateUtil.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes">
<NOFRAMES>
<H2>
Frame Alert</H2>
<P>
This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
<BR>
Link to<A HREF="DateUtil.html">Non-frame version.</A>
</NOFRAMES>
</FRAMESET>
</HTML>

View File

@@ -0,0 +1,45 @@
Class documentation
<---- javadoc command: ---->
/usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc
-author
-version
-nodeprecated
-package
-noindex
-notree
-nohelp
-nonavbar
-source
1.8
-classpath
/usr/share/bluej/bluejcore.jar:/usr/share/bluej/junit-4.8.2.jar:/usr/share/bluej/userlib/pi4j-gpio-extension.jar:/usr/share/bluej/userlib/pi4j-device.jar:/usr/share/bluej/userlib/pi4j-core.jar:/usr/share/bluej/userlib/pi4j-service.jar:/home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2
-d
/home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc
-encoding
UTF-8
-charset
UTF-8
-docletpath
/usr/share/bluej/bjdoclet.jar
-doclet
bluej.doclet.doclets.formats.html.HtmlDoclet
/home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/DateUtil.java
<---- end of javadoc command ---->
Loading source file /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/DateUtil.java...
Constructing Javadoc information...
Standard Doclet version 1.8.0_402
Building tree for all the packages and classes...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/DateUtil.html...
/home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/DateUtil.java:224: warning - @param argument "year," is not a parameter name.
/home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/DateUtil.java:238: warning - @param argument "dateString," is not a parameter name.
/home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/DateUtil.java:259: warning - @param argument "noOfDays" is not a parameter name.
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/package-frame.html...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/package-summary.html...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/constant-values.html...
Building index for all the packages and classes...
Building index for all classes...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/allclasses-frame.html...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/allclasses-noframe.html...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/index.html...
Generating /home/boris/OneDrive/Computer Science Year 1/Semester 2/Programming 2/Project/Part 2/doc/stylesheet.css...
3 warnings

View File

@@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 22:06:18 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
&lt;Unnamed&gt;
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameTitleFont">
<A HREF="package-summary.html" target="classFrame">&lt;Unnamed&gt;</A></FONT>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Classes</FONT>&nbsp;
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="DateUtil.html" title="class in &lt;Unnamed&gt;" target="classFrame">DateUtil</A></FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>

View File

@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_402) on Thu Mar 21 22:06:18 GMT 2024 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
</TITLE>
<META NAME="date" CONTENT="2024-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<HR>
<HR>
<H2>
Package &lt;Unnamed&gt;
</H2>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DateUtil.html" title="class in &lt;Unnamed&gt;">DateUtil</A></B></TD>
<TD>A class DateUtil with the following methods for dealing with dates.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<DL>
</DL>
<HR>
<HR>
</BODY>
</HTML>

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 B

View File

@@ -0,0 +1,29 @@
/* Javadoc style sheet */
/* Define colors, fonts and other style attributes here to override the defaults */
/* Page background color */
body { background-color: #FFFFFF; color:#000000 }
/* Headings */
h1 { font-size: 145% }
/* Table colors */
.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */
.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */
.TableRowColor { background: #FFFFFF; color:#000000 } /* White */
/* Font used in left-hand frame lists */
.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
/* Navigation bar fonts and colors */
.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */
.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */
.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;}
.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;}
.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}

View File

@@ -0,0 +1 @@
[Library User data]

View File

@@ -0,0 +1,187 @@
#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=881
package.editor.y=86
package.numDependencies=8
package.numTargets=12
package.showExtends=true
package.showUses=true
project.charset=UTF-8
target1.editor.height=786
target1.editor.width=960
target1.editor.x=34
target1.editor.y=174
target1.height=50
target1.name=CD
target1.naviview.expanded=true
target1.showInterface=false
target1.type=ClassTarget
target1.typeParameters=
target1.width=80
target1.x=360
target1.y=340
target10.editor.height=1049
target10.editor.width=1920
target10.editor.x=0
target10.editor.y=31
target10.height=50
target10.name=Book
target10.naviview.expanded=true
target10.showInterface=false
target10.type=ClassTarget
target10.typeParameters=
target10.width=80
target10.x=180
target10.y=340
target11.editor.height=1049
target11.editor.width=1920
target11.editor.x=0
target11.editor.y=31
target11.height=50
target11.name=Library
target11.naviview.expanded=true
target11.showInterface=false
target11.type=ClassTarget
target11.typeParameters=
target11.width=100
target11.x=260
target11.y=240
target12.editor.height=700
target12.editor.width=900
target12.editor.x=960
target12.editor.y=146
target12.height=50
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=700
target2.editor.width=900
target2.editor.x=557
target2.editor.y=177
target2.height=60
target2.name=LibraryItem
target2.naviview.expanded=true
target2.showInterface=false
target2.type=AbstractTarget
target2.typeParameters=
target2.width=120
target2.x=250
target2.y=110
target3.editor.height=700
target3.editor.width=1619
target3.editor.x=192
target3.editor.y=267
target3.height=50
target3.name=Periodical
target3.naviview.expanded=true
target3.showInterface=false
target3.type=ClassTarget
target3.typeParameters=
target3.width=90
target3.x=60
target3.y=380
target4.editor.height=700
target4.editor.width=900
target4.editor.x=40
target4.editor.y=51
target4.height=50
target4.name=DateUtil
target4.naviview.expanded=true
target4.showInterface=false
target4.type=ClassTarget
target4.typeParameters=
target4.width=80
target4.x=70
target4.y=10
target5.height=50
target5.name=Diary
target5.showInterface=false
target5.type=ClassTarget
target5.typeParameters=
target5.width=80
target5.x=580
target5.y=190
target6.editor.height=700
target6.editor.width=900
target6.editor.x=40
target6.editor.y=51
target6.height=50
target6.name=LibraryReservation
target6.naviview.expanded=true
target6.showInterface=false
target6.type=ClassTarget
target6.typeParameters=
target6.width=160
target6.x=230
target6.y=440
target7.editor.height=700
target7.editor.width=900
target7.editor.x=1017
target7.editor.y=76
target7.height=50
target7.name=PrintedItem
target7.naviview.expanded=true
target7.showInterface=false
target7.type=AbstractTarget
target7.typeParameters=
target7.width=110
target7.x=130
target7.y=240
target8.editor.height=1049
target8.editor.width=1920
target8.editor.x=0
target8.editor.y=31
target8.height=50
target8.name=DVD
target8.naviview.expanded=true
target8.showInterface=false
target8.type=ClassTarget
target8.typeParameters=
target8.width=80
target8.x=470
target8.y=380
target9.editor.height=700
target9.editor.width=900
target9.editor.x=55
target9.editor.y=274
target9.height=50
target9.name=LibraryUser
target9.naviview.expanded=true
target9.showInterface=false
target9.type=ClassTarget
target9.typeParameters=
target9.width=110
target9.x=100
target9.y=170

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Submodule Unsorted/VisualStudio/repos/VS_HCI added at ca7c68898e

Submodule Unsorted/VisualStudio/repos/Week 1 added at 0353013680

Submodule Unsorted/VisualStudio/repos/test added at 085c9a4e57