-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost.java
More file actions
73 lines (62 loc) · 1.76 KB
/
Copy pathPost.java
File metadata and controls
73 lines (62 loc) · 1.76 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
import java.awt.Image;
import java.time.LocalDateTime;
import java.util.ArrayList;
public class Post {
private User contractor;
private String title;
private String description;
private double startingBid;
private Image[] images;
private Tag[] tags;
private LocalDateTime time;
private ArrayList<Offer> offers;
public Post(User c, String t, String d, double sB, Image[] i, Tag[] tags, LocalDateTime time, ArrayList<Offer> offers) {
this.contractor = c;
setTitle(t);
setDescription(d);
setStartingBid(sB);
setImages(i);
this.tags = tags;
this.time = time;
this.offers = offers == null ? new ArrayList<Offer>() : offers;
this.contractor.addPost(this);
}
public String getTitle() {
return this.title;
}
public void setTitle(String t) {
this.title = "";
if (t != null && t.length() <= 100)
this.title = t;
}
public String getDescription() {
return this.description;
}
public void setDescription(String d) {
this.description = "";
if (d != null && d.length() > 50 && d.length() < 2000)
this.description = d;
}
public double getStartingBid() {
return this.startingBid;
}
public void setStartingBid(double sB) {
if (sB < 0)
sB = -1 * sB;
sB *= 100;
int temp = (int)(sB + 0.5);
this.startingBid = ((double)temp) / 100;
}
public Image[] getImages() {
return this.images;
}
public Image getImage(int index) {
return this.images[index];
}
public void setImages(Image[] i) {
this.images = i;
}
public void addOffer(Offer o) {
this.offers.add(o);
}
}