This repository was archived by the owner on May 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.java
More file actions
143 lines (127 loc) · 3.23 KB
/
Book.java
File metadata and controls
143 lines (127 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import java.util.ArrayList;
import java.util.List;
import javafx.scene.image.Image;
public class Book extends Resource {
/**
* The attributes/variables/fields of a book which is inherited from resource
*/
public static int uniqueCopyID = 0;
public List<Copy> copies = new ArrayList<Copy>();
protected String resourceID;
protected String title;
protected int year;
protected Image image;
/**
* the attributes of a book
*/
private String author;
private String publisher;
private String genre;
private String language;
private String isbn;
/**
* Constructor of a book
* @param resourceID resourceID of a book
* @param title title of a book
* @param year year of a book
* @param image image of a book
* @param author author of a book
* @param publisher publisher of a book
* @param genre genre of a book
* @param language language of a book
*/
public Book (int resourceID, int numberOfCopies, String title, int year, String image, String author, String publisher, String genre, String language, String isbn) {
super(resourceID, numberOfCopies, title, year, image);
super.setResourceID(resourceID);
super.setNumCopies(numberOfCopies);
super.setTitle(title);
super.setYear(year);
super.setImage(image);
setAuthor(author);
setPublisher(publisher);
setGenre(genre);
setLanguage(language);
setIsbn(isbn);
}
/**
* Getting the author of a book
* @return the author of a book
*/
public String getAuthor() {
return author;
}
/**
* Getting the publisher of a book
* @return the publisher of a book
*/
public String getPublisher() {
return publisher;
}
/**
* Getting the genre of a book
* @return the genre of a book
*/
public String getGenre() {
return genre;
}
/**
* Getting the language of a book
* @return the language of a book
*/
public String getLanguage() {
return language;
}
/**
* Setting the author of a book
* @param author the author of a book
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* Setting the publisher of a book
* @param publisher the publisher of a book
*/
public void setPublisher(String publisher) {
this.publisher = publisher;
}
/**
* Setting the genre of a book
* @param genre the genre of a book
*/
public void setGenre(String genre) {
this.genre = genre;
}
/**
* Setting the language of a book
* @param language the language of a book
*/
public void setLanguage(String language) {
this.language = language;
}
/**
* @return the isbn
*/
public String getIsbn() {
return isbn;
}
/**
* @param isbn the isbn to set
*/
public void setIsbn(String isbn) {
this.isbn = isbn;
}
// we override because it passes this object, rather than going through a mess
// of finding what object this is
@Override
public Book getObject() {
return this;
}
@Override
public String translateToText() {
return "Book, " + this.getNumCopies() + ", " + this.getResourceID() + ", " +
this.getTitle() + ", " + this.getYear() + ", " + this.getImage() + ", " +
this.getAuthor() + ", " + this.getPublisher() + ", " + this.getGenre() + ", " +
this.getLanguage() + ", " + this.getIsbn();
}
}