-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.java
121 lines (99 loc) · 2.54 KB
/
Account.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
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
/**
*
* Description
*
* @version 1.0 from 5/14/2020
* @author
*/
public class Account {
// start attributes
private String Name;
private String Passwort;
private List<Artikel> Basket;
private String Email;
private List<Artikel> Wishlist;
private List<String> Notifications;
// end attributes
public Account(String Name, String Passwort, String Email) {
this.Name = Name;
this.Passwort = Passwort;
this.Email = Email;
this.Basket = new List<Artikel>();
this.Wishlist = new List<Artikel>();
this.Notifications = new List<String>();
}
// start methods
public String getName() {
return Name;
}
public void setName(String NameNew) {
Name = NameNew;
}
public String getPasswort() {
return Passwort;
}
public void setPasswort(String PasswortNew) {
Passwort = PasswortNew;
}
public List<Artikel> getBasket() {
return this.Basket;
}
public void setBasket(List<Artikel> BasketNew) {
Basket = BasketNew;
}
public String getEmail() {
return Email;
}
public void setEmail(String EmailNew) {
Email = EmailNew;
}
public void clearbasket() {
this.Basket = new List<Artikel>();
}
public List<Artikel> getWishlist() {
return Wishlist;
}
public void clearwishlist() {
this.Wishlist = new List<Artikel>();
}
public void addtobasket(Artikel partikel){
if (partikel!=null) {
this.Basket.append(partikel);
} // end of if
}
public void addtowishlist(Artikel partikel){
if (partikel!=null) {
this.Wishlist.append(partikel);
} // end of if
}
public void removefrombasket(int partikelnummer) {
this.Basket.toFirst();
while (this.Basket.hasAccess()) {
if (this.Basket.getContent().getArtikelnummer()==partikelnummer) {
this.Basket.remove();
} else {
this.Basket.next();
} // end of if-else
} // end of while
}
public void removefromwishlist(int partikelnummer) {
this.Wishlist.toFirst();
while (this.Wishlist.hasAccess()) {
if (this.Wishlist.getContent().getArtikelnummer()==partikelnummer) {
this.Wishlist.remove();
} else {
this.Wishlist.next();
} // end of if-else
} // end of while
}
public void deletenotifications (){
this.Notifications = new List<String>();
}
public void notify (String pstring){
if(pstring!=null)this.Notifications.append(pstring);
}
public List<String> getNotifications(){
return this.Notifications;
}
// end methods
} // end of Account