1
2
3
4
5
6 package org.codehaus.modello.test.features;
7
8
9
10
11
12 import java.util.Collection;
13 import org.codehaus.modello.test.features.other.PackageNameFeature;
14 import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
15
16
17
18
19
20
21
22
23
24
25 @SuppressWarnings( "all" )
26 public class AssociationFeatures
27 implements java.io.Serializable
28 {
29
30
31
32
33
34
35
36
37 private java.util.List<Reference> listReferences;
38
39
40
41
42 private java.util.Set<Reference> setReferences;
43
44
45
46
47 private java.util.List<String> listStrings;
48
49
50
51
52 private java.util.Set<String> setStrings;
53
54
55
56
57 private java.util.Properties properties;
58
59
60
61
62 private Bidirectional bidi;
63
64
65
66
67 private java.util.List<BidiInList> listOfBidis;
68
69
70
71
72 private java.util.Set<BidiInSet> setOfBidis;
73
74
75
76
77
78
79
80
81
82
83
84 public void addListOfBidi( BidiInList bidiInList )
85 {
86 getListOfBidis().add( bidiInList );
87 bidiInList.createAssociationFeaturesAssociation( this );
88 }
89
90
91
92
93
94
95 public void addListReference( Reference reference )
96 {
97 getListReferences().add( reference );
98 }
99
100
101
102
103
104
105 public void addListString( String string )
106 {
107 getListStrings().add( string );
108 }
109
110
111
112
113
114
115
116 public void addProperty( String key, String value )
117 {
118 getProperties().put( key, value );
119 }
120
121
122
123
124
125
126 public void addSetOfBidi( BidiInSet bidiInSet )
127 {
128 getSetOfBidis().add( bidiInSet );
129 bidiInSet.createAssociationFeaturesAssociation( this );
130 }
131
132
133
134
135
136
137 public void addSetReference( Reference reference )
138 {
139 getSetReferences().add( reference );
140 }
141
142
143
144
145
146
147 public void addSetString( String string )
148 {
149 getSetStrings().add( string );
150 }
151
152
153
154
155
156
157 public void breakBidiInListAssociation( BidiInList bidiInList )
158 {
159 if ( !getListOfBidis().contains( bidiInList ) )
160 {
161 throw new IllegalStateException( "bidiInList isn't associated." );
162 }
163
164 getListOfBidis().remove( bidiInList );
165 }
166
167
168
169
170
171
172 public void breakBidiInSetAssociation( BidiInSet bidiInSet )
173 {
174 if ( !getSetOfBidis().contains( bidiInSet ) )
175 {
176 throw new IllegalStateException( "bidiInSet isn't associated." );
177 }
178
179 getSetOfBidis().remove( bidiInSet );
180 }
181
182
183
184
185
186
187 public void breakBidirectionalAssociation( Bidirectional bidirectional )
188 {
189 if ( this.bidi != bidirectional )
190 {
191 throw new IllegalStateException( "bidirectional isn't associated." );
192 }
193
194 this.bidi = null;
195 }
196
197
198
199
200
201
202 public void createBidiInListAssociation( BidiInList bidiInList )
203 {
204 Collection listOfBidis = getListOfBidis();
205
206 if ( listOfBidis.contains( bidiInList ) )
207 {
208 throw new IllegalStateException( "bidiInList is already assigned." );
209 }
210
211 listOfBidis.add( bidiInList );
212 }
213
214
215
216
217
218
219 public void createBidiInSetAssociation( BidiInSet bidiInSet )
220 {
221 Collection setOfBidis = getSetOfBidis();
222
223 if ( setOfBidis.contains( bidiInSet ) )
224 {
225 throw new IllegalStateException( "bidiInSet is already assigned." );
226 }
227
228 setOfBidis.add( bidiInSet );
229 }
230
231
232
233
234
235
236 public void createBidirectionalAssociation( Bidirectional bidirectional )
237 {
238 if ( this.bidi != null )
239 {
240 breakBidirectionalAssociation( this.bidi );
241 }
242
243 this.bidi = bidirectional;
244 }
245
246
247
248
249
250
251 public Bidirectional getBidi()
252 {
253 return this.bidi;
254 }
255
256
257
258
259
260
261 public java.util.List<BidiInList> getListOfBidis()
262 {
263 if ( this.listOfBidis == null )
264 {
265 this.listOfBidis = new java.util.ArrayList<BidiInList>();
266 }
267
268 return this.listOfBidis;
269 }
270
271
272
273
274
275
276 public java.util.List<Reference> getListReferences()
277 {
278 if ( this.listReferences == null )
279 {
280 this.listReferences = new java.util.ArrayList<Reference>();
281 }
282
283 return this.listReferences;
284 }
285
286
287
288
289
290
291 public java.util.List<String> getListStrings()
292 {
293 if ( this.listStrings == null )
294 {
295 this.listStrings = new java.util.ArrayList<String>();
296 }
297
298 return this.listStrings;
299 }
300
301
302
303
304
305
306 public java.util.Properties getProperties()
307 {
308 if ( this.properties == null )
309 {
310 this.properties = new org.codehaus.modello.OrderedProperties();
311 }
312
313 return this.properties;
314 }
315
316
317
318
319
320
321 public java.util.Set<BidiInSet> getSetOfBidis()
322 {
323 if ( this.setOfBidis == null )
324 {
325 this.setOfBidis = new java.util.HashSet<BidiInSet>();
326 }
327
328 return this.setOfBidis;
329 }
330
331
332
333
334
335
336 public java.util.Set<Reference> getSetReferences()
337 {
338 if ( this.setReferences == null )
339 {
340 this.setReferences = new java.util.HashSet<Reference>();
341 }
342
343 return this.setReferences;
344 }
345
346
347
348
349
350
351 public java.util.Set<String> getSetStrings()
352 {
353 if ( this.setStrings == null )
354 {
355 this.setStrings = new java.util.HashSet<String>();
356 }
357
358 return this.setStrings;
359 }
360
361
362
363
364
365
366 public void removeListOfBidi( BidiInList bidiInList )
367 {
368 bidiInList.breakAssociationFeaturesAssociation( this );
369 getListOfBidis().remove( bidiInList );
370 }
371
372
373
374
375
376
377 public void removeListReference( Reference reference )
378 {
379 getListReferences().remove( reference );
380 }
381
382
383
384
385
386
387 public void removeListString( String string )
388 {
389 getListStrings().remove( string );
390 }
391
392
393
394
395
396
397 public void removeSetOfBidi( BidiInSet bidiInSet )
398 {
399 bidiInSet.breakAssociationFeaturesAssociation( this );
400 getSetOfBidis().remove( bidiInSet );
401 }
402
403
404
405
406
407
408 public void removeSetReference( Reference reference )
409 {
410 getSetReferences().remove( reference );
411 }
412
413
414
415
416
417
418 public void removeSetString( String string )
419 {
420 getSetStrings().remove( string );
421 }
422
423
424
425
426
427
428 public void setBidi( Bidirectional bidi )
429 {
430 if ( this.bidi != null )
431 {
432 this.bidi.breakAssociationFeaturesAssociation( this );
433 }
434
435 this.bidi = bidi;
436
437 if ( bidi != null )
438 {
439 this.bidi.createAssociationFeaturesAssociation( this );
440 }
441 }
442
443
444
445
446
447
448 public void setListOfBidis( java.util.List<BidiInList> listOfBidis )
449 {
450 this.listOfBidis = listOfBidis;
451 }
452
453
454
455
456
457
458 public void setListReferences( java.util.List<Reference> listReferences )
459 {
460 this.listReferences = listReferences;
461 }
462
463
464
465
466
467
468 public void setListStrings( java.util.List<String> listStrings )
469 {
470 this.listStrings = listStrings;
471 }
472
473
474
475
476
477
478 public void setProperties( java.util.Properties properties )
479 {
480 this.properties = properties;
481 }
482
483
484
485
486
487
488 public void setSetOfBidis( java.util.Set<BidiInSet> setOfBidis )
489 {
490 this.setOfBidis = setOfBidis;
491 }
492
493
494
495
496
497
498 public void setSetReferences( java.util.Set<Reference> setReferences )
499 {
500 this.setReferences = setReferences;
501 }
502
503
504
505
506
507
508 public void setSetStrings( java.util.Set<String> setStrings )
509 {
510 this.setStrings = setStrings;
511 }
512
513 }