1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package pl.edu.agh.cast.model.visual;
19
20 import java.util.ArrayList;
21 import java.util.List;
22
23 import pl.edu.agh.cast.data.model.IDataSet;
24 import pl.edu.agh.cast.data.model.IElement;
25 import pl.edu.agh.cast.data.model.presentation.IPresentationDataSet;
26 import pl.edu.agh.cast.data.model.presentation.IPresentationElement;
27 import pl.edu.agh.cast.data.model.visual.IVisualDataSet;
28 import pl.edu.agh.cast.data.model.visual.IVisualElement;
29
30
31
32
33
34
35
36
37
38
39
40 public abstract class Diagram<M extends IPresentationDataSet<? extends IPresentationElement<? extends IElement>>, V extends IVisualDataSet<? extends IVisualElement<? extends IPresentationElement<? extends IElement>>, M>>
41 implements IDiagram<M, V> {
42
43
44
45
46 protected M model;
47
48 private List<IDataSet<? extends IElement>> dataSets;
49
50 private Legend legend;
51
52
53
54
55
56
57
58 public Diagram(M model) {
59 this.model = model;
60 dataSets = new ArrayList<IDataSet<? extends IElement>>(2);
61 dataSets.add(0, model);
62 dataSets.add(1, model.getVisualDataSet());
63 legend = new Legend();
64 }
65
66
67
68
69
70
71
72 @Override
73 public M getModel() {
74 return model;
75 }
76
77
78
79
80
81
82
83 public List<IDataSet<? extends IElement>> getDataSets() {
84 return dataSets;
85 }
86
87
88
89
90
91
92
93 public String getName() {
94 return getModel().getName();
95 }
96
97
98
99
100
101
102 @Override
103 public Legend getLegend() {
104 return legend;
105 }
106
107 }