-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.java
More file actions
141 lines (110 loc) · 3.97 KB
/
Copy pathAccount.java
File metadata and controls
141 lines (110 loc) · 3.97 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
package org.example.entities;
import java.util.ArrayList;
import java.util.SortedSet;
//Class used to handle the game accounts
public class Account {
ArrayList<org.example.entities.characters.Character> characters ;
int numberofgames;
Information information;
public Account(ArrayList<org.example.entities.characters.Character> characters, int gamesNumber, Information information) {
this.characters = characters;
this.numberofgames = gamesNumber;
this.information = information;
}
public int getNumberofgames() {
return this.numberofgames;
}
public ArrayList<org.example.entities.characters.Character> getCharacters() {
return this.characters;
}
public Information getInformation() {
return this.information;
}
public void setNumberofgames(int numberofgames) {
this.numberofgames = numberofgames;
}
public void setCharacters(ArrayList<org.example.entities.characters.Character> characters) {
this.characters = characters;
}
public void setInformation(Information information) {
this.information = information;
}
public void addCharacter(org.example.entities.characters.Character character) {
this.characters.add(character);
}
public void removeCharacter(org.example.entities.characters.Character character) {
this.characters.remove(character);
}
//Internal class that handles the information related to each account
public static class Information {
private Credentials creds;
private SortedSet<String> favGames;
private String name;
private String country;
private Information(InformationBuilder builder) {
this.creds = builder.creds;
this.favGames = builder.favGames;
this.name = builder.name;
this.country = builder.country;
}
public Credentials getCreds() {
return creds;
}
public String getName() {
return name;
}
public String getCountry() {
return country;
}
public void setCreds(Credentials creds) {
this.creds = creds;
}
public void setName(String name) {
this.name = name;
}
public void setCountry(String country) {
this.country = country;
}
public SortedSet<String> getFavGames() {
return favGames;
}
public void setFavGames(SortedSet<String> favGames) {
this.favGames = favGames;
}
public void addFavGame(String game) {
this.favGames.add(game);
}
public void removeFavGame(String game) {
this.favGames.remove(game);
}
@Override
public String toString() {
return "Account Info : {name - " + this.name + "} ; {country -" + this.country + "} ; {" + this.favGames + "} ." ;
}
public static class InformationBuilder {
private Credentials creds;
private SortedSet<String> favGames;
private String name;
private String country;
public InformationBuilder creds(Credentials creds) {
this.creds = creds;
return this;
}
public InformationBuilder favGames(SortedSet<String> favGames) {
this.favGames = favGames;
return this;
}
public InformationBuilder name(String name) {
this.name = name;
return this;
}
public InformationBuilder country(String country) {
this.country = country;
return this;
}
public Information build() {
return new Information(this);
}
}
}
}