-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSlide.java
More file actions
43 lines (35 loc) · 1.07 KB
/
Slide.java
File metadata and controls
43 lines (35 loc) · 1.07 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
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class Slide {
ArrayList<Image> images=new ArrayList<>();
Set<String> sumOfTags = new HashSet<>();
public Slide(ArrayList<Image> images, Set<String> sumOfTags) {
this.images = images;
this.sumOfTags = sumOfTags;
}
public Slide(Image img1, Image img2){
assert(img1.isVertical&&img2.isVertical);
assert(!img1.isUsed&&!img2.isUsed);
this.images.add(img1);
this.images.add(img2);
sumOfTags = tagsSumator(img1, img2);
}
public Slide(Image img1){
assert(!img1.isVertical);
assert(!img1.isUsed);
this.images.add(img1);
sumOfTags = img1.tags;
}
public Set<String> tagsSumator(Image img1, Image img2){
HashSet<String> newSum = new HashSet<>();
newSum.addAll(img1.tags);
newSum.addAll(img2.tags);
return newSum;
}
public void setUsed() {
for (int i = 0; i < images.size(); i++) {
images.get(i).isUsed=true;
}
}
}