-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSysMLViews.java
More file actions
310 lines (291 loc) · 9.63 KB
/
Copy pathSysMLViews.java
File metadata and controls
310 lines (291 loc) · 9.63 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
package sysmlinjava.views;
import sysmlinjava.common.SysMLClass;
/**
* {@code SysMLViews} is SysMLinJava's abstract representation of a collection
* of SysML's {@code View} elements. Whereas views in SysML are instances of the
* SysML View, this {@code SysMLViews} class provides a base for a container of
* View instances. Although typically not needed, the views in the container can
* be referenced in blocks and other model elements of the SysMLinJava model by
* simply referencing the class scope with the view name, e.g.
* {@code aView = MyViews.ArchitectsView}.
* <p>
* Individual instances of {@code SysMLView} are self described by their
* individual field values, i.e. name, viewpoint, and included views.
* <p>
* Each {@code SysMLView} instance in the extended {@code SysMLViews} class is a
* {@code public static final} instance, i.e. the views declared in extensions
* to this class must be used as is.
* <p>
* An example of how specializations of the {@code SysMLViews} should be
* declared is as follows.
*
* <pre>
public class MyViews extends SysMLViews
{
@Purpose public String purposeA;
@Purpose public String purposeB;
@Purpose public String purposeC;
@Concern public String concernA;
@Concern public String concernB;
@Concern public String concernC;
@Language public String languageA;
@Language public String languageB;
@Language public String languageC;
@Method public String methodA;
@Method public String methodB;
@Method public String methodC;
@Presentation public String presentationA;
@Presentation public String presentationB;
@Presentation public String presentationC;
@Stakeholder public SysMLStakeholder stakeholderA;
@Stakeholder public SysMLStakeholder stakeholderB;
@Stakeholder public SysMLStakeholder stakeholderC;
@Viewpoint public SysMLViewpoint viewpointA;
@Viewpoint public SysMLViewpoint viewpointB;
@Viewpoint public SysMLViewpoint viewpointC;
@View public SysMLView viewA;
@View public SysMLView viewB;
@View public SysMLView viewC;
}
* </pre>
* <p>
* As the example shows, the elements of the stakeholder and viewpoints are
* declared as annotated fields of {@code String} types. Their values are
* initialized in the applicable {@code create...()} operations. The
* stakeholders and viewpoints themselves are declared as shown and initialized
* with the appropriate elements in the {@code createStakeholders()} and
* {@code createViewpoints()}, respectively.
* <p>
* Finally, the views are declared as shown and initialized in the
* {@code createViews()} method. Initialization includes specification of the
* viewpoints and included views that constitute the view.
* <p>
* It should be noted that while there are variations in the way the view
* elements could be declared/coded that are different from the example,
* SysMLinJava and SysMLinJava tools currently only supports this form.
* Deviations from this format are likely to result in failures by these tools
* to perform as desired.
*
* @author ModelerOne
*
*/
public abstract class SysMLViews extends SysMLClass
{
/**
* Constructor for unique name and ID
* @param name unique name
* @param id unique ID
*/
public SysMLViews(String name, Long id)
{
super(name, id);
createPurposes();
createConcerns();
createLanguages();
createMethods();
createPresentations();
createStakeholders();
createViewpoints();
createViews();
}
/**
* Creates the purposes. An example of purpose declarations and initializations is as follows:
* <pre>
* {@code
@Purpose
public String purposeA;
@Purpose
public String purposeB;
@Purpose
public String purposeC;
protected void createPurposes()
{
purposeA = "This is purpose A";
purposeB = "This is purpose B";
purposeC = "This is purpose C";
}
* }
* </pre>
*/
protected abstract void createPurposes();
/**
* Creates the concerns. An example of concern declarations and initializations is as follows:
* <pre>
* {@code
@Concern
public String concernA;
@Concern
public String concernB;
@Concern
public String concernC;
protected void createConcerns()
{
concernA = "This is concern A";
concernB = "This is concern B";
concernC = "This is concern C";
}
* }
* </pre>
*/
protected abstract void createConcerns();
/**
* Creates the languages. An example of language declarations and initializations is as follows:
* <pre>
* {@code
@Language
public String languageA;
@Language
public String languageB;
@Language
public String languageC;
protected void createLanguages()
{
languageA = "This is language A";
languageB = "This is language B";
languageC = "This is language C";
}
* }
* </pre>
*/
protected abstract void createLanguages();
/**
* Creates the methods. An example of method declarations and initializations is as follows:
* <pre>
* {@code
@Concern
public String methodA;
@Concern
public String methodB;
@Concern
public String methodC;
protected void createMethods()
{
methodA = "This is method A";
methodB = "This is method B";
methodC = "This is method C";
}
* }
* </pre>
*/
protected abstract void createMethods();
/**
* Creates the presentations. An example of presentation declarations and initializations is as follows:
* <pre>
* {@code
@Presentation
public String presentationA;
@Presentation
public String presentationB;
@Presentation
public String presentationC;
protected void createPresentations()
{
presentationA = "This is presentation A";
presentationB = "This is presentation B";
presentationC = "This is presentation C";
}
* }
* </pre>
*/
protected abstract void createPresentations();
/**
* Creates the stakeholders. An example of stakeholder declarations and initializations is as follows:
* <pre>
* {@code
@Stakeholder
public SysMLStakeholder stakeholderA;
@Stakeholder
public SysMLStakeholder stakeholderB;
@Stakeholder
public SysMLStakeholder stakeholderC;
protected void createStakeholders()
{
stakeholderA = new SysMLStakeholder("StakeholderA", List.of(concernA)),
stakeholderB = new SysMLStakeholder("StakeholderB", List.of(concernB, concernA)),
stakeholderC = new SysMLStakeholder("StakeholderC", List.of(concernA, concernC));
}
* }
* </pre>
*/
protected abstract void createStakeholders();
/**
* Creates the viewpoints. An example of viewpoint declarations and initializations is as follows:
* <pre>
* {@code
@Viewpoint
public SysMLViewpoint viewpointA;
@Viewpoint
public SysMLViewpoint viewpointB;
@Viewpoint
public SysMLViewpoint viewpointC;
protected void createViewpoints()
{
viewpointA = new SysMLViewpoint("ViewpointA", List.of(stakeholderA), purposeA, List.of(concernA), List.of(languageA), List.of(presentationA), List.of(methodA));
viewpointB = new SysMLViewpoint("ViewpointB", List.of(stakeholderB), purposeB, List.of(concernB), List.of(languageB), List.of(presentationB), List.of(methodB));
viewpointC = new SysMLViewpoint("ViewpointC", List.of(stakeholderC), purposeC, List.of(concernC), List.of(languageC), List.of(presentationC), List.of(methodC));
}
* }
* </pre>
*/
protected abstract void createViewpoints();
/**
* Creates the views. An example of view declarations and initializations is as follows:
* <pre>
* {@code
@View
public SysMLView viewA;
@View
public SysMLView viewB;
@View
public SysMLView viewC;
protected void createViews()
{
viewA = new SysMLView("ViewA", viewpointA, List.of()),
viewB = new SysMLView("ViewB", viewpointB, List.of()),
viewC = new SysMLView("ViewC", viewpointC, List.of(viewA, viewB)));
}
* }
* </pre>
*/
protected abstract void createViews();
/**
* Name of method to create purposes, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createPurposesMethodName = "createPurposes";
/**
* Name of method to create concerns, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createConcernsMethodName = "createConcerns";
/**
* Name of method to create languages, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createLanguagesMethodName = "createLanguages";
/**
* Name of method to create methods, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createMethodsMethodName = "createMethods";
/**
* Name of method to create presentations, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createPresentationsMethodName = "createPresentations";
/**
* Name of method to create stakeholders, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createStakeholdersMethodName = "createStakeholders";
/**
* Name of method to create viewpoints, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createViewpointsMethodName = "createViewpoints";
/**
* Name of method to create views, used by SysMLinJava tools, typically
* not needed for modeling
*/
public static final String createViewsMethodName = "createViews";
}