-
Notifications
You must be signed in to change notification settings - Fork 1
/
ProblemData.java
42 lines (35 loc) · 971 Bytes
/
ProblemData.java
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
import java.util.*;
/**
* ProblemData
*
* @author Luca Crema, Marco Cognolato, Riccardo De Zen.
*/
public class ProblemData {
private List<Library> libraries;
private int days;
private int totalBookValue = 0;
private int bookCount;
public ProblemData(List<Library> libraries, int days) {
Set<Book> allBooks = new HashSet<>();
for (Library eachLibrary : libraries)
for (Book eachBook : eachLibrary.getBooks())
allBooks.add(eachBook);
for (Book eachBook : allBooks)
totalBookValue += eachBook.getValue();
bookCount = allBooks.size();
this.libraries = libraries;
this.days = days;
}
public List<Library> getLibraries() {
return libraries;
}
public int getDays() {
return days;
}
public int getTotalBookValue() {
return totalBookValue;
}
public int getBookCount() {
return bookCount;
}
}