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 | |
package org.argouml.model.mdr; |
41 | |
|
42 | |
import java.util.ArrayList; |
43 | |
import java.util.Collection; |
44 | |
import java.util.Collections; |
45 | |
import java.util.HashSet; |
46 | |
import java.util.Iterator; |
47 | |
import java.util.List; |
48 | |
import java.util.Set; |
49 | |
|
50 | |
import javax.jmi.model.MofClass; |
51 | |
import javax.jmi.model.Reference; |
52 | |
import javax.jmi.reflect.InvalidObjectException; |
53 | |
import javax.jmi.reflect.RefBaseObject; |
54 | |
import javax.jmi.reflect.RefClass; |
55 | |
import javax.jmi.reflect.RefFeatured; |
56 | |
import javax.jmi.reflect.RefObject; |
57 | |
import javax.jmi.reflect.RefPackage; |
58 | |
|
59 | |
import org.apache.log4j.Logger; |
60 | |
import org.argouml.model.CoreFactory; |
61 | |
import org.argouml.model.Facade; |
62 | |
import org.argouml.model.InvalidElementException; |
63 | |
import org.argouml.model.NotImplementedException; |
64 | |
import org.omg.uml.behavioralelements.activitygraphs.ActionState; |
65 | |
import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph; |
66 | |
import org.omg.uml.behavioralelements.activitygraphs.CallState; |
67 | |
import org.omg.uml.behavioralelements.activitygraphs.ClassifierInState; |
68 | |
import org.omg.uml.behavioralelements.activitygraphs.ObjectFlowState; |
69 | |
import org.omg.uml.behavioralelements.activitygraphs.Partition; |
70 | |
import org.omg.uml.behavioralelements.activitygraphs.SubactivityState; |
71 | |
import org.omg.uml.behavioralelements.collaborations.AssociationEndRole; |
72 | |
import org.omg.uml.behavioralelements.collaborations.AssociationRole; |
73 | |
import org.omg.uml.behavioralelements.collaborations.ClassifierRole; |
74 | |
import org.omg.uml.behavioralelements.collaborations.Collaboration; |
75 | |
import org.omg.uml.behavioralelements.collaborations.CollaborationInstanceSet; |
76 | |
import org.omg.uml.behavioralelements.collaborations.Interaction; |
77 | |
import org.omg.uml.behavioralelements.collaborations.InteractionInstanceSet; |
78 | |
import org.omg.uml.behavioralelements.collaborations.Message; |
79 | |
import org.omg.uml.behavioralelements.commonbehavior.Action; |
80 | |
import org.omg.uml.behavioralelements.commonbehavior.ActionSequence; |
81 | |
import org.omg.uml.behavioralelements.commonbehavior.Argument; |
82 | |
import org.omg.uml.behavioralelements.commonbehavior.AttributeLink; |
83 | |
import org.omg.uml.behavioralelements.commonbehavior.CallAction; |
84 | |
import org.omg.uml.behavioralelements.commonbehavior.ComponentInstance; |
85 | |
import org.omg.uml.behavioralelements.commonbehavior.CreateAction; |
86 | |
import org.omg.uml.behavioralelements.commonbehavior.DataValue; |
87 | |
import org.omg.uml.behavioralelements.commonbehavior.DestroyAction; |
88 | |
import org.omg.uml.behavioralelements.commonbehavior.Instance; |
89 | |
import org.omg.uml.behavioralelements.commonbehavior.Link; |
90 | |
import org.omg.uml.behavioralelements.commonbehavior.LinkEnd; |
91 | |
import org.omg.uml.behavioralelements.commonbehavior.LinkObject; |
92 | |
import org.omg.uml.behavioralelements.commonbehavior.NodeInstance; |
93 | |
import org.omg.uml.behavioralelements.commonbehavior.Reception; |
94 | |
import org.omg.uml.behavioralelements.commonbehavior.ReturnAction; |
95 | |
import org.omg.uml.behavioralelements.commonbehavior.SendAction; |
96 | |
import org.omg.uml.behavioralelements.commonbehavior.Signal; |
97 | |
import org.omg.uml.behavioralelements.commonbehavior.Stimulus; |
98 | |
import org.omg.uml.behavioralelements.commonbehavior.SubsystemInstance; |
99 | |
import org.omg.uml.behavioralelements.commonbehavior.TerminateAction; |
100 | |
import org.omg.uml.behavioralelements.commonbehavior.UmlException; |
101 | |
import org.omg.uml.behavioralelements.commonbehavior.UninterpretedAction; |
102 | |
import org.omg.uml.behavioralelements.statemachines.CallEvent; |
103 | |
import org.omg.uml.behavioralelements.statemachines.ChangeEvent; |
104 | |
import org.omg.uml.behavioralelements.statemachines.CompositeState; |
105 | |
import org.omg.uml.behavioralelements.statemachines.Event; |
106 | |
import org.omg.uml.behavioralelements.statemachines.FinalState; |
107 | |
import org.omg.uml.behavioralelements.statemachines.Guard; |
108 | |
import org.omg.uml.behavioralelements.statemachines.Pseudostate; |
109 | |
import org.omg.uml.behavioralelements.statemachines.SignalEvent; |
110 | |
import org.omg.uml.behavioralelements.statemachines.SimpleState; |
111 | |
import org.omg.uml.behavioralelements.statemachines.State; |
112 | |
import org.omg.uml.behavioralelements.statemachines.StateMachine; |
113 | |
import org.omg.uml.behavioralelements.statemachines.StateVertex; |
114 | |
import org.omg.uml.behavioralelements.statemachines.StubState; |
115 | |
import org.omg.uml.behavioralelements.statemachines.SubmachineState; |
116 | |
import org.omg.uml.behavioralelements.statemachines.SynchState; |
117 | |
import org.omg.uml.behavioralelements.statemachines.TimeEvent; |
118 | |
import org.omg.uml.behavioralelements.statemachines.Transition; |
119 | |
import org.omg.uml.behavioralelements.usecases.Actor; |
120 | |
import org.omg.uml.behavioralelements.usecases.Extend; |
121 | |
import org.omg.uml.behavioralelements.usecases.ExtensionPoint; |
122 | |
import org.omg.uml.behavioralelements.usecases.Include; |
123 | |
import org.omg.uml.behavioralelements.usecases.UseCase; |
124 | |
import org.omg.uml.foundation.core.Abstraction; |
125 | |
import org.omg.uml.foundation.core.Artifact; |
126 | |
import org.omg.uml.foundation.core.AssociationClass; |
127 | |
import org.omg.uml.foundation.core.AssociationEnd; |
128 | |
import org.omg.uml.foundation.core.Attribute; |
129 | |
import org.omg.uml.foundation.core.BehavioralFeature; |
130 | |
import org.omg.uml.foundation.core.Binding; |
131 | |
import org.omg.uml.foundation.core.Classifier; |
132 | |
import org.omg.uml.foundation.core.Comment; |
133 | |
import org.omg.uml.foundation.core.Component; |
134 | |
import org.omg.uml.foundation.core.Constraint; |
135 | |
import org.omg.uml.foundation.core.DataType; |
136 | |
import org.omg.uml.foundation.core.Dependency; |
137 | |
import org.omg.uml.foundation.core.Element; |
138 | |
import org.omg.uml.foundation.core.ElementResidence; |
139 | |
import org.omg.uml.foundation.core.Enumeration; |
140 | |
import org.omg.uml.foundation.core.EnumerationLiteral; |
141 | |
import org.omg.uml.foundation.core.Feature; |
142 | |
import org.omg.uml.foundation.core.Flow; |
143 | |
import org.omg.uml.foundation.core.GeneralizableElement; |
144 | |
import org.omg.uml.foundation.core.Generalization; |
145 | |
import org.omg.uml.foundation.core.Interface; |
146 | |
import org.omg.uml.foundation.core.Method; |
147 | |
import org.omg.uml.foundation.core.ModelElement; |
148 | |
import org.omg.uml.foundation.core.Namespace; |
149 | |
import org.omg.uml.foundation.core.Node; |
150 | |
import org.omg.uml.foundation.core.Operation; |
151 | |
import org.omg.uml.foundation.core.Parameter; |
152 | |
import org.omg.uml.foundation.core.Permission; |
153 | |
import org.omg.uml.foundation.core.Primitive; |
154 | |
import org.omg.uml.foundation.core.Relationship; |
155 | |
import org.omg.uml.foundation.core.Stereotype; |
156 | |
import org.omg.uml.foundation.core.StructuralFeature; |
157 | |
import org.omg.uml.foundation.core.TagDefinition; |
158 | |
import org.omg.uml.foundation.core.TaggedValue; |
159 | |
import org.omg.uml.foundation.core.TemplateArgument; |
160 | |
import org.omg.uml.foundation.core.TemplateParameter; |
161 | |
import org.omg.uml.foundation.core.UmlAssociation; |
162 | |
import org.omg.uml.foundation.core.UmlClass; |
163 | |
import org.omg.uml.foundation.core.Usage; |
164 | |
import org.omg.uml.foundation.datatypes.ActionExpression; |
165 | |
import org.omg.uml.foundation.datatypes.AggregationKind; |
166 | |
import org.omg.uml.foundation.datatypes.AggregationKindEnum; |
167 | |
import org.omg.uml.foundation.datatypes.CallConcurrencyKind; |
168 | |
import org.omg.uml.foundation.datatypes.CallConcurrencyKindEnum; |
169 | |
import org.omg.uml.foundation.datatypes.ChangeableKind; |
170 | |
import org.omg.uml.foundation.datatypes.ChangeableKindEnum; |
171 | |
import org.omg.uml.foundation.datatypes.Expression; |
172 | |
import org.omg.uml.foundation.datatypes.Multiplicity; |
173 | |
import org.omg.uml.foundation.datatypes.MultiplicityRange; |
174 | |
import org.omg.uml.foundation.datatypes.OrderingKind; |
175 | |
import org.omg.uml.foundation.datatypes.OrderingKindEnum; |
176 | |
import org.omg.uml.foundation.datatypes.ParameterDirectionKind; |
177 | |
import org.omg.uml.foundation.datatypes.ParameterDirectionKindEnum; |
178 | |
import org.omg.uml.foundation.datatypes.PseudostateKind; |
179 | |
import org.omg.uml.foundation.datatypes.ScopeKind; |
180 | |
import org.omg.uml.foundation.datatypes.ScopeKindEnum; |
181 | |
import org.omg.uml.foundation.datatypes.VisibilityKind; |
182 | |
import org.omg.uml.foundation.datatypes.VisibilityKindEnum; |
183 | |
import org.omg.uml.modelmanagement.ElementImport; |
184 | |
import org.omg.uml.modelmanagement.Model; |
185 | |
import org.omg.uml.modelmanagement.Subsystem; |
186 | |
import org.omg.uml.modelmanagement.UmlPackage; |
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
class FacadeMDRImpl implements Facade { |
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | 900 | private static final Logger LOG = Logger.getLogger(FacadeMDRImpl.class); |
206 | |
|
207 | |
private MDRModelImplementation modelImpl; |
208 | |
|
209 | |
|
210 | 900 | private static final javax.jmi.model.AggregationKindEnum MOF_COMPOSITE = |
211 | |
javax.jmi.model.AggregationKindEnum.COMPOSITE; |
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | 900 | public FacadeMDRImpl(MDRModelImplementation impl) { |
220 | 900 | modelImpl = impl; |
221 | 900 | } |
222 | |
|
223 | |
public String getUmlVersion() { |
224 | 21524 | return "1.4"; |
225 | |
} |
226 | |
|
227 | |
public boolean isAAbstraction(Object handle) { |
228 | 42139 | return handle instanceof Abstraction; |
229 | |
} |
230 | |
|
231 | |
public boolean isAAcceptEventAction(Object handle) { |
232 | 0 | return false; |
233 | |
} |
234 | |
|
235 | |
public boolean isAAction(Object handle) { |
236 | 1140 | return handle instanceof Action; |
237 | |
} |
238 | |
|
239 | |
public boolean isAActionExpression(Object handle) { |
240 | 0 | return handle instanceof ActionExpression; |
241 | |
} |
242 | |
|
243 | |
public boolean isAActionSequence(Object handle) { |
244 | 0 | return handle instanceof ActionSequence; |
245 | |
} |
246 | |
|
247 | |
public boolean isAActionState(Object handle) { |
248 | 0 | return handle instanceof ActionState; |
249 | |
} |
250 | |
|
251 | |
public boolean isACallState(Object handle) { |
252 | 0 | return handle instanceof CallState; |
253 | |
} |
254 | |
|
255 | |
public boolean isAObjectFlowState(Object handle) { |
256 | 0 | return handle instanceof ObjectFlowState; |
257 | |
} |
258 | |
|
259 | |
public boolean isAObjectNode(Object handle) { |
260 | |
|
261 | 0 | return false; |
262 | |
} |
263 | |
|
264 | |
public boolean isASubactivityState(Object handle) { |
265 | 0 | return handle instanceof SubactivityState; |
266 | |
} |
267 | |
|
268 | |
public boolean isAActor(Object handle) { |
269 | 0 | return handle instanceof Actor; |
270 | |
} |
271 | |
|
272 | |
public boolean isAAggregationKind(Object handle) { |
273 | 0 | return handle instanceof AggregationKind; |
274 | |
} |
275 | |
|
276 | |
public boolean isAAppliedProfileElement(Object handle) { |
277 | |
|
278 | 69436 | return false; |
279 | |
} |
280 | |
|
281 | |
public boolean isAArgument(Object modelElement) { |
282 | 0 | return modelElement instanceof Argument; |
283 | |
} |
284 | |
|
285 | |
public boolean isAArtifact(Object modelElement) { |
286 | 0 | return modelElement instanceof Artifact; |
287 | |
} |
288 | |
|
289 | |
public boolean isAAssociation(Object handle) { |
290 | 96929 | return handle instanceof UmlAssociation; |
291 | |
} |
292 | |
|
293 | |
public boolean isAAssociationEnd(Object handle) { |
294 | 96142 | return handle instanceof AssociationEnd; |
295 | |
} |
296 | |
|
297 | |
public boolean isAAssociationRole(Object handle) { |
298 | 19 | return handle instanceof AssociationRole; |
299 | |
} |
300 | |
|
301 | |
public boolean isAAssociationEndRole(Object handle) { |
302 | 0 | return handle instanceof AssociationEndRole; |
303 | |
} |
304 | |
|
305 | |
public boolean isAAttribute(Object handle) { |
306 | 93915 | return handle instanceof Attribute; |
307 | |
} |
308 | |
|
309 | |
public boolean isAAttributeLink(Object handle) { |
310 | 0 | return handle instanceof AttributeLink; |
311 | |
} |
312 | |
|
313 | |
public boolean isAsynchronous(Object handle) { |
314 | 0 | if (handle instanceof Action) { |
315 | |
try { |
316 | 0 | return ((Action) handle).isAsynchronous(); |
317 | 0 | } catch (InvalidObjectException e) { |
318 | 0 | throw new InvalidElementException(e); |
319 | |
} |
320 | |
} |
321 | 0 | return illegalArgumentBoolean(handle); |
322 | |
} |
323 | |
|
324 | |
|
325 | |
public boolean isAbstract(Object handle) { |
326 | |
try { |
327 | 0 | if (handle instanceof Operation) { |
328 | 0 | return ((Operation) handle).isAbstract(); |
329 | |
} |
330 | 0 | if (handle instanceof GeneralizableElement) { |
331 | 0 | return ((GeneralizableElement) handle).isAbstract(); |
332 | |
} |
333 | 0 | if (handle instanceof UmlAssociation) { |
334 | 0 | return ((UmlAssociation) handle).isAbstract(); |
335 | |
} |
336 | 0 | if (handle instanceof Reception) { |
337 | 0 | return ((Reception) handle).isAbstract(); |
338 | |
} |
339 | 0 | } catch (InvalidObjectException e) { |
340 | 0 | throw new InvalidElementException(e); |
341 | 0 | } |
342 | 0 | if (isAUMLElement(handle)) { |
343 | 0 | return false; |
344 | |
} else { |
345 | 0 | return illegalArgumentBoolean(handle); |
346 | |
} |
347 | |
} |
348 | |
|
349 | |
public boolean isAActivityEdge(Object handle) { |
350 | 0 | return false; |
351 | |
} |
352 | |
|
353 | |
public boolean isAActivityGraph(Object handle) { |
354 | 38 | return handle instanceof ActivityGraph; |
355 | |
} |
356 | |
|
357 | |
public boolean isAActivityNode(Object handle) { |
358 | 0 | return false; |
359 | |
} |
360 | |
|
361 | |
public boolean isABehavioralFeature(Object handle) { |
362 | 117853 | return handle instanceof BehavioralFeature; |
363 | |
} |
364 | |
|
365 | |
public boolean isABinding(Object handle) { |
366 | 93915 | return handle instanceof Binding; |
367 | |
} |
368 | |
|
369 | |
public boolean isACallAction(Object handle) { |
370 | 0 | return handle instanceof CallAction; |
371 | |
} |
372 | |
|
373 | |
public boolean isACallEvent(Object handle) { |
374 | 0 | return handle instanceof CallEvent; |
375 | |
} |
376 | |
|
377 | |
public boolean isAChangeEvent(Object handle) { |
378 | 0 | return handle instanceof ChangeEvent; |
379 | |
} |
380 | |
|
381 | |
public boolean isAClass(Object handle) { |
382 | 96272 | return handle instanceof UmlClass; |
383 | |
} |
384 | |
|
385 | |
public boolean isAAssociationClass(Object handle) { |
386 | 0 | return handle instanceof AssociationClass; |
387 | |
} |
388 | |
|
389 | |
public boolean isAClassifier(Object handle) { |
390 | 218934 | return handle instanceof Classifier; |
391 | |
} |
392 | |
|
393 | |
public boolean isAClassifierInState(Object handle) { |
394 | 0 | return handle instanceof ClassifierInState; |
395 | |
} |
396 | |
|
397 | |
public boolean isAClassifierRole(Object handle) { |
398 | 0 | return handle instanceof ClassifierRole; |
399 | |
} |
400 | |
|
401 | |
public boolean isAComment(Object handle) { |
402 | 145457 | return handle instanceof Comment; |
403 | |
} |
404 | |
|
405 | |
public boolean isACollaboration(Object handle) { |
406 | 36095 | return handle instanceof Collaboration; |
407 | |
} |
408 | |
|
409 | |
public boolean isACollaborationInstanceSet(Object handle) { |
410 | 0 | return handle instanceof CollaborationInstanceSet; |
411 | |
} |
412 | |
|
413 | |
public boolean isAComponent(Object handle) { |
414 | 93921 | return handle instanceof Component; |
415 | |
} |
416 | |
|
417 | |
public boolean isAComponentInstance(Object handle) { |
418 | 0 | return handle instanceof ComponentInstance; |
419 | |
} |
420 | |
|
421 | |
public boolean isAConstraint(Object handle) { |
422 | 93915 | return handle instanceof Constraint; |
423 | |
} |
424 | |
|
425 | |
public boolean isACreateAction(Object handle) { |
426 | 0 | return handle instanceof CreateAction; |
427 | |
} |
428 | |
|
429 | |
public boolean isADataType(Object handle) { |
430 | 0 | return handle instanceof DataType; |
431 | |
} |
432 | |
|
433 | |
public boolean isADataValue(Object handle) { |
434 | 0 | return handle instanceof DataValue; |
435 | |
} |
436 | |
|
437 | |
public boolean isADependency(Object handle) { |
438 | 93915 | return handle instanceof Dependency; |
439 | |
} |
440 | |
|
441 | |
public boolean isADestroyAction(Object handle) { |
442 | 0 | return handle instanceof DestroyAction; |
443 | |
} |
444 | |
|
445 | |
public boolean isACompositeState(Object handle) { |
446 | 29217 | return handle instanceof CompositeState; |
447 | |
} |
448 | |
|
449 | |
public boolean isAElement(Object handle) { |
450 | 2274 | return handle instanceof Element; |
451 | |
} |
452 | |
|
453 | |
public boolean isAElementImport(Object handle) { |
454 | 70938 | return handle instanceof ElementImport; |
455 | |
} |
456 | |
|
457 | |
public boolean isAElementResidence(Object handle) { |
458 | 93915 | return handle instanceof ElementResidence; |
459 | |
} |
460 | |
|
461 | |
public boolean isAEvent(Object handle) { |
462 | 1140 | return handle instanceof Event; |
463 | |
} |
464 | |
|
465 | |
public boolean isAException(Object handle) { |
466 | 42139 | return handle instanceof UmlException; |
467 | |
} |
468 | |
|
469 | |
public boolean isAExpression(Object handle) { |
470 | 93914 | return handle instanceof Expression; |
471 | |
} |
472 | |
|
473 | |
public boolean isAExtend(Object handle) { |
474 | 0 | return handle instanceof Extend; |
475 | |
} |
476 | |
|
477 | |
public boolean isAExtension(Object handle) { |
478 | 0 | throw new NotImplementedException( |
479 | |
"There are no extensions in UML 1.x"); |
480 | |
} |
481 | |
|
482 | |
public boolean isAExtensionPoint(Object handle) { |
483 | 9318 | return handle instanceof ExtensionPoint; |
484 | |
} |
485 | |
|
486 | |
public boolean isAFeature(Object handle) { |
487 | 97662 | return handle instanceof Feature; |
488 | |
} |
489 | |
|
490 | |
public boolean isAFinalState(Object handle) { |
491 | 570 | return handle instanceof FinalState; |
492 | |
} |
493 | |
|
494 | |
public boolean isAFlow(Object handle) { |
495 | 0 | return handle instanceof Flow; |
496 | |
} |
497 | |
|
498 | |
public boolean isAGuard(Object handle) { |
499 | 1140 | return handle instanceof Guard; |
500 | |
} |
501 | |
|
502 | |
public boolean isAGeneralizableElement(Object handle) { |
503 | 129552 | return handle instanceof GeneralizableElement; |
504 | |
} |
505 | |
|
506 | |
public boolean isAGeneralization(Object handle) { |
507 | 130380 | return handle instanceof Generalization; |
508 | |
} |
509 | |
|
510 | |
public boolean isAInclude(Object handle) { |
511 | 0 | return handle instanceof Include; |
512 | |
} |
513 | |
|
514 | |
public boolean isAInstance(Object handle) { |
515 | 0 | return handle instanceof Instance; |
516 | |
} |
517 | |
|
518 | |
public boolean isAInteraction(Object handle) { |
519 | 23938 | return handle instanceof Interaction; |
520 | |
} |
521 | |
|
522 | |
public boolean isAInteractionInstanceSet(Object handle) { |
523 | 0 | return handle instanceof InteractionInstanceSet; |
524 | |
} |
525 | |
|
526 | |
public boolean isAInterface(Object handle) { |
527 | 41 | return handle instanceof Interface; |
528 | |
} |
529 | |
|
530 | |
public boolean isALink(Object handle) { |
531 | 23938 | return handle instanceof Link; |
532 | |
} |
533 | |
|
534 | |
public boolean isALinkEnd(Object handle) { |
535 | 0 | return handle instanceof LinkEnd; |
536 | |
} |
537 | |
|
538 | |
public boolean isALinkObject(Object handle) { |
539 | 0 | return handle instanceof LinkObject; |
540 | |
} |
541 | |
|
542 | |
public boolean isAMessage(Object handle) { |
543 | 23938 | return handle instanceof Message; |
544 | |
} |
545 | |
|
546 | |
public boolean isAMethod(Object handle) { |
547 | 93914 | return handle instanceof Method; |
548 | |
} |
549 | |
|
550 | |
public boolean isAModel(Object handle) { |
551 | 6903 | return handle instanceof Model; |
552 | |
} |
553 | |
|
554 | |
public boolean isAModelElement(Object handle) { |
555 | 686126 | return handle instanceof ModelElement; |
556 | |
} |
557 | |
|
558 | |
public boolean isAMultiplicity(Object handle) { |
559 | 0 | return handle instanceof Multiplicity; |
560 | |
} |
561 | |
|
562 | |
public boolean isAMultiplicityRange(Object handle) { |
563 | 0 | return handle instanceof MultiplicityRange; |
564 | |
} |
565 | |
|
566 | |
public boolean isANamedElement(Object handle) { |
567 | 0 | return handle instanceof ModelElement; |
568 | |
} |
569 | |
|
570 | |
public boolean isANamespace(Object handle) { |
571 | 179045 | return handle instanceof Namespace; |
572 | |
} |
573 | |
|
574 | |
public boolean isANaryAssociation(Object handle) { |
575 | 0 | if (handle instanceof UmlAssociation) { |
576 | 0 | return (getConnections(handle).size() > 2); |
577 | |
} |
578 | 0 | return false; |
579 | |
} |
580 | |
|
581 | |
public boolean isANode(Object handle) { |
582 | 6 | return handle instanceof Node; |
583 | |
} |
584 | |
|
585 | |
public boolean isANodeInstance(Object handle) { |
586 | 0 | return handle instanceof NodeInstance; |
587 | |
} |
588 | |
|
589 | |
public boolean isAOperation(Object handle) { |
590 | 36304 | return handle instanceof Operation; |
591 | |
} |
592 | |
|
593 | |
public boolean isAObject(Object handle) { |
594 | 0 | return handle |
595 | |
instanceof org.omg.uml.behavioralelements.commonbehavior.Object; |
596 | |
} |
597 | |
|
598 | |
public boolean isAParameter(Object handle) { |
599 | 7287 | return handle instanceof Parameter; |
600 | |
} |
601 | |
|
602 | |
public boolean isAPartition(Object handle) { |
603 | 0 | return handle instanceof Partition; |
604 | |
} |
605 | |
|
606 | |
public boolean isAPackageImport(Object handle) { |
607 | 0 | return handle instanceof Permission; |
608 | |
} |
609 | |
|
610 | |
public boolean isAPackage(Object handle) { |
611 | 144878 | return handle instanceof UmlPackage; |
612 | |
} |
613 | |
|
614 | |
public boolean isAPrimitiveType(Object handle) { |
615 | 0 | return handle instanceof Primitive; |
616 | |
} |
617 | |
|
618 | |
public boolean isAProfile(Object handle) { |
619 | 39 | if (handle instanceof Model) { |
620 | 0 | for (Object stereo : getStereotypes(handle)) { |
621 | 0 | if (modelImpl.getExtensionMechanismsHelper() |
622 | |
.isStereotypeInh(stereo, "profile", |
623 | |
"Package")) { |
624 | 0 | return true; |
625 | |
} |
626 | |
} |
627 | |
} |
628 | 39 | return false; |
629 | |
} |
630 | |
|
631 | |
public boolean isAProfileApplication(Object handle) { |
632 | 0 | throw new NotImplementedException( |
633 | |
"There are no profile application objects in UML 1.x"); |
634 | |
} |
635 | |
|
636 | |
public boolean isAProperty(Object handle) { |
637 | 0 | throw new NotImplementedException( |
638 | |
"There are no UML Property objects in UML 1.x"); |
639 | |
} |
640 | |
|
641 | |
public boolean isAPseudostate(Object handle) { |
642 | 43279 | return handle instanceof Pseudostate; |
643 | |
} |
644 | |
|
645 | |
public boolean isAPseudostateKind(Object handle) { |
646 | 349 | return handle instanceof PseudostateKind; |
647 | |
} |
648 | |
|
649 | |
|
650 | |
public Object getKind(Object handle) { |
651 | |
try { |
652 | 0 | if (handle instanceof Pseudostate) { |
653 | 0 | return ((Pseudostate) handle).getKind(); |
654 | |
} |
655 | 0 | if (handle instanceof Parameter) { |
656 | 0 | return ((Parameter) handle).getKind(); |
657 | |
} |
658 | 0 | } catch (InvalidObjectException e) { |
659 | 0 | throw new InvalidElementException(e); |
660 | 0 | } |
661 | 0 | return illegalArgumentObject(handle); |
662 | |
} |
663 | |
|
664 | |
|
665 | |
public Object getReceiver(Object handle) { |
666 | |
try { |
667 | 0 | if (handle instanceof Stimulus) { |
668 | 0 | return ((Stimulus) handle).getReceiver(); |
669 | |
} |
670 | 0 | if (handle instanceof Message) { |
671 | 0 | return ((Message) handle).getReceiver(); |
672 | |
} |
673 | 0 | } catch (InvalidObjectException e) { |
674 | 0 | throw new InvalidElementException(e); |
675 | 0 | } |
676 | 0 | return illegalArgumentObject(handle); |
677 | |
} |
678 | |
|
679 | |
|
680 | |
public Object getLink(Object handle) { |
681 | |
try { |
682 | 0 | if (handle instanceof LinkEnd) { |
683 | 0 | return ((LinkEnd) handle).getLink(); |
684 | |
} |
685 | 0 | } catch (InvalidObjectException e) { |
686 | 0 | throw new InvalidElementException(e); |
687 | 0 | } |
688 | 0 | return illegalArgumentObject(handle); |
689 | |
} |
690 | |
|
691 | |
|
692 | |
public boolean equalsPseudostateKind(Object ps1, Object ps2) { |
693 | |
try { |
694 | 0 | if (isAPseudostateKind(ps1)) { |
695 | 0 | return ((PseudostateKind) ps1).equals(ps2); |
696 | |
} |
697 | 0 | } catch (InvalidObjectException e) { |
698 | 0 | throw new InvalidElementException(e); |
699 | 0 | } |
700 | 0 | return illegalArgumentBoolean(ps1); |
701 | |
} |
702 | |
|
703 | |
|
704 | |
public boolean isAReception(Object handle) { |
705 | 0 | return handle instanceof Reception; |
706 | |
} |
707 | |
|
708 | |
public boolean isAReturnAction(Object handle) { |
709 | 0 | return handle instanceof ReturnAction; |
710 | |
} |
711 | |
|
712 | |
public boolean isARelationship(Object handle) { |
713 | 0 | return handle instanceof Relationship; |
714 | |
} |
715 | |
|
716 | |
public boolean isASendAction(Object handle) { |
717 | 0 | return handle instanceof SendAction; |
718 | |
} |
719 | |
|
720 | |
public boolean isASendSignalAction(Object handle) { |
721 | 0 | return false; |
722 | |
} |
723 | |
|
724 | |
public boolean isASignal(Object handle) { |
725 | 66077 | return handle instanceof Signal; |
726 | |
} |
727 | |
|
728 | |
public boolean isASignalEvent(Object handle) { |
729 | 0 | return handle instanceof SignalEvent; |
730 | |
} |
731 | |
|
732 | |
public boolean isASimpleState(Object handle) { |
733 | 0 | return handle instanceof SimpleState; |
734 | |
} |
735 | |
|
736 | |
public boolean isAStateMachine(Object handle) { |
737 | 39000 | return handle instanceof StateMachine; |
738 | |
} |
739 | |
|
740 | |
public boolean isAStimulus(Object handle) { |
741 | 23938 | return handle instanceof Stimulus; |
742 | |
} |
743 | |
|
744 | |
public boolean isAStateVertex(Object handle) { |
745 | 52444 | return handle instanceof StateVertex; |
746 | |
} |
747 | |
|
748 | |
public boolean isAStereotype(Object handle) { |
749 | 31225 | return handle instanceof Stereotype; |
750 | |
} |
751 | |
|
752 | |
public boolean isAStructuralFeature(Object handle) { |
753 | 0 | return handle instanceof StructuralFeature; |
754 | |
} |
755 | |
|
756 | |
public boolean isAState(Object handle) { |
757 | 98602 | return handle instanceof State; |
758 | |
} |
759 | |
|
760 | |
public boolean isAStubState(Object handle) { |
761 | 0 | return handle instanceof StubState; |
762 | |
} |
763 | |
|
764 | |
public boolean isASubmachineState(Object handle) { |
765 | 23938 | return handle instanceof SubmachineState; |
766 | |
} |
767 | |
|
768 | |
public boolean isASubsystem(Object handle) { |
769 | 0 | return handle instanceof Subsystem; |
770 | |
} |
771 | |
|
772 | |
public boolean isASubsystemInstance(Object handle) { |
773 | 0 | return handle instanceof SubsystemInstance; |
774 | |
} |
775 | |
|
776 | |
public boolean isASynchState(Object handle) { |
777 | 0 | return handle instanceof SynchState; |
778 | |
} |
779 | |
|
780 | |
public boolean isATaggedValue(Object handle) { |
781 | 9318 | return handle instanceof TaggedValue; |
782 | |
} |
783 | |
|
784 | |
public boolean isATemplateArgument(Object handle) { |
785 | 0 | return handle instanceof TemplateArgument; |
786 | |
} |
787 | |
|
788 | |
public boolean isATemplateParameter(Object handle) { |
789 | 2274 | return handle instanceof TemplateParameter; |
790 | |
} |
791 | |
|
792 | |
public boolean isATransition(Object handle) { |
793 | 10694 | return handle instanceof Transition; |
794 | |
} |
795 | |
|
796 | |
public boolean isATimeEvent(Object handle) { |
797 | 0 | return handle instanceof TimeEvent; |
798 | |
} |
799 | |
|
800 | |
|
801 | |
public boolean isAUMLElement(Object handle) { |
802 | 293881 | return handle instanceof Element |
803 | |
|| handle instanceof ElementImport |
804 | |
|| handle instanceof ElementResidence |
805 | |
|| handle instanceof Expression |
806 | |
|| handle instanceof Multiplicity |
807 | |
|| handle instanceof MultiplicityRange |
808 | |
|| handle instanceof TemplateArgument |
809 | |
|| handle instanceof TemplateParameter; |
810 | |
} |
811 | |
|
812 | |
|
813 | |
public boolean isAUninterpretedAction(Object handle) { |
814 | 0 | return handle instanceof UninterpretedAction; |
815 | |
} |
816 | |
|
817 | |
public boolean isAUsage(Object handle) { |
818 | 0 | return handle instanceof Usage; |
819 | |
} |
820 | |
|
821 | |
public boolean isAUseCase(Object handle) { |
822 | 24024 | return handle instanceof UseCase; |
823 | |
} |
824 | |
|
825 | |
|
826 | |
public boolean isAVisibilityKind(Object handle) { |
827 | 0 | return handle instanceof VisibilityKind; |
828 | |
} |
829 | |
|
830 | |
|
831 | |
public boolean isActive(Object handle) { |
832 | |
try { |
833 | 0 | if (handle instanceof UmlClass) { |
834 | 0 | return ((UmlClass) handle).isActive(); |
835 | |
} |
836 | 0 | } catch (InvalidObjectException e) { |
837 | 0 | throw new InvalidElementException(e); |
838 | 0 | } |
839 | 0 | return illegalArgumentBoolean(handle); |
840 | |
} |
841 | |
|
842 | |
|
843 | |
public boolean isConcurrent(Object handle) { |
844 | |
try { |
845 | 0 | if (handle instanceof CompositeState) { |
846 | 0 | return ((CompositeState) handle).isConcurrent(); |
847 | |
} |
848 | 0 | } catch (InvalidObjectException e) { |
849 | 0 | throw new InvalidElementException(e); |
850 | 0 | } |
851 | 0 | return illegalArgumentBoolean(handle); |
852 | |
} |
853 | |
|
854 | |
|
855 | |
public boolean isAConcurrentRegion(Object handle) { |
856 | |
try { |
857 | 0 | if ((handle instanceof CompositeState) |
858 | |
&& (getContainer(handle) != null)) { |
859 | 0 | return (isConcurrent(getContainer(handle))); |
860 | |
} |
861 | 0 | } catch (InvalidObjectException e) { |
862 | 0 | throw new InvalidElementException(e); |
863 | 0 | } |
864 | 0 | return false; |
865 | |
} |
866 | |
|
867 | |
|
868 | |
public boolean isConstructor(Object handle) { |
869 | |
try { |
870 | 0 | Operation operation = null; |
871 | 0 | if (handle instanceof Method) { |
872 | 0 | operation = ((Method) handle).getSpecification(); |
873 | 0 | if (operation == null) { |
874 | |
|
875 | |
|
876 | 0 | return false; |
877 | |
} |
878 | 0 | } else if (handle instanceof Operation) { |
879 | 0 | operation = (Operation) handle; |
880 | |
} else { |
881 | 0 | return illegalArgumentBoolean(handle); |
882 | |
} |
883 | |
|
884 | 0 | for (Object stereo : getStereotypes(operation)) { |
885 | 0 | if (modelImpl.getExtensionMechanismsHelper() |
886 | |
.isStereotypeInh(stereo, "create", |
887 | |
"BehavioralFeature")) { |
888 | 0 | return true; |
889 | |
} |
890 | |
} |
891 | 0 | return false; |
892 | 0 | } catch (InvalidObjectException e) { |
893 | 0 | throw new InvalidElementException(e); |
894 | |
} |
895 | |
} |
896 | |
|
897 | |
|
898 | |
public boolean isFrozen(Object handle) { |
899 | |
try { |
900 | 0 | if (handle instanceof ChangeableKind) { |
901 | 0 | ChangeableKind ck = (ChangeableKind) handle; |
902 | 0 | return ChangeableKindEnum.CK_FROZEN.equals(ck); |
903 | |
} |
904 | 0 | } catch (InvalidObjectException e) { |
905 | 0 | throw new InvalidElementException(e); |
906 | 0 | } |
907 | 0 | return illegalArgumentBoolean(handle); |
908 | |
} |
909 | |
|
910 | |
|
911 | |
public boolean isComposite(Object handle) { |
912 | |
try { |
913 | 0 | if (handle instanceof AssociationEnd) { |
914 | 0 | return AggregationKindEnum.AK_COMPOSITE |
915 | |
.equals(((AssociationEnd) handle).getAggregation()); |
916 | |
} |
917 | 0 | } catch (InvalidObjectException e) { |
918 | 0 | throw new InvalidElementException(e); |
919 | 0 | } |
920 | 0 | return illegalArgumentBoolean(handle); |
921 | |
} |
922 | |
|
923 | |
|
924 | |
public boolean isAggregate(Object handle) { |
925 | |
try { |
926 | 0 | if (handle instanceof AssociationEnd) { |
927 | 0 | return AggregationKindEnum.AK_AGGREGATE |
928 | |
.equals(((AssociationEnd) handle).getAggregation()); |
929 | |
} |
930 | 0 | } catch (InvalidObjectException e) { |
931 | 0 | throw new InvalidElementException(e); |
932 | 0 | } |
933 | 0 | return illegalArgumentBoolean(handle); |
934 | |
} |
935 | |
|
936 | |
|
937 | |
public boolean isInitialized(Object handle) { |
938 | |
try { |
939 | 0 | if (handle instanceof Attribute) { |
940 | 0 | Expression init = ((Attribute) handle).getInitialValue(); |
941 | |
|
942 | 0 | if (init != null && init.getBody() != null |
943 | |
&& init.getBody().trim().length() > 0) { |
944 | 0 | return true; |
945 | |
} |
946 | 0 | return false; |
947 | |
} |
948 | 0 | } catch (InvalidObjectException e) { |
949 | 0 | throw new InvalidElementException(e); |
950 | 0 | } |
951 | 0 | return illegalArgumentBoolean(handle); |
952 | |
} |
953 | |
|
954 | |
|
955 | |
public boolean isInternal(Object handle) { |
956 | |
try { |
957 | 0 | if (handle instanceof Transition) { |
958 | 0 | Object state = getState(handle); |
959 | 0 | Object end0 = getSource(handle); |
960 | 0 | Object end1 = getTarget(handle); |
961 | 0 | if (end0 != null) { |
962 | 0 | return ((state == end0) && (state == end1)); |
963 | |
} |
964 | |
} |
965 | 0 | } catch (InvalidObjectException e) { |
966 | 0 | throw new InvalidElementException(e); |
967 | 0 | } |
968 | 0 | return illegalArgumentBoolean(handle); |
969 | |
} |
970 | |
|
971 | |
|
972 | |
public boolean isLeaf(Object handle) { |
973 | |
try { |
974 | 0 | if (handle instanceof GeneralizableElement) { |
975 | 0 | return ((GeneralizableElement) handle).isLeaf(); |
976 | |
} |
977 | 0 | if (handle instanceof Operation) { |
978 | 0 | return ((Operation) handle).isLeaf(); |
979 | |
} |
980 | 0 | if (handle instanceof Reception) { |
981 | 0 | return ((Reception) handle).isLeaf(); |
982 | |
} |
983 | 0 | } catch (InvalidObjectException e) { |
984 | 0 | throw new InvalidElementException(e); |
985 | 0 | } |
986 | 0 | if (isAUMLElement(handle)) { |
987 | 0 | return false; |
988 | |
} else { |
989 | 0 | return illegalArgumentBoolean(handle); |
990 | |
} |
991 | |
} |
992 | |
|
993 | |
|
994 | |
public boolean isRoot(Object handle) { |
995 | |
try { |
996 | 0 | if (handle instanceof GeneralizableElement) { |
997 | 0 | return ((GeneralizableElement) handle).isRoot(); |
998 | |
} |
999 | 0 | if (handle instanceof Operation) { |
1000 | 0 | return ((Operation) handle).isRoot(); |
1001 | |
} |
1002 | 0 | if (handle instanceof Reception) { |
1003 | 0 | return ((Reception) handle).isRoot(); |
1004 | |
} |
1005 | 0 | } catch (InvalidObjectException e) { |
1006 | 0 | throw new InvalidElementException(e); |
1007 | 0 | } |
1008 | 0 | if (isAUMLElement(handle)) { |
1009 | 0 | return false; |
1010 | |
} else { |
1011 | 0 | return illegalArgumentBoolean(handle); |
1012 | |
} |
1013 | |
} |
1014 | |
|
1015 | |
|
1016 | |
public boolean isSpecification(Object handle) { |
1017 | |
try { |
1018 | 0 | if (handle instanceof ModelElement) { |
1019 | 0 | return ((ModelElement) handle).isSpecification(); |
1020 | |
} |
1021 | 0 | if (handle instanceof ElementImport) { |
1022 | 0 | return ((ElementImport) handle).isSpecification(); |
1023 | |
} |
1024 | 0 | } catch (InvalidObjectException e) { |
1025 | 0 | throw new InvalidElementException(e); |
1026 | 0 | } |
1027 | 0 | return illegalArgumentBoolean(handle); |
1028 | |
} |
1029 | |
|
1030 | |
public boolean isNavigable(Object handle) { |
1031 | |
try { |
1032 | 0 | if (handle instanceof AssociationEnd) { |
1033 | 0 | return ((AssociationEnd) handle).isNavigable(); |
1034 | |
} |
1035 | 0 | } catch (InvalidObjectException e) { |
1036 | 0 | throw new InvalidElementException(e); |
1037 | 0 | } |
1038 | 0 | return illegalArgumentBoolean(handle); |
1039 | |
} |
1040 | |
|
1041 | |
|
1042 | |
public boolean isPrimaryObject(Object handle) { |
1043 | |
try { |
1044 | 570 | if (handle instanceof ModelElement) { |
1045 | |
for (TaggedValue tv |
1046 | 570 | : ((ModelElement) handle).getTaggedValue()) { |
1047 | 0 | TagDefinition type = tv.getType(); |
1048 | 0 | if (type != null |
1049 | |
&& GENERATED_TAG.equals(type.getTagType())) { |
1050 | 0 | return false; |
1051 | |
} |
1052 | 0 | } |
1053 | 570 | return true; |
1054 | |
} |
1055 | 0 | } catch (InvalidObjectException e) { |
1056 | 0 | throw new InvalidElementException(e); |
1057 | 0 | } |
1058 | 0 | return illegalArgumentBoolean(handle); |
1059 | |
} |
1060 | |
|
1061 | |
|
1062 | |
public boolean isPackage(Object handle) { |
1063 | |
try { |
1064 | 0 | if (handle instanceof ModelElement) { |
1065 | 0 | ModelElement element = (ModelElement) handle; |
1066 | 0 | return VisibilityKindEnum.VK_PACKAGE.equals( |
1067 | |
element.getVisibility()); |
1068 | |
} |
1069 | 0 | } catch (InvalidObjectException e) { |
1070 | 0 | throw new InvalidElementException(e); |
1071 | 0 | } |
1072 | 0 | return illegalArgumentBoolean(handle); |
1073 | |
} |
1074 | |
|
1075 | |
|
1076 | |
public boolean isPrivate(Object handle) { |
1077 | |
try { |
1078 | 0 | if (handle instanceof ModelElement) { |
1079 | 0 | ModelElement elem = (ModelElement) handle; |
1080 | 0 | return VisibilityKindEnum.VK_PRIVATE |
1081 | |
.equals(elem.getVisibility()); |
1082 | |
} |
1083 | 0 | return illegalArgumentBoolean(handle); |
1084 | 0 | } catch (InvalidObjectException e) { |
1085 | 0 | throw new InvalidElementException(e); |
1086 | |
} |
1087 | |
} |
1088 | |
|
1089 | |
|
1090 | |
public boolean isPublic(Object handle) { |
1091 | |
try { |
1092 | 0 | if (handle instanceof ModelElement) { |
1093 | 0 | ModelElement elem = (ModelElement) handle; |
1094 | 0 | return VisibilityKindEnum.VK_PUBLIC |
1095 | |
.equals(elem.getVisibility()); |
1096 | |
} |
1097 | 0 | return illegalArgumentBoolean(handle); |
1098 | 0 | } catch (InvalidObjectException e) { |
1099 | 0 | throw new InvalidElementException(e); |
1100 | |
} |
1101 | |
} |
1102 | |
|
1103 | |
|
1104 | |
public boolean isQuery(Object handle) { |
1105 | |
try { |
1106 | 0 | if (handle instanceof BehavioralFeature) { |
1107 | 0 | return ((BehavioralFeature) handle).isQuery(); |
1108 | |
} |
1109 | 0 | return illegalArgumentBoolean(handle); |
1110 | 0 | } catch (InvalidObjectException e) { |
1111 | 0 | throw new InvalidElementException(e); |
1112 | |
} |
1113 | |
} |
1114 | |
|
1115 | |
|
1116 | |
public boolean isProtected(Object handle) { |
1117 | |
try { |
1118 | 0 | if (handle instanceof ModelElement) { |
1119 | 0 | ModelElement elem = (ModelElement) handle; |
1120 | 0 | return VisibilityKindEnum.VK_PROTECTED |
1121 | |
.equals(elem.getVisibility()); |
1122 | |
} |
1123 | 0 | return illegalArgumentBoolean(handle); |
1124 | 0 | } catch (InvalidObjectException e) { |
1125 | 0 | throw new InvalidElementException(e); |
1126 | |
} |
1127 | |
} |
1128 | |
|
1129 | |
|
1130 | |
public boolean isRealize(Object handle) { |
1131 | 0 | return isStereotype(handle, CoreFactory.REALIZE_STEREOTYPE); |
1132 | |
} |
1133 | |
|
1134 | |
|
1135 | |
public boolean isReturn(Object handle) { |
1136 | 0 | return hasReturnParameterDirectionKind(handle); |
1137 | |
} |
1138 | |
|
1139 | |
|
1140 | |
public boolean isSingleton(Object handle) { |
1141 | 0 | return isStereotype(handle, "singleton"); |
1142 | |
} |
1143 | |
|
1144 | |
|
1145 | |
public boolean isStereotype(Object handle, String stereotypeName) { |
1146 | |
try { |
1147 | 0 | if (handle instanceof ModelElement) { |
1148 | 0 | Collection stereotypes = |
1149 | |
((ModelElement) handle).getStereotype(); |
1150 | 0 | Iterator it = stereotypes.iterator(); |
1151 | |
Stereotype stereotype; |
1152 | 0 | while (it.hasNext()) { |
1153 | 0 | stereotype = (Stereotype) it.next(); |
1154 | 0 | if (stereotypeName.equals(stereotype.getName())) { |
1155 | 0 | return true; |
1156 | |
} |
1157 | |
} |
1158 | 0 | return false; |
1159 | |
} |
1160 | 0 | return illegalArgumentBoolean(handle); |
1161 | 0 | } catch (InvalidObjectException e) { |
1162 | 0 | throw new InvalidElementException(e); |
1163 | |
} |
1164 | |
} |
1165 | |
|
1166 | |
|
1167 | |
public boolean isATerminateAction(Object handle) { |
1168 | 0 | return handle instanceof TerminateAction; |
1169 | |
} |
1170 | |
|
1171 | |
|
1172 | |
public boolean isTop(Object handle) { |
1173 | |
try { |
1174 | 570 | if (isACompositeState(handle)) { |
1175 | 570 | return ((CompositeState) handle).getStateMachine() != null; |
1176 | |
} |
1177 | 0 | return illegalArgumentBoolean(handle); |
1178 | 0 | } catch (InvalidObjectException e) { |
1179 | 0 | throw new InvalidElementException(e); |
1180 | |
} |
1181 | |
} |
1182 | |
|
1183 | |
|
1184 | |
public boolean isType(Object handle) { |
1185 | 0 | return isStereotype(handle, "type"); |
1186 | |
} |
1187 | |
|
1188 | |
public boolean isUtility(Object handle) { |
1189 | 0 | return isStereotype(handle, "utility"); |
1190 | |
} |
1191 | |
|
1192 | |
|
1193 | |
public Object getAssociation(Object handle) { |
1194 | |
try { |
1195 | 0 | if (handle instanceof AssociationEnd) { |
1196 | 0 | return ((AssociationEnd) handle).getAssociation(); |
1197 | |
} |
1198 | 0 | if (handle instanceof Link) { |
1199 | 0 | return ((Link) handle).getAssociation(); |
1200 | |
} |
1201 | 0 | return illegalArgumentObject(handle); |
1202 | 0 | } catch (InvalidObjectException e) { |
1203 | 0 | throw new InvalidElementException(e); |
1204 | |
} |
1205 | |
} |
1206 | |
|
1207 | |
|
1208 | |
public Object getAssociationEnd(Object handle, Object assoc) { |
1209 | |
try { |
1210 | 0 | if (handle instanceof Classifier |
1211 | |
&& assoc instanceof UmlAssociation) { |
1212 | 0 | Classifier classifier = (Classifier) handle; |
1213 | 0 | Iterator it = getAssociationEnds(classifier).iterator(); |
1214 | 0 | while (it.hasNext()) { |
1215 | 0 | AssociationEnd end = (AssociationEnd) it.next(); |
1216 | 0 | if (((UmlAssociation) assoc).getConnection() |
1217 | |
.contains(end)) { |
1218 | 0 | return end; |
1219 | |
} |
1220 | 0 | } |
1221 | 0 | return null; |
1222 | |
} |
1223 | 0 | throw new IllegalArgumentException("handle: " + handle + ",assoc: " |
1224 | |
+ assoc); |
1225 | 0 | } catch (InvalidObjectException e) { |
1226 | 0 | throw new InvalidElementException(e); |
1227 | |
} |
1228 | |
} |
1229 | |
|
1230 | |
|
1231 | |
|
1232 | |
|
1233 | |
|
1234 | |
|
1235 | |
|
1236 | |
|
1237 | |
private org.omg.uml.UmlPackage getRefOutermostPackage(Object handle) { |
1238 | 40627 | final RefPackage refPackage = |
1239 | |
((ModelElement) handle).refOutermostPackage(); |
1240 | 40627 | return (org.omg.uml.UmlPackage) refPackage; |
1241 | |
} |
1242 | |
|
1243 | |
public Collection getAssociations(Object handle) { |
1244 | 0 | throw new NotImplementedException("Not available for UML1.4"); |
1245 | |
} |
1246 | |
|
1247 | |
public Collection getAssociationEnds(Object handle) { |
1248 | |
try { |
1249 | 0 | if (handle instanceof Classifier) { |
1250 | 0 | return getRefOutermostPackage(handle).getCore() |
1251 | |
.getAParticipantAssociation().getAssociation( |
1252 | |
(Classifier) handle); |
1253 | |
} |
1254 | 0 | return illegalArgumentCollection(handle); |
1255 | 0 | } catch (InvalidObjectException e) { |
1256 | 0 | throw new InvalidElementException(e); |
1257 | |
} |
1258 | |
} |
1259 | |
|
1260 | |
public Collection getAssociationRoles(Object handle) { |
1261 | |
try { |
1262 | 0 | if (handle instanceof UmlAssociation) { |
1263 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
1264 | |
.getABaseAssociationRole().getAssociationRole( |
1265 | |
(UmlAssociation) handle); |
1266 | |
} |
1267 | 0 | return illegalArgumentCollection(handle); |
1268 | 0 | } catch (InvalidObjectException e) { |
1269 | 0 | throw new InvalidElementException(e); |
1270 | |
} |
1271 | |
} |
1272 | |
|
1273 | |
public List getAttributes(Object handle) { |
1274 | |
try { |
1275 | 0 | if (handle instanceof Classifier) { |
1276 | 0 | return getStructuralFeatures(handle); |
1277 | |
} |
1278 | 0 | return illegalArgumentList(handle); |
1279 | 0 | } catch (InvalidObjectException e) { |
1280 | 0 | throw new InvalidElementException(e); |
1281 | |
} |
1282 | |
} |
1283 | |
|
1284 | |
|
1285 | |
public Collection<String> getBaseClasses(Object handle) { |
1286 | |
try { |
1287 | 0 | if (isAStereotype(handle)) { |
1288 | 0 | return ((Stereotype) handle).getBaseClass(); |
1289 | |
} |
1290 | 0 | return illegalArgumentCollection(handle); |
1291 | 0 | } catch (InvalidObjectException e) { |
1292 | 0 | throw new InvalidElementException(e); |
1293 | |
} |
1294 | |
} |
1295 | |
|
1296 | |
|
1297 | |
public Object getBase(Object handle) { |
1298 | |
try { |
1299 | 0 | if (handle instanceof AssociationEndRole) { |
1300 | 0 | return ((AssociationEndRole) handle).getBase(); |
1301 | 0 | } else if (handle instanceof AssociationRole) { |
1302 | 0 | return ((AssociationRole) handle).getBase(); |
1303 | 0 | } else if (handle instanceof Extend) { |
1304 | 0 | return ((Extend) handle).getBase(); |
1305 | 0 | } else if (handle instanceof Include) { |
1306 | 0 | return ((Include) handle).getBase(); |
1307 | 0 | } else if (handle instanceof ClassifierRole) { |
1308 | |
|
1309 | |
|
1310 | 0 | return ((ClassifierRole) handle).getBase(); |
1311 | |
} |
1312 | 0 | } catch (InvalidObjectException e) { |
1313 | 0 | throw new InvalidElementException(e); |
1314 | 0 | } |
1315 | 0 | return illegalArgumentObject(handle); |
1316 | |
} |
1317 | |
|
1318 | |
|
1319 | |
public Collection<Classifier> getBases(Object handle) { |
1320 | |
try { |
1321 | 0 | if (handle instanceof ClassifierRole) { |
1322 | 0 | return ((ClassifierRole) handle).getBase(); |
1323 | |
} |
1324 | 0 | } catch (InvalidObjectException e) { |
1325 | 0 | throw new InvalidElementException(e); |
1326 | 0 | } |
1327 | 0 | return illegalArgumentCollection(handle); |
1328 | |
} |
1329 | |
|
1330 | |
|
1331 | |
public Collection getBehaviors(Object handle) { |
1332 | |
try { |
1333 | 4427 | if (handle instanceof ModelElement) { |
1334 | 4427 | return getRefOutermostPackage(handle) |
1335 | |
.getStateMachines().getABehaviorContext().getBehavior( |
1336 | |
(ModelElement) handle); |
1337 | |
} |
1338 | 0 | } catch (InvalidObjectException e) { |
1339 | 0 | throw new InvalidElementException(e); |
1340 | 0 | } |
1341 | 0 | return illegalArgumentCollection(handle); |
1342 | |
} |
1343 | |
|
1344 | |
|
1345 | |
public Object getBehavioralFeature(Object handle) { |
1346 | |
try { |
1347 | 0 | if (handle instanceof Parameter) { |
1348 | 0 | return ((Parameter) handle).getBehavioralFeature(); |
1349 | |
} |
1350 | 0 | return illegalArgumentCollection(handle); |
1351 | 0 | } catch (InvalidObjectException e) { |
1352 | 0 | throw new InvalidElementException(e); |
1353 | |
} |
1354 | |
} |
1355 | |
|
1356 | |
|
1357 | |
public Object getBody(Object handle) { |
1358 | |
try { |
1359 | 0 | if (handle instanceof Comment) { |
1360 | |
|
1361 | 0 | return ((Comment) handle).getBody(); |
1362 | |
} |
1363 | 0 | if (handle instanceof Constraint) { |
1364 | 0 | return ((Constraint) handle).getBody(); |
1365 | |
} |
1366 | 0 | if (handle instanceof Expression) { |
1367 | 0 | return ((Expression) handle).getBody(); |
1368 | |
} |
1369 | 0 | if (handle instanceof Method) { |
1370 | 0 | return ((Method) handle).getBody(); |
1371 | |
} |
1372 | 0 | return illegalArgumentObject(handle); |
1373 | 0 | } catch (InvalidObjectException e) { |
1374 | 0 | throw new InvalidElementException(e); |
1375 | |
} |
1376 | |
} |
1377 | |
|
1378 | |
|
1379 | |
public int getBound(Object handle) { |
1380 | |
try { |
1381 | 0 | if (handle instanceof SynchState) { |
1382 | 0 | return ((SynchState) handle).getBound(); |
1383 | |
} |
1384 | 0 | return illegalArgumentInt(handle); |
1385 | 0 | } catch (InvalidObjectException e) { |
1386 | 0 | throw new InvalidElementException(e); |
1387 | |
} |
1388 | |
} |
1389 | |
|
1390 | |
|
1391 | |
@Deprecated |
1392 | |
public Object getChangeability(Object handle) { |
1393 | |
try { |
1394 | 0 | if (handle instanceof StructuralFeature) { |
1395 | 0 | return ((StructuralFeature) handle).getChangeability(); |
1396 | |
} |
1397 | 0 | if (handle instanceof AssociationEnd) { |
1398 | 0 | return ((AssociationEnd) handle).getChangeability(); |
1399 | |
} |
1400 | 0 | return illegalArgumentObject(handle); |
1401 | 0 | } catch (InvalidObjectException e) { |
1402 | 0 | throw new InvalidElementException(e); |
1403 | |
} |
1404 | |
} |
1405 | |
|
1406 | |
|
1407 | |
public boolean isReadOnly(Object handle) { |
1408 | |
ChangeableKind ck; |
1409 | |
try { |
1410 | 0 | if (handle instanceof StructuralFeature) { |
1411 | 0 | ck = ((StructuralFeature) handle).getChangeability(); |
1412 | 0 | } else if (handle instanceof AssociationEnd) { |
1413 | 0 | ck = ((AssociationEnd) handle).getChangeability(); |
1414 | |
} else { |
1415 | 0 | return illegalArgumentBoolean(handle); |
1416 | |
} |
1417 | 0 | return ChangeableKindEnum.CK_FROZEN.equals(ck); |
1418 | 0 | } catch (InvalidObjectException e) { |
1419 | 0 | throw new InvalidElementException(e); |
1420 | |
} |
1421 | |
} |
1422 | |
|
1423 | |
public Object getSpecific(Object handle) { |
1424 | |
try { |
1425 | 0 | if (handle instanceof Generalization) { |
1426 | 0 | return ((Generalization) handle).getChild(); |
1427 | |
} |
1428 | 0 | return illegalArgumentObject(handle); |
1429 | 0 | } catch (InvalidObjectException e) { |
1430 | 0 | throw new InvalidElementException(e); |
1431 | |
} |
1432 | |
} |
1433 | |
|
1434 | |
|
1435 | |
public Collection<GeneralizableElement> getChildren(Object handle) { |
1436 | |
try { |
1437 | 2 | return modelImpl.getCoreHelper().getChildren(handle); |
1438 | 0 | } catch (InvalidObjectException e) { |
1439 | 0 | throw new InvalidElementException(e); |
1440 | |
} |
1441 | |
} |
1442 | |
|
1443 | |
|
1444 | |
public Collection getClassifierRoles(Object handle) { |
1445 | |
try { |
1446 | 0 | if (handle instanceof Feature) { |
1447 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
1448 | |
.getAClassifierRoleAvailableFeature() |
1449 | |
.getClassifierRole((Feature) handle); |
1450 | |
} |
1451 | 0 | if (handle instanceof Classifier) { |
1452 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
1453 | |
.getAClassifierRoleBase().getClassifierRole( |
1454 | |
(Classifier) handle); |
1455 | |
} |
1456 | 0 | } catch (InvalidObjectException e) { |
1457 | 0 | throw new InvalidElementException(e); |
1458 | 0 | } |
1459 | 0 | return illegalArgumentCollection(handle); |
1460 | |
} |
1461 | |
|
1462 | |
|
1463 | |
public Object getClassifier(Object handle) { |
1464 | |
try { |
1465 | 0 | if (isAAssociationEnd(handle)) { |
1466 | 0 | return ((AssociationEnd) handle).getParticipant(); |
1467 | |
} |
1468 | 0 | } catch (InvalidObjectException e) { |
1469 | 0 | throw new InvalidElementException(e); |
1470 | 0 | } |
1471 | 0 | return illegalArgumentObject(handle); |
1472 | |
} |
1473 | |
|
1474 | |
|
1475 | |
public Collection<Classifier> getClassifiers(Object handle) { |
1476 | |
try { |
1477 | 0 | if (handle instanceof Instance) { |
1478 | 0 | return ((Instance) handle).getClassifier(); |
1479 | |
} |
1480 | 0 | return illegalArgumentCollection(handle); |
1481 | 0 | } catch (InvalidObjectException e) { |
1482 | 0 | throw new InvalidElementException(e); |
1483 | |
} |
1484 | |
} |
1485 | |
|
1486 | |
|
1487 | |
public Collection getClassifiersInState(Object handle) { |
1488 | |
try { |
1489 | 0 | if (handle instanceof Classifier) { |
1490 | 0 | return getRefOutermostPackage(handle).getActivityGraphs() |
1491 | |
.getATypeClassifierInState().getClassifierInState( |
1492 | |
(Classifier) handle); |
1493 | |
} |
1494 | 0 | if (handle instanceof State) { |
1495 | 0 | return getRefOutermostPackage(handle).getActivityGraphs() |
1496 | |
.getAClassifierInStateInState().getClassifierInState( |
1497 | |
(State) handle); |
1498 | |
} |
1499 | 0 | return illegalArgumentCollection(handle); |
1500 | 0 | } catch (InvalidObjectException e) { |
1501 | 0 | throw new InvalidElementException(e); |
1502 | |
} |
1503 | |
} |
1504 | |
|
1505 | |
|
1506 | |
public Collection<ModelElement> getClients(Object handle) { |
1507 | |
try { |
1508 | 0 | if (isADependency(handle)) { |
1509 | 0 | return ((Dependency) handle).getClient(); |
1510 | |
} |
1511 | 0 | return illegalArgumentCollection(handle); |
1512 | 0 | } catch (InvalidObjectException e) { |
1513 | 0 | throw new InvalidElementException(e); |
1514 | |
} |
1515 | |
} |
1516 | |
|
1517 | |
|
1518 | |
public Collection<Dependency> getClientDependencies(Object handle) { |
1519 | |
try { |
1520 | 2 | if (handle instanceof ModelElement) { |
1521 | 2 | final ModelElement me = (ModelElement) handle; |
1522 | 2 | return Collections.unmodifiableCollection( |
1523 | |
me.getClientDependency()); |
1524 | |
} |
1525 | 0 | } catch (InvalidObjectException e) { |
1526 | 0 | throw new InvalidElementException(e); |
1527 | 0 | } |
1528 | 0 | throw new IllegalArgumentException("Expected a ModelElement. Got a " |
1529 | |
+ handle.getClass().getName()); |
1530 | |
} |
1531 | |
|
1532 | |
|
1533 | |
public Object getCondition(Object handle) { |
1534 | |
try { |
1535 | 0 | if (handle instanceof Extend) { |
1536 | 0 | return ((Extend) handle).getCondition(); |
1537 | |
} |
1538 | 0 | return illegalArgumentObject(handle); |
1539 | 0 | } catch (InvalidObjectException e) { |
1540 | 0 | throw new InvalidElementException(e); |
1541 | |
} |
1542 | |
} |
1543 | |
|
1544 | |
|
1545 | |
public Object getConcurrency(Object handle) { |
1546 | |
try { |
1547 | 0 | if (handle instanceof Operation) { |
1548 | 0 | return ((Operation) handle).getConcurrency(); |
1549 | |
} |
1550 | 0 | return illegalArgumentObject(handle); |
1551 | 0 | } catch (InvalidObjectException e) { |
1552 | 0 | throw new InvalidElementException(e); |
1553 | |
} |
1554 | |
} |
1555 | |
|
1556 | |
|
1557 | |
public Collection getConnections(Object handle) { |
1558 | |
try { |
1559 | 0 | if (handle instanceof UmlAssociation) { |
1560 | |
|
1561 | 0 | return ((UmlAssociation) handle).getConnection(); |
1562 | |
} |
1563 | 0 | if (handle instanceof Link) { |
1564 | 0 | return ((Link) handle).getConnection(); |
1565 | |
} |
1566 | 0 | } catch (InvalidObjectException e) { |
1567 | 0 | throw new InvalidElementException(e); |
1568 | 0 | } |
1569 | 0 | return illegalArgumentCollection(handle); |
1570 | |
} |
1571 | |
|
1572 | |
|
1573 | |
public Object getEffect(Object handle) { |
1574 | |
try { |
1575 | 0 | if (handle instanceof Transition) { |
1576 | 0 | return ((Transition) handle).getEffect(); |
1577 | |
} |
1578 | 0 | return illegalArgumentObject(handle); |
1579 | 0 | } catch (InvalidObjectException e) { |
1580 | 0 | throw new InvalidElementException(e); |
1581 | |
} |
1582 | |
} |
1583 | |
|
1584 | |
|
1585 | |
public Collection getElementResidences(Object handle) { |
1586 | |
try { |
1587 | 0 | if (handle instanceof ModelElement) { |
1588 | 0 | return getRefOutermostPackage(handle) |
1589 | |
.getCore().getAResidentElementResidence() |
1590 | |
.getElementResidence((ModelElement) handle); |
1591 | |
} |
1592 | 0 | return illegalArgumentCollection(handle); |
1593 | 0 | } catch (InvalidObjectException e) { |
1594 | 0 | throw new InvalidElementException(e); |
1595 | |
} |
1596 | |
} |
1597 | |
|
1598 | |
|
1599 | |
public Collection getElementImports2(Object handle) { |
1600 | |
try { |
1601 | 570 | if (handle instanceof ModelElement) { |
1602 | 570 | return getRefOutermostPackage(handle) |
1603 | |
.getModelManagement() |
1604 | |
.getAImportedElementElementImport().getElementImport( |
1605 | |
(ModelElement) handle); |
1606 | |
} |
1607 | 0 | return illegalArgumentCollection(handle); |
1608 | 0 | } catch (InvalidObjectException e) { |
1609 | 0 | throw new InvalidElementException(e); |
1610 | |
} |
1611 | |
} |
1612 | |
|
1613 | |
public Collection<ElementImport> getElementImports(Object handle) { |
1614 | |
try { |
1615 | 3971 | if (handle instanceof UmlPackage) { |
1616 | 3971 | return ((UmlPackage) handle).getElementImport(); |
1617 | |
} |
1618 | 0 | return illegalArgumentCollection(handle); |
1619 | 0 | } catch (InvalidObjectException e) { |
1620 | 0 | throw new InvalidElementException(e); |
1621 | |
} |
1622 | |
} |
1623 | |
|
1624 | |
public Object getEntry(Object handle) { |
1625 | |
try { |
1626 | 0 | if (handle instanceof State) { |
1627 | |
try { |
1628 | 0 | return ((State) handle).getEntry(); |
1629 | 0 | } catch (InvalidObjectException e) { |
1630 | 0 | throw new InvalidElementException(e); |
1631 | |
} |
1632 | |
} |
1633 | 0 | return illegalArgumentObject(handle); |
1634 | 0 | } catch (InvalidObjectException e) { |
1635 | 0 | throw new InvalidElementException(e); |
1636 | |
} |
1637 | |
} |
1638 | |
|
1639 | |
|
1640 | |
public Object getEnumeration(Object handle) { |
1641 | |
try { |
1642 | 0 | if (handle instanceof EnumerationLiteral) { |
1643 | 0 | return ((EnumerationLiteral) handle).getEnumeration(); |
1644 | |
} |
1645 | 0 | return illegalArgumentObject(handle); |
1646 | 0 | } catch (InvalidObjectException e) { |
1647 | 0 | throw new InvalidElementException(e); |
1648 | |
} |
1649 | |
} |
1650 | |
|
1651 | |
|
1652 | |
public Object getExit(Object handle) { |
1653 | |
try { |
1654 | 0 | if (handle instanceof State) { |
1655 | 0 | return ((State) handle).getExit(); |
1656 | |
} |
1657 | 0 | return illegalArgumentObject(handle); |
1658 | 0 | } catch (InvalidObjectException e) { |
1659 | 0 | throw new InvalidElementException(e); |
1660 | |
} |
1661 | |
} |
1662 | |
|
1663 | |
|
1664 | |
public Object getExpression(Object handle) { |
1665 | |
try { |
1666 | 0 | if (handle instanceof Guard) { |
1667 | 0 | return ((Guard) handle).getExpression(); |
1668 | |
} |
1669 | 0 | if (handle instanceof ChangeEvent) { |
1670 | 0 | return ((ChangeEvent) handle).getChangeExpression(); |
1671 | |
} |
1672 | 0 | if (handle instanceof TimeEvent) { |
1673 | 0 | return ((TimeEvent) handle).getWhen(); |
1674 | |
} |
1675 | 0 | if (handle instanceof Argument) { |
1676 | 0 | return ((Argument) handle).getValue(); |
1677 | |
} |
1678 | 0 | return illegalArgumentObject(handle); |
1679 | 0 | } catch (InvalidObjectException e) { |
1680 | 0 | throw new InvalidElementException(e); |
1681 | |
} |
1682 | |
} |
1683 | |
|
1684 | |
|
1685 | |
public Collection getExtendedElements(Object handle) { |
1686 | |
try { |
1687 | 0 | if (!(handle instanceof Stereotype)) { |
1688 | 0 | return illegalArgumentCollection(handle); |
1689 | |
} |
1690 | 0 | Stereotype stereotype = (Stereotype) handle; |
1691 | 0 | return getRefOutermostPackage(handle) |
1692 | |
.getCore().getAStereotypeExtendedElement() |
1693 | |
.getExtendedElement(stereotype); |
1694 | 0 | } catch (InvalidObjectException e) { |
1695 | 0 | throw new InvalidElementException(e); |
1696 | |
} |
1697 | |
} |
1698 | |
|
1699 | |
|
1700 | |
public Collection getExtends(Object handle) { |
1701 | |
try { |
1702 | 0 | if (handle instanceof UseCase) { |
1703 | 0 | return ((UseCase) handle).getExtend(); |
1704 | |
} |
1705 | 0 | if (handle instanceof ExtensionPoint) { |
1706 | 0 | ExtensionPoint ep = (ExtensionPoint) handle; |
1707 | 0 | return getRefOutermostPackage(handle) |
1708 | |
.getUseCases().getAExtensionPointExtend().getExtend(ep); |
1709 | |
} |
1710 | 0 | } catch (InvalidObjectException e) { |
1711 | 0 | throw new InvalidElementException(e); |
1712 | 0 | } |
1713 | 0 | return illegalArgumentCollection(handle); |
1714 | |
} |
1715 | |
|
1716 | |
|
1717 | |
public Collection getExtenders(Object handle) { |
1718 | |
try { |
1719 | 0 | if (handle instanceof UseCase) { |
1720 | 0 | return getRefOutermostPackage(handle).getUseCases() |
1721 | |
.getABaseExtender().getExtender((UseCase) handle); |
1722 | |
} |
1723 | 0 | return illegalArgumentCollection(handle); |
1724 | 0 | } catch (InvalidObjectException e) { |
1725 | 0 | throw new InvalidElementException(e); |
1726 | |
} |
1727 | |
} |
1728 | |
|
1729 | |
|
1730 | |
public Object getExtension(Object handle) { |
1731 | |
try { |
1732 | 0 | if (handle instanceof Extend) { |
1733 | 0 | return ((Extend) handle).getExtension(); |
1734 | |
} |
1735 | 0 | return illegalArgumentObject(handle); |
1736 | 0 | } catch (InvalidObjectException e) { |
1737 | 0 | throw new InvalidElementException(e); |
1738 | |
} |
1739 | |
} |
1740 | |
|
1741 | |
|
1742 | |
public Object getExtensionPoint(Object handle, int index) { |
1743 | |
try { |
1744 | 0 | if (handle instanceof Extend) { |
1745 | 0 | return ((Extend) handle).getExtensionPoint().get(index); |
1746 | |
} |
1747 | 0 | return illegalArgumentObject(handle); |
1748 | 0 | } catch (InvalidObjectException e) { |
1749 | 0 | throw new InvalidElementException(e); |
1750 | |
} |
1751 | |
} |
1752 | |
|
1753 | |
|
1754 | |
public Collection<ExtensionPoint> getExtensionPoints(Object handle) { |
1755 | |
try { |
1756 | 0 | if (handle instanceof UseCase) { |
1757 | 0 | return ((UseCase) handle).getExtensionPoint(); |
1758 | |
} |
1759 | 0 | if (handle instanceof Extend) { |
1760 | |
|
1761 | 0 | return ((Extend) handle).getExtensionPoint(); |
1762 | |
} |
1763 | 0 | } catch (InvalidObjectException e) { |
1764 | 0 | throw new InvalidElementException(e); |
1765 | 0 | } |
1766 | 0 | return illegalArgumentCollection(handle); |
1767 | |
} |
1768 | |
|
1769 | |
|
1770 | |
public List<Feature> getFeatures(Object handle) { |
1771 | |
try { |
1772 | 0 | if (handle instanceof Classifier) { |
1773 | 0 | return ((Classifier) handle).getFeature(); |
1774 | |
} |
1775 | 0 | } catch (InvalidObjectException e) { |
1776 | 0 | throw new InvalidElementException(e); |
1777 | 0 | } |
1778 | 0 | return illegalArgumentList(handle); |
1779 | |
} |
1780 | |
|
1781 | |
|
1782 | |
public Object getGeneralization(Object handle, Object parent) { |
1783 | |
try { |
1784 | 0 | if (handle instanceof GeneralizableElement |
1785 | |
&& parent instanceof GeneralizableElement) { |
1786 | 0 | Iterator it = getGeneralizations(handle).iterator(); |
1787 | 0 | while (it.hasNext()) { |
1788 | 0 | Generalization gen = (Generalization) it.next(); |
1789 | 0 | if (gen.getParent() == parent) { |
1790 | 0 | return gen; |
1791 | |
} |
1792 | 0 | } |
1793 | 0 | return null; |
1794 | |
} |
1795 | 0 | return illegalArgumentObject(handle); |
1796 | 0 | } catch (InvalidObjectException e) { |
1797 | 0 | throw new InvalidElementException(e); |
1798 | |
} |
1799 | |
} |
1800 | |
|
1801 | |
|
1802 | |
public Collection<Generalization> getGeneralizations(Object handle) { |
1803 | |
try { |
1804 | 0 | if (handle instanceof GeneralizableElement) { |
1805 | 0 | return ((GeneralizableElement) handle).getGeneralization(); |
1806 | |
} |
1807 | 0 | } catch (InvalidObjectException e) { |
1808 | 0 | throw new InvalidElementException(e); |
1809 | 0 | } |
1810 | 0 | return illegalArgumentCollection(handle); |
1811 | |
} |
1812 | |
|
1813 | |
|
1814 | |
public Object getGuard(Object handle) { |
1815 | |
try { |
1816 | 0 | if (isATransition(handle)) { |
1817 | 0 | return ((Transition) handle).getGuard(); |
1818 | |
} |
1819 | 0 | return illegalArgumentObject(handle); |
1820 | 0 | } catch (InvalidObjectException e) { |
1821 | 0 | throw new InvalidElementException(e); |
1822 | |
} |
1823 | |
} |
1824 | |
|
1825 | |
|
1826 | |
public Object getIcon(Object handle) { |
1827 | |
try { |
1828 | 0 | if (handle instanceof Stereotype) { |
1829 | 0 | return ((Stereotype) handle).getIcon(); |
1830 | |
} |
1831 | 0 | } catch (InvalidObjectException e) { |
1832 | 0 | throw new InvalidElementException(e); |
1833 | 0 | } |
1834 | 0 | return illegalArgumentObject(handle); |
1835 | |
} |
1836 | |
|
1837 | |
|
1838 | |
public Collection<ModelElement> getImportedElements(Object pack) { |
1839 | 0 | if (!(pack instanceof UmlPackage)) { |
1840 | 0 | return illegalArgumentCollection(pack); |
1841 | |
} |
1842 | 0 | Collection<ModelElement> results = new ArrayList<ModelElement>(); |
1843 | |
try { |
1844 | |
|
1845 | |
|
1846 | |
|
1847 | |
|
1848 | |
|
1849 | |
|
1850 | 0 | for (ElementImport ei : ((UmlPackage) pack).getElementImport()) { |
1851 | 0 | ModelElement element = ei.getImportedElement(); |
1852 | 0 | results.add(element); |
1853 | 0 | } |
1854 | 0 | return results; |
1855 | 0 | } catch (InvalidObjectException e) { |
1856 | 0 | throw new InvalidElementException(e); |
1857 | |
} |
1858 | |
} |
1859 | |
|
1860 | |
|
1861 | |
public Object getImportedElement(Object elementImport) { |
1862 | 0 | if (!(elementImport instanceof ElementImport)) { |
1863 | 0 | return illegalArgumentCollection("This is not an ElementImport: " |
1864 | |
+ elementImport); |
1865 | |
} |
1866 | |
try { |
1867 | 0 | return ((ElementImport) elementImport).getImportedElement(); |
1868 | 0 | } catch (InvalidObjectException e) { |
1869 | 0 | throw new InvalidElementException(e); |
1870 | |
} |
1871 | |
} |
1872 | |
|
1873 | |
public Collection<Include> getIncludes(Object handle) { |
1874 | |
try { |
1875 | 0 | if (handle instanceof UseCase) { |
1876 | 0 | return ((UseCase) handle).getInclude(); |
1877 | |
} |
1878 | 0 | } catch (InvalidObjectException e) { |
1879 | 0 | throw new InvalidElementException(e); |
1880 | 0 | } |
1881 | 0 | return illegalArgumentCollection(handle); |
1882 | |
} |
1883 | |
|
1884 | |
public Collection getIncluders(Object handle) { |
1885 | |
try { |
1886 | 0 | if (handle instanceof UseCase) { |
1887 | 0 | return getRefOutermostPackage(handle).getUseCases() |
1888 | |
.getAIncluderAddition().getIncluder((UseCase) handle); |
1889 | |
} |
1890 | 0 | } catch (InvalidObjectException e) { |
1891 | 0 | throw new InvalidElementException(e); |
1892 | 0 | } |
1893 | 0 | return illegalArgumentCollection(handle); |
1894 | |
} |
1895 | |
|
1896 | |
|
1897 | |
public Collection getIncomings(Object handle) { |
1898 | |
try { |
1899 | 570 | if (isAGuard(handle) || isAAction(handle)) { |
1900 | 0 | return getIncomings(getTransition(handle)); |
1901 | |
} |
1902 | 570 | if (isAEvent(handle)) { |
1903 | 0 | Iterator trans = getTransitions(handle).iterator(); |
1904 | 0 | Collection incomings = new ArrayList(); |
1905 | 0 | while (trans.hasNext()) { |
1906 | 0 | incomings.addAll(getIncomings(trans.next())); |
1907 | |
} |
1908 | 0 | return incomings; |
1909 | |
} |
1910 | 570 | if (isAStateVertex(handle)) { |
1911 | 570 | return ((StateVertex) handle).getIncoming(); |
1912 | |
} |
1913 | |
|
1914 | 0 | if (isATransition(handle)) { |
1915 | 0 | return ((Transition) handle).getSource().getIncoming(); |
1916 | |
} |
1917 | 0 | } catch (InvalidObjectException e) { |
1918 | 0 | throw new InvalidElementException(e); |
1919 | 0 | } |
1920 | 0 | return illegalArgumentCollection(handle); |
1921 | |
} |
1922 | |
|
1923 | |
|
1924 | |
public Object getInitialValue(Object handle) { |
1925 | |
try { |
1926 | 0 | if (handle instanceof Attribute) { |
1927 | 0 | return ((Attribute) handle).getInitialValue(); |
1928 | |
} |
1929 | 0 | } catch (InvalidObjectException e) { |
1930 | 0 | throw new InvalidElementException(e); |
1931 | 0 | } |
1932 | 0 | return illegalArgumentCollection(handle); |
1933 | |
} |
1934 | |
|
1935 | |
|
1936 | |
public Object getInstance(Object handle) { |
1937 | |
try { |
1938 | 0 | if (handle instanceof AttributeLink) { |
1939 | 0 | return ((AttributeLink) handle).getInstance(); |
1940 | |
} |
1941 | 0 | if (handle instanceof LinkEnd) { |
1942 | 0 | return ((LinkEnd) handle).getInstance(); |
1943 | |
} |
1944 | 0 | } catch (InvalidObjectException e) { |
1945 | 0 | throw new InvalidElementException(e); |
1946 | 0 | } |
1947 | 0 | return illegalArgumentObject(handle); |
1948 | |
} |
1949 | |
|
1950 | |
|
1951 | |
public Collection getInstances(Object handle) { |
1952 | |
try { |
1953 | 0 | if (handle instanceof Classifier) { |
1954 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
1955 | |
.getAInstanceClassifier().getInstance( |
1956 | |
(Classifier) handle); |
1957 | |
} |
1958 | 0 | } catch (InvalidObjectException e) { |
1959 | 0 | throw new InvalidElementException(e); |
1960 | 0 | } |
1961 | 0 | return illegalArgumentCollection(handle); |
1962 | |
} |
1963 | |
|
1964 | |
|
1965 | |
public Collection<State> getInStates(Object handle) { |
1966 | |
try { |
1967 | 0 | if (handle instanceof ClassifierInState) { |
1968 | 0 | return ((ClassifierInState) handle).getInState(); |
1969 | |
} |
1970 | 0 | } catch (InvalidObjectException e) { |
1971 | 0 | throw new InvalidElementException(e); |
1972 | 0 | } |
1973 | 0 | return illegalArgumentCollection(handle); |
1974 | |
} |
1975 | |
|
1976 | |
|
1977 | |
public Object getInteraction(Object handle) { |
1978 | |
try { |
1979 | 0 | if (handle instanceof Message) { |
1980 | 0 | return ((Message) handle).getInteraction(); |
1981 | |
} |
1982 | 0 | } catch (InvalidObjectException e) { |
1983 | 0 | throw new InvalidElementException(e); |
1984 | 0 | } |
1985 | 0 | return illegalArgumentObject(handle); |
1986 | |
} |
1987 | |
|
1988 | |
|
1989 | |
public Collection<Interaction> getInteractions(Object handle) { |
1990 | |
try { |
1991 | 19 | if (handle instanceof Collaboration) { |
1992 | 19 | return ((Collaboration) handle).getInteraction(); |
1993 | |
} |
1994 | 0 | } catch (InvalidObjectException e) { |
1995 | 0 | throw new InvalidElementException(e); |
1996 | 0 | } |
1997 | 0 | return illegalArgumentCollection(handle); |
1998 | |
} |
1999 | |
|
2000 | |
|
2001 | |
public Collection<Transition> getInternalTransitions(Object handle) { |
2002 | |
try { |
2003 | 0 | if (handle instanceof State) { |
2004 | 0 | return ((State) handle).getInternalTransition(); |
2005 | |
} |
2006 | 0 | } catch (InvalidObjectException e) { |
2007 | 0 | throw new InvalidElementException(e); |
2008 | 0 | } |
2009 | 0 | return illegalArgumentCollection(handle); |
2010 | |
} |
2011 | |
|
2012 | |
|
2013 | |
public Collection<Message> getMessages(Object handle) { |
2014 | |
try { |
2015 | 0 | if (isAInteraction(handle)) { |
2016 | 0 | return ((Interaction) handle).getMessage(); |
2017 | |
} |
2018 | 0 | if (handle instanceof AssociationRole) { |
2019 | 0 | return ((AssociationRole) handle).getMessage(); |
2020 | |
} |
2021 | 0 | if (handle instanceof Action) { |
2022 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2023 | |
.getAActionMessage().getMessage(((Action) handle)); |
2024 | |
} |
2025 | 0 | } catch (InvalidObjectException e) { |
2026 | 0 | throw new InvalidElementException(e); |
2027 | 0 | } |
2028 | 0 | return illegalArgumentCollection(handle); |
2029 | |
} |
2030 | |
|
2031 | |
public Collection getSuccessors(Object handle) { |
2032 | |
try { |
2033 | 0 | if (handle instanceof Message) { |
2034 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2035 | |
.getAPredecessorSuccessor().getSuccessor( |
2036 | |
(Message) handle); |
2037 | |
} |
2038 | 0 | return illegalArgumentCollection(handle); |
2039 | 0 | } catch (InvalidObjectException e) { |
2040 | 0 | throw new InvalidElementException(e); |
2041 | |
} |
2042 | |
} |
2043 | |
|
2044 | |
public Collection getActivatedMessages(Object handle) { |
2045 | |
try { |
2046 | 0 | if (handle instanceof Message) { |
2047 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2048 | |
.getAMessageActivator().getMessage((Message) handle); |
2049 | |
} |
2050 | 0 | } catch (InvalidObjectException e) { |
2051 | 0 | throw new InvalidElementException(e); |
2052 | 0 | } |
2053 | 0 | return illegalArgumentCollection(handle); |
2054 | |
} |
2055 | |
|
2056 | |
public Collection getReceivedMessages(Object handle) { |
2057 | |
try { |
2058 | 0 | if (handle instanceof ClassifierRole) { |
2059 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2060 | |
.getAReceiverMessage().getMessage( |
2061 | |
(ClassifierRole) handle); |
2062 | |
} |
2063 | 0 | } catch (InvalidObjectException e) { |
2064 | 0 | throw new InvalidElementException(e); |
2065 | 0 | } |
2066 | 0 | return illegalArgumentCollection(handle); |
2067 | |
} |
2068 | |
|
2069 | |
public Collection getSentMessages(Object handle) { |
2070 | |
try { |
2071 | 0 | if (handle instanceof ClassifierRole) { |
2072 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2073 | |
.getAMessageSender() |
2074 | |
.getMessage((ClassifierRole) handle); |
2075 | |
} |
2076 | 0 | } catch (InvalidObjectException e) { |
2077 | 0 | throw new InvalidElementException(e); |
2078 | 0 | } |
2079 | 0 | return illegalArgumentCollection(handle); |
2080 | |
} |
2081 | |
|
2082 | |
public Object getInnerContainingModel(Object handle) { |
2083 | |
try { |
2084 | 0 | if (isAModel(handle)) { |
2085 | 0 | return handle; |
2086 | |
} |
2087 | 0 | if (!isAUMLElement(handle)) { |
2088 | 0 | return illegalArgumentObject(handle); |
2089 | |
} |
2090 | |
|
2091 | |
|
2092 | 0 | if (getModelElementContainer(handle) == null) { |
2093 | 0 | return handle; |
2094 | |
} |
2095 | |
|
2096 | 0 | return getInnerContainingModel( |
2097 | |
getModelElementContainer(handle)); |
2098 | 0 | } catch (InvalidObjectException e) { |
2099 | 0 | throw new InvalidElementException(e); |
2100 | |
} |
2101 | |
} |
2102 | |
|
2103 | |
public Object getRoot(final Object handle) { |
2104 | 0 | Object result = handle; |
2105 | |
try { |
2106 | 0 | if (!isAUMLElement(handle)) { |
2107 | 0 | return illegalArgumentObject(handle); |
2108 | |
} |
2109 | 0 | Object container = getModelElementContainer(handle); |
2110 | 0 | while (container != null) { |
2111 | 0 | result = container; |
2112 | 0 | container = getModelElementContainer(result); |
2113 | |
} |
2114 | 0 | } catch (InvalidObjectException e) { |
2115 | 0 | throw new InvalidElementException(e); |
2116 | 0 | } |
2117 | 0 | return result; |
2118 | |
} |
2119 | |
|
2120 | |
public Collection getRootElements() { |
2121 | 0 | Collection elements = new ArrayList(); |
2122 | 0 | org.omg.uml.UmlPackage pkg = modelImpl.getUmlPackage(); |
2123 | 0 | if (pkg != null) { |
2124 | 0 | for (RefObject obj : (Collection<RefObject>) pkg.getCore() |
2125 | |
.getElement().refAllOfType()) { |
2126 | 0 | if (obj.refImmediateComposite() == null) { |
2127 | 0 | elements.add(obj); |
2128 | |
} |
2129 | |
} |
2130 | |
} else { |
2131 | 0 | LOG.warn("No default extent in getRootElements"); |
2132 | |
} |
2133 | 0 | return elements; |
2134 | |
} |
2135 | |
|
2136 | |
|
2137 | |
public Object getModelElement(Object handle) { |
2138 | |
try { |
2139 | 0 | if (handle instanceof ElementImport) { |
2140 | |
|
2141 | 0 | return ((ElementImport) handle).getImportedElement(); |
2142 | |
} |
2143 | 0 | if (handle instanceof TaggedValue) { |
2144 | 0 | return ((TaggedValue) handle).getModelElement(); |
2145 | |
} |
2146 | 0 | if (handle instanceof TemplateArgument) { |
2147 | 0 | return ((TemplateArgument) handle).getModelElement(); |
2148 | |
} |
2149 | 0 | } catch (InvalidObjectException e) { |
2150 | 0 | throw new InvalidElementException(e); |
2151 | 0 | } |
2152 | 0 | return illegalArgumentObject(handle); |
2153 | |
} |
2154 | |
|
2155 | |
|
2156 | |
public Object getMultiplicity(Object handle) { |
2157 | |
try { |
2158 | 0 | if (handle instanceof StructuralFeature) { |
2159 | 0 | StructuralFeature sf = (StructuralFeature) handle; |
2160 | 0 | return sf.getMultiplicity(); |
2161 | 0 | } else if (handle instanceof TagDefinition) { |
2162 | 0 | TagDefinition td = (TagDefinition) handle; |
2163 | 0 | return td.getMultiplicity(); |
2164 | 0 | } else if (handle instanceof ClassifierRole) { |
2165 | 0 | ClassifierRole cr = (ClassifierRole) handle; |
2166 | 0 | return cr.getMultiplicity(); |
2167 | 0 | } else if (handle instanceof AssociationEnd) { |
2168 | 0 | AssociationEnd ae = (AssociationEnd) handle; |
2169 | 0 | return ae.getMultiplicity(); |
2170 | 0 | } else if (handle instanceof AssociationRole) { |
2171 | 0 | AssociationRole ar = (AssociationRole) handle; |
2172 | 0 | return ar.getMultiplicity(); |
2173 | |
} |
2174 | 0 | } catch (InvalidObjectException e) { |
2175 | 0 | throw new InvalidElementException(e); |
2176 | 0 | } |
2177 | 0 | return illegalArgumentObject(handle); |
2178 | |
} |
2179 | |
|
2180 | |
public Collection<Comment> getComments(Object handle) { |
2181 | |
try { |
2182 | 3971 | if (handle instanceof ModelElement) { |
2183 | 3971 | return ((ModelElement) handle).getComment(); |
2184 | |
} |
2185 | 0 | } catch (InvalidObjectException e) { |
2186 | 0 | throw new InvalidElementException(e); |
2187 | 0 | } |
2188 | 0 | return illegalArgumentCollection(handle); |
2189 | |
} |
2190 | |
|
2191 | |
|
2192 | |
public Collection<ModelElement> getAnnotatedElements(Object handle) { |
2193 | |
try { |
2194 | 0 | if (handle instanceof Comment) { |
2195 | 0 | return ((Comment) handle).getAnnotatedElement(); |
2196 | |
} |
2197 | 0 | } catch (InvalidObjectException e) { |
2198 | 0 | throw new InvalidElementException(e); |
2199 | 0 | } |
2200 | 0 | return illegalArgumentCollection(handle); |
2201 | |
} |
2202 | |
|
2203 | |
|
2204 | |
public Object getCommunicationConnection(Object handle) { |
2205 | |
try { |
2206 | 0 | if (handle instanceof Message) { |
2207 | 0 | return ((Message) handle).getCommunicationConnection(); |
2208 | |
} |
2209 | 0 | } catch (InvalidObjectException e) { |
2210 | 0 | throw new InvalidElementException(e); |
2211 | 0 | } |
2212 | 0 | return illegalArgumentObject(handle); |
2213 | |
} |
2214 | |
|
2215 | |
|
2216 | |
public Object getCommunicationLink(Object handle) { |
2217 | |
try { |
2218 | 0 | if (handle instanceof Stimulus) { |
2219 | 0 | return ((Stimulus) handle).getCommunicationLink(); |
2220 | |
} |
2221 | 0 | } catch (InvalidObjectException e) { |
2222 | 0 | throw new InvalidElementException(e); |
2223 | 0 | } |
2224 | 0 | return illegalArgumentObject(handle); |
2225 | |
} |
2226 | |
|
2227 | |
|
2228 | |
public Collection getCollaborations(Object handle) { |
2229 | |
try { |
2230 | 0 | if (handle instanceof Operation) { |
2231 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2232 | |
.getARepresentedOperationCollaboration() |
2233 | |
.getCollaboration((Operation) handle); |
2234 | |
} |
2235 | 0 | if (handle instanceof Classifier) { |
2236 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
2237 | |
.getARepresentedClassifierCollaboration() |
2238 | |
.getCollaboration((Classifier) handle); |
2239 | |
} |
2240 | 0 | } catch (InvalidObjectException e) { |
2241 | 0 | throw new InvalidElementException(e); |
2242 | 0 | } |
2243 | 0 | return illegalArgumentCollection(handle); |
2244 | |
} |
2245 | |
|
2246 | |
|
2247 | |
public Object getComponentInstance(Object handle) { |
2248 | |
try { |
2249 | 0 | if (handle instanceof Instance) { |
2250 | 0 | return ((Instance) handle).getComponentInstance(); |
2251 | |
} |
2252 | 0 | } catch (InvalidObjectException e) { |
2253 | 0 | throw new InvalidElementException(e); |
2254 | 0 | } |
2255 | 0 | return illegalArgumentObject(handle); |
2256 | |
} |
2257 | |
|
2258 | |
|
2259 | |
public Collection<ModelElement> getConstrainingElements(Object handle) { |
2260 | |
try { |
2261 | 0 | if (handle instanceof Collaboration) { |
2262 | 0 | return ((Collaboration) handle).getConstrainingElement(); |
2263 | |
} |
2264 | 0 | } catch (InvalidObjectException e) { |
2265 | 0 | throw new InvalidElementException(e); |
2266 | 0 | } |
2267 | 0 | return illegalArgumentCollection(handle); |
2268 | |
} |
2269 | |
|
2270 | |
|
2271 | |
public List<ModelElement> getConstrainedElements(Object handle) { |
2272 | |
try { |
2273 | 0 | if (handle instanceof Constraint) { |
2274 | 0 | return ((Constraint) handle).getConstrainedElement(); |
2275 | |
} |
2276 | 0 | } catch (InvalidObjectException e) { |
2277 | 0 | throw new InvalidElementException(e); |
2278 | 0 | } |
2279 | 0 | return illegalArgumentList(handle); |
2280 | |
} |
2281 | |
|
2282 | |
|
2283 | |
public Collection<Constraint> getConstraints(Object handle) { |
2284 | |
try { |
2285 | 0 | if (handle instanceof ModelElement) { |
2286 | 0 | return ((ModelElement) handle).getConstraint(); |
2287 | |
} |
2288 | 0 | } catch (InvalidObjectException e) { |
2289 | 0 | throw new InvalidElementException(e); |
2290 | 0 | } |
2291 | 0 | return illegalArgumentCollection(handle); |
2292 | |
} |
2293 | |
|
2294 | |
|
2295 | |
public Object getModelElementContainer(Object handle) { |
2296 | |
try { |
2297 | 570 | if (handle instanceof RefObject) { |
2298 | 570 | return ((RefObject) handle).refImmediateComposite(); |
2299 | |
} |
2300 | 0 | } catch (InvalidObjectException e) { |
2301 | 0 | throw new InvalidElementException(e); |
2302 | 0 | } |
2303 | 0 | return illegalArgumentObject(handle); |
2304 | |
} |
2305 | |
|
2306 | |
|
2307 | |
public List getModelElementContents(Object handle) { |
2308 | 8 | List results = getModelElementAssociated(handle, true); |
2309 | 8 | return results; |
2310 | |
} |
2311 | |
|
2312 | |
|
2313 | |
public List getModelElementAssociated(Object handle) { |
2314 | 0 | return getModelElementAssociated(handle, false); |
2315 | |
} |
2316 | |
|
2317 | |
|
2318 | |
|
2319 | |
|
2320 | |
|
2321 | |
|
2322 | |
|
2323 | |
|
2324 | |
|
2325 | |
|
2326 | |
|
2327 | |
|
2328 | |
|
2329 | |
|
2330 | |
|
2331 | |
|
2332 | |
private List getModelElementAssociated(Object handle, |
2333 | |
boolean contentsOnly) { |
2334 | 8 | List<RefBaseObject> results = new ArrayList<RefBaseObject>(); |
2335 | |
|
2336 | 8 | if (!(handle instanceof RefFeatured)) { |
2337 | 0 | throw new IllegalArgumentException( |
2338 | |
"Element doesn't appear to be a MOF element :" + handle); |
2339 | |
} |
2340 | |
|
2341 | |
try { |
2342 | 8 | modelImpl.getRepository().beginTrans(false); |
2343 | 8 | RefFeatured rf = (RefFeatured) handle; |
2344 | 8 | RefObject metaobject = rf.refMetaObject(); |
2345 | 8 | if (!(metaobject instanceof MofClass)) { |
2346 | 0 | throw new IllegalArgumentException( |
2347 | |
"Element doesn't appear to be a MOF element :" |
2348 | |
+ handle); |
2349 | |
} |
2350 | 8 | MofClass metaclass = (MofClass) metaobject; |
2351 | 8 | List<MofClass> types = |
2352 | |
new ArrayList<MofClass>(metaclass.allSupertypes()); |
2353 | 8 | types.add(metaclass); |
2354 | 8 | for (MofClass s : types) { |
2355 | 48 | for (Object contentElement : s.getContents()) { |
2356 | 152 | getReferenceOrAttribute( |
2357 | |
(RefFeatured) handle, contentElement, results, |
2358 | |
contentsOnly); |
2359 | |
} |
2360 | |
} |
2361 | 0 | } catch (InvalidObjectException e) { |
2362 | 0 | throw new InvalidElementException(e); |
2363 | |
} finally { |
2364 | 8 | modelImpl.getRepository().endTrans(); |
2365 | 8 | } |
2366 | 8 | return results; |
2367 | |
} |
2368 | |
|
2369 | |
|
2370 | |
|
2371 | |
|
2372 | |
|
2373 | |
|
2374 | |
|
2375 | |
private void getReferenceOrAttribute(RefFeatured parent, Object element, |
2376 | |
Collection<RefBaseObject> returns, boolean contentsOnly) { |
2377 | |
|
2378 | |
try { |
2379 | 152 | if (!(element instanceof javax.jmi.model.Attribute |
2380 | |
|| element instanceof Reference)) { |
2381 | 8 | return; |
2382 | |
} |
2383 | 144 | if (element instanceof Reference) { |
2384 | 96 | javax.jmi.model.AggregationKind ak = ((Reference) element) |
2385 | |
.getExposedEnd().getAggregation(); |
2386 | 96 | if (contentsOnly && ak != MOF_COMPOSITE) { |
2387 | 64 | return; |
2388 | |
} |
2389 | |
} |
2390 | |
|
2391 | 80 | String valueName = ((javax.jmi.model.ModelElement) element) |
2392 | |
.getName(); |
2393 | 80 | Object refends = parent.refGetValue(valueName); |
2394 | 80 | if (refends == null) { |
2395 | 8 | return; |
2396 | |
} |
2397 | 72 | if (refends instanceof Collection) { |
2398 | 32 | Collection c = (Collection) refends; |
2399 | 32 | if (!c.isEmpty()) { |
2400 | 0 | for (Iterator it = c.iterator(); it.hasNext();) { |
2401 | 0 | Object o = it.next(); |
2402 | |
|
2403 | 0 | if (o instanceof RefBaseObject) { |
2404 | 0 | returns.add((RefBaseObject) o); |
2405 | |
} |
2406 | 0 | } |
2407 | |
} |
2408 | 32 | } else { |
2409 | |
|
2410 | 40 | if (refends instanceof RefBaseObject) { |
2411 | 0 | returns.add((RefBaseObject) refends); |
2412 | |
} |
2413 | |
} |
2414 | 0 | } catch (InvalidObjectException e) { |
2415 | 0 | throw new InvalidElementException(e); |
2416 | 72 | } |
2417 | 72 | } |
2418 | |
|
2419 | |
|
2420 | |
|
2421 | |
public Object getContainer(Object handle) { |
2422 | |
try { |
2423 | 0 | if (isAGuard(handle) || isAAction(handle)) { |
2424 | 0 | return getContainer(getTransition(handle)); |
2425 | |
} |
2426 | 0 | if (isAEvent(handle)) { |
2427 | |
Object container; |
2428 | 0 | Iterator it = getTransitions(handle).iterator(); |
2429 | 0 | while (it.hasNext()) { |
2430 | 0 | container = getContainer(it.next()); |
2431 | 0 | if (container != null) { |
2432 | 0 | return container; |
2433 | |
} |
2434 | |
} |
2435 | |
} |
2436 | 0 | if (handle instanceof StateVertex) { |
2437 | 0 | return ((StateVertex) handle).getContainer(); |
2438 | |
} |
2439 | |
|
2440 | 0 | if (isATransition(handle)) { |
2441 | 0 | return ((Transition) handle).getStateMachine().getTop() |
2442 | |
.getContainer(); |
2443 | |
} |
2444 | 0 | if (handle instanceof ElementResidence) { |
2445 | 0 | return ((ElementResidence) handle).getContainer(); |
2446 | |
} |
2447 | 0 | } catch (InvalidObjectException e) { |
2448 | 0 | throw new InvalidElementException(e); |
2449 | 0 | } |
2450 | 0 | return illegalArgumentObject(handle); |
2451 | |
} |
2452 | |
|
2453 | |
|
2454 | |
public Collection<ModelElement> getContents(Object handle) { |
2455 | |
try { |
2456 | 0 | if (handle instanceof Partition) { |
2457 | 0 | return ((Partition) handle).getContents(); |
2458 | |
} |
2459 | 0 | } catch (InvalidObjectException e) { |
2460 | 0 | throw new InvalidElementException(e); |
2461 | 0 | } |
2462 | 0 | return illegalArgumentCollection(handle); |
2463 | |
} |
2464 | |
|
2465 | |
|
2466 | |
public Object getContext(Object handle) { |
2467 | |
try { |
2468 | 130 | if (isAStateMachine(handle)) { |
2469 | 130 | return ((StateMachine) handle).getContext(); |
2470 | |
} |
2471 | 0 | if (isAInteraction(handle)) { |
2472 | 0 | return ((Interaction) handle).getContext(); |
2473 | |
} |
2474 | 0 | } catch (InvalidObjectException e) { |
2475 | 0 | throw new InvalidElementException(e); |
2476 | 0 | } |
2477 | 0 | return illegalArgumentObject(handle); |
2478 | |
} |
2479 | |
|
2480 | |
|
2481 | |
public Collection getContexts(Object handle) { |
2482 | |
try { |
2483 | 0 | if (handle instanceof Signal) { |
2484 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
2485 | |
.getAContextRaisedSignal().getContext((Signal) handle); |
2486 | |
} |
2487 | 0 | } catch (InvalidObjectException e) { |
2488 | 0 | throw new InvalidElementException(e); |
2489 | 0 | } |
2490 | 0 | return illegalArgumentCollection(handle); |
2491 | |
} |
2492 | |
|
2493 | |
|
2494 | |
public Collection getCreateActions(Object handle) { |
2495 | |
try { |
2496 | 0 | if (handle instanceof Classifier) { |
2497 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
2498 | |
.getACreateActionInstantiation().getCreateAction( |
2499 | |
(Classifier) handle); |
2500 | |
} |
2501 | 0 | } catch (InvalidObjectException e) { |
2502 | 0 | throw new InvalidElementException(e); |
2503 | 0 | } |
2504 | 0 | return illegalArgumentCollection(handle); |
2505 | |
} |
2506 | |
|
2507 | |
|
2508 | |
public Object getDefaultValue(Object handle) { |
2509 | |
try { |
2510 | 0 | if (handle instanceof Parameter) { |
2511 | 0 | return ((Parameter) handle).getDefaultValue(); |
2512 | |
} |
2513 | 0 | } catch (InvalidObjectException e) { |
2514 | 0 | throw new InvalidElementException(e); |
2515 | 0 | } |
2516 | 0 | return illegalArgumentObject(handle); |
2517 | |
} |
2518 | |
|
2519 | |
|
2520 | |
public Collection<Event> getDeferrableEvents(Object handle) { |
2521 | |
try { |
2522 | 0 | if (handle instanceof State) { |
2523 | 0 | return ((State) handle).getDeferrableEvent(); |
2524 | |
} |
2525 | 0 | } catch (InvalidObjectException e) { |
2526 | 0 | throw new InvalidElementException(e); |
2527 | 0 | } |
2528 | 0 | return illegalArgumentCollection(handle); |
2529 | |
} |
2530 | |
|
2531 | |
|
2532 | |
public Collection<Node> getDeploymentLocations(Object handle) { |
2533 | |
try { |
2534 | 0 | if (handle instanceof Component) { |
2535 | 0 | return ((Component) handle).getDeploymentLocation(); |
2536 | |
} |
2537 | 0 | } catch (InvalidObjectException e) { |
2538 | 0 | throw new InvalidElementException(e); |
2539 | 0 | } |
2540 | 0 | return illegalArgumentCollection(handle); |
2541 | |
} |
2542 | |
|
2543 | |
public Collection<Component> getDeployedComponents(Object handle) { |
2544 | |
try { |
2545 | 0 | if (handle instanceof Node) { |
2546 | 0 | return ((Node) handle).getDeployedComponent(); |
2547 | |
} |
2548 | 0 | } catch (InvalidObjectException e) { |
2549 | 0 | throw new InvalidElementException(e); |
2550 | 0 | } |
2551 | 0 | return illegalArgumentCollection(handle); |
2552 | |
} |
2553 | |
|
2554 | |
|
2555 | |
@Deprecated |
2556 | |
public Object getDiscriminator(Object handle) { |
2557 | |
try { |
2558 | 0 | if (handle instanceof Generalization) { |
2559 | 0 | return ((Generalization) handle).getDiscriminator(); |
2560 | |
} |
2561 | 0 | } catch (InvalidObjectException e) { |
2562 | 0 | throw new InvalidElementException(e); |
2563 | 0 | } |
2564 | 0 | throw new IllegalArgumentException("Expected a Generalization. Got a " |
2565 | |
+ handle.getClass().getName()); |
2566 | |
} |
2567 | |
|
2568 | |
|
2569 | |
public Object getDispatchAction(Object handle) { |
2570 | |
try { |
2571 | 0 | if (handle instanceof Stimulus) { |
2572 | 0 | return ((Stimulus) handle).getDispatchAction(); |
2573 | |
} |
2574 | 0 | } catch (InvalidObjectException e) { |
2575 | 0 | throw new InvalidElementException(e); |
2576 | 0 | } |
2577 | 0 | return illegalArgumentObject(handle); |
2578 | |
} |
2579 | |
|
2580 | |
|
2581 | |
public Object getDoActivity(Object handle) { |
2582 | |
try { |
2583 | 0 | if (handle instanceof State) { |
2584 | 0 | return ((State) handle).getDoActivity(); |
2585 | |
} |
2586 | 0 | } catch (InvalidObjectException e) { |
2587 | 0 | throw new InvalidElementException(e); |
2588 | 0 | } |
2589 | 0 | return illegalArgumentObject(handle); |
2590 | |
} |
2591 | |
|
2592 | |
|
2593 | |
public Collection getLinks(Object handle) { |
2594 | |
try { |
2595 | 0 | if (handle instanceof UmlAssociation) { |
2596 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
2597 | |
.getAAssociationLink().getLink((UmlAssociation) handle); |
2598 | |
} |
2599 | 0 | } catch (InvalidObjectException e) { |
2600 | 0 | throw new InvalidElementException(e); |
2601 | 0 | } |
2602 | 0 | return illegalArgumentCollection(handle); |
2603 | |
} |
2604 | |
|
2605 | |
|
2606 | |
public Collection getLinkEnds(Object handle) { |
2607 | |
try { |
2608 | 0 | if (handle instanceof AssociationEnd) { |
2609 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
2610 | |
.getAAssociationEndLinkEnd().getLinkEnd( |
2611 | |
(AssociationEnd) handle); |
2612 | |
} |
2613 | 0 | if (handle instanceof Instance) { |
2614 | 0 | return ((Instance) handle).getLinkEnd(); |
2615 | |
} |
2616 | 0 | } catch (InvalidObjectException e) { |
2617 | 0 | throw new InvalidElementException(e); |
2618 | 0 | } |
2619 | 0 | return illegalArgumentCollection(handle); |
2620 | |
} |
2621 | |
|
2622 | |
|
2623 | |
public String getLocation(Object handle) { |
2624 | |
try { |
2625 | 0 | if (handle instanceof ExtensionPoint) { |
2626 | 0 | return ((ExtensionPoint) handle).getLocation(); |
2627 | |
} |
2628 | 0 | } catch (InvalidObjectException e) { |
2629 | 0 | throw new InvalidElementException(e); |
2630 | 0 | } |
2631 | 0 | return illegalArgumentString(handle); |
2632 | |
} |
2633 | |
|
2634 | |
|
2635 | |
public Collection getMethods(Object handle) { |
2636 | |
try { |
2637 | 0 | if (handle instanceof Operation) { |
2638 | 0 | return getRefOutermostPackage(handle).getCore() |
2639 | |
.getASpecificationMethod() |
2640 | |
.getMethod((Operation) handle); |
2641 | |
} |
2642 | 0 | } catch (InvalidObjectException e) { |
2643 | 0 | throw new InvalidElementException(e); |
2644 | 0 | } |
2645 | 0 | return illegalArgumentCollection(handle); |
2646 | |
} |
2647 | |
|
2648 | |
|
2649 | |
public Object getNamespace(Object handle) { |
2650 | 694 | if (!(handle instanceof ModelElement)) { |
2651 | 0 | return illegalArgumentObject(handle); |
2652 | |
} |
2653 | |
try { |
2654 | 694 | return ((ModelElement) handle).getNamespace(); |
2655 | 0 | } catch (InvalidObjectException e) { |
2656 | 0 | throw new InvalidElementException(e); |
2657 | |
} |
2658 | |
} |
2659 | |
|
2660 | |
|
2661 | |
public Object getNodeInstance(Object handle) { |
2662 | |
try { |
2663 | 0 | if (handle instanceof ComponentInstance) { |
2664 | 0 | return ((ComponentInstance) handle).getNodeInstance(); |
2665 | |
} |
2666 | 0 | } catch (InvalidObjectException e) { |
2667 | 0 | throw new InvalidElementException(e); |
2668 | 0 | } |
2669 | 0 | return illegalArgumentObject(handle); |
2670 | |
} |
2671 | |
|
2672 | |
|
2673 | |
public Collection getObjectFlowStates(Object handle) { |
2674 | |
try { |
2675 | 0 | if (handle instanceof Classifier) { |
2676 | 0 | return getRefOutermostPackage(handle).getActivityGraphs() |
2677 | |
.getATypeObjectFlowState().getObjectFlowState( |
2678 | |
(Classifier) handle); |
2679 | |
} |
2680 | 0 | } catch (InvalidObjectException e) { |
2681 | 0 | throw new InvalidElementException(e); |
2682 | 0 | } |
2683 | 0 | return illegalArgumentCollection(handle); |
2684 | |
} |
2685 | |
|
2686 | |
|
2687 | |
public Object getOperation(Object handle) { |
2688 | |
try { |
2689 | 0 | if (handle instanceof CallAction) { |
2690 | 0 | return ((CallAction) handle).getOperation(); |
2691 | |
} |
2692 | 0 | if (handle instanceof CallEvent) { |
2693 | 0 | return ((CallEvent) handle).getOperation(); |
2694 | |
} |
2695 | 0 | } catch (InvalidObjectException e) { |
2696 | 0 | throw new InvalidElementException(e); |
2697 | 0 | } |
2698 | 0 | return illegalArgumentObject(handle); |
2699 | |
} |
2700 | |
|
2701 | |
|
2702 | |
public Collection getOccurrences(Object handle) { |
2703 | |
try { |
2704 | 0 | if (handle instanceof Operation) { |
2705 | 0 | return getRefOutermostPackage(handle).getStateMachines() |
2706 | |
.getAOccurrenceOperation().getOccurrence( |
2707 | |
(Operation) handle); |
2708 | |
} |
2709 | 0 | } catch (InvalidObjectException e) { |
2710 | 0 | throw new InvalidElementException(e); |
2711 | 0 | } |
2712 | 0 | return illegalArgumentCollection(handle); |
2713 | |
} |
2714 | |
|
2715 | |
|
2716 | |
public List<Operation> getOperations(Object handle) { |
2717 | 0 | if (!(handle instanceof Classifier)) { |
2718 | 0 | return illegalArgumentList(handle); |
2719 | |
} |
2720 | 0 | List<Operation> result = new ArrayList<Operation>(); |
2721 | |
try { |
2722 | 0 | for (Feature feature : getFeatures(handle)) { |
2723 | 0 | if (feature instanceof Operation) { |
2724 | 0 | result.add((Operation) feature); |
2725 | |
} |
2726 | |
} |
2727 | 0 | } catch (InvalidObjectException e) { |
2728 | 0 | throw new InvalidElementException(e); |
2729 | 0 | } |
2730 | |
|
2731 | 0 | return result; |
2732 | |
} |
2733 | |
|
2734 | |
public List<Feature> getOperationsAndReceptions(Object classifier) { |
2735 | 0 | List<Feature> opsAndReceps = new ArrayList<Feature>(); |
2736 | |
|
2737 | 0 | if (classifier != null) { |
2738 | 0 | for (Feature f : getFeatures(classifier)) { |
2739 | 0 | if (isAOperation(f) || isAReception(f)) { |
2740 | 0 | opsAndReceps.add(f); |
2741 | |
} |
2742 | |
} |
2743 | |
} |
2744 | 0 | return opsAndReceps; |
2745 | |
} |
2746 | |
|
2747 | |
|
2748 | |
public Object getNextEnd(Object handle) { |
2749 | |
try { |
2750 | 0 | if (handle instanceof AssociationEnd) { |
2751 | 0 | List<AssociationEnd> assocEnds = |
2752 | |
(((AssociationEnd) handle).getAssociation()) |
2753 | |
.getConnection(); |
2754 | 0 | int index = assocEnds.indexOf(handle); |
2755 | 0 | if (index == -1 || assocEnds.size() < 2) { |
2756 | 0 | return null; |
2757 | |
} |
2758 | 0 | if (index == assocEnds.size() - 1) { |
2759 | 0 | return assocEnds.get(0); |
2760 | |
} else { |
2761 | 0 | return assocEnds.get(index + 1); |
2762 | |
} |
2763 | |
} |
2764 | 0 | } catch (InvalidObjectException e) { |
2765 | 0 | throw new InvalidElementException(e); |
2766 | 0 | } |
2767 | 0 | return illegalArgumentObject(handle); |
2768 | |
} |
2769 | |
|
2770 | |
|
2771 | |
public Object getOrdering(Object handle) { |
2772 | |
try { |
2773 | 0 | if (handle instanceof AssociationEnd) { |
2774 | 0 | return ((AssociationEnd) handle).getOrdering(); |
2775 | |
} |
2776 | 0 | } catch (InvalidObjectException e) { |
2777 | 0 | throw new InvalidElementException(e); |
2778 | 0 | } |
2779 | 0 | return illegalArgumentObject(handle); |
2780 | |
} |
2781 | |
|
2782 | |
|
2783 | |
public Collection getOutgoings(Object handle) { |
2784 | |
try { |
2785 | 570 | if (isAGuard(handle) || isAAction(handle)) { |
2786 | 0 | return getOutgoings(getTransition(handle)); |
2787 | |
} |
2788 | 570 | if (isAEvent(handle)) { |
2789 | 0 | Iterator trans = getTransitions(handle).iterator(); |
2790 | 0 | Collection outgoings = new ArrayList(); |
2791 | 0 | while (trans.hasNext()) { |
2792 | 0 | outgoings.addAll(getOutgoings(trans.next())); |
2793 | |
} |
2794 | 0 | return outgoings; |
2795 | |
} |
2796 | 570 | if (isAStateVertex(handle)) { |
2797 | 570 | return ((StateVertex) handle).getOutgoing(); |
2798 | |
} |
2799 | |
|
2800 | 0 | if (isATransition(handle)) { |
2801 | 0 | return ((Transition) handle).getTarget().getOutgoing(); |
2802 | |
} |
2803 | 0 | } catch (InvalidObjectException e) { |
2804 | 0 | throw new InvalidElementException(e); |
2805 | 0 | } |
2806 | 0 | return illegalArgumentCollection(handle); |
2807 | |
} |
2808 | |
|
2809 | |
|
2810 | |
public Collection<AssociationEnd> getOtherAssociationEnds(Object handle) { |
2811 | |
try { |
2812 | 0 | if (handle instanceof AssociationEnd) { |
2813 | 0 | UmlAssociation a = ((AssociationEnd) handle).getAssociation(); |
2814 | |
|
2815 | 0 | if (a == null) { |
2816 | 0 | return Collections.emptyList(); |
2817 | |
} |
2818 | |
|
2819 | 0 | Collection<AssociationEnd> allEnds = a.getConnection(); |
2820 | 0 | if (allEnds == null) { |
2821 | 0 | return Collections.emptyList(); |
2822 | |
} |
2823 | |
|
2824 | |
|
2825 | |
|
2826 | 0 | allEnds = new ArrayList<AssociationEnd>(allEnds); |
2827 | 0 | allEnds.remove(handle); |
2828 | 0 | return allEnds; |
2829 | |
} |
2830 | |
|
2831 | 0 | } catch (InvalidObjectException e) { |
2832 | 0 | throw new InvalidElementException(e); |
2833 | 0 | } |
2834 | 0 | return illegalArgumentCollection(handle); |
2835 | |
} |
2836 | |
|
2837 | |
|
2838 | |
public Collection<LinkEnd> getOtherLinkEnds(Object handle) { |
2839 | |
try { |
2840 | 0 | if (handle instanceof LinkEnd) { |
2841 | 0 | Link link = ((LinkEnd) handle).getLink(); |
2842 | |
|
2843 | 0 | if (link == null) { |
2844 | 0 | return Collections.emptyList(); |
2845 | |
} |
2846 | |
|
2847 | 0 | Collection<LinkEnd> allEnds = link.getConnection(); |
2848 | 0 | if (allEnds == null) { |
2849 | 0 | return Collections.emptyList(); |
2850 | |
} |
2851 | |
|
2852 | |
|
2853 | |
|
2854 | 0 | allEnds = new ArrayList<LinkEnd>(allEnds); |
2855 | 0 | allEnds.remove(handle); |
2856 | 0 | return allEnds; |
2857 | |
} |
2858 | 0 | } catch (InvalidObjectException e) { |
2859 | 0 | throw new InvalidElementException(e); |
2860 | 0 | } |
2861 | 0 | return illegalArgumentCollection(handle); |
2862 | |
} |
2863 | |
|
2864 | |
|
2865 | |
public Collection<ModelElement> getOwnedElements(Object handle) { |
2866 | 193909 | if (!(handle instanceof Namespace)) { |
2867 | 0 | return illegalArgumentCollection(handle); |
2868 | |
} |
2869 | |
try { |
2870 | 193909 | return ((Namespace) handle).getOwnedElement(); |
2871 | 0 | } catch (InvalidObjectException e) { |
2872 | 0 | throw new InvalidElementException(e); |
2873 | |
} |
2874 | |
} |
2875 | |
|
2876 | |
|
2877 | |
public boolean isStatic(Object handle) { |
2878 | |
try { |
2879 | 0 | if (handle instanceof Feature) { |
2880 | 0 | return ScopeKindEnum.SK_CLASSIFIER.equals(((Feature) handle) |
2881 | |
.getOwnerScope()); |
2882 | |
} |
2883 | 0 | if (handle instanceof AssociationEnd) { |
2884 | 0 | return ScopeKindEnum.SK_CLASSIFIER |
2885 | |
.equals(((AssociationEnd) handle).getTargetScope()); |
2886 | |
} |
2887 | 0 | throw new IllegalArgumentException(); |
2888 | 0 | } catch (InvalidObjectException e) { |
2889 | 0 | throw new InvalidElementException(e); |
2890 | |
} |
2891 | |
} |
2892 | |
|
2893 | |
|
2894 | |
public Object getPowertype(Object handle) { |
2895 | |
try { |
2896 | 0 | if (handle instanceof Generalization) { |
2897 | 0 | return ((Generalization) handle).getPowertype(); |
2898 | |
} |
2899 | 0 | } catch (InvalidObjectException e) { |
2900 | 0 | throw new InvalidElementException(e); |
2901 | 0 | } |
2902 | 0 | return illegalArgumentObject(handle); |
2903 | |
} |
2904 | |
|
2905 | |
|
2906 | |
public Collection<Generalization> getPowertypeRanges(Object handle) { |
2907 | |
try { |
2908 | 0 | if (handle instanceof Classifier) { |
2909 | 0 | return ((Classifier) handle).getPowertypeRange(); |
2910 | |
} |
2911 | 0 | } catch (InvalidObjectException e) { |
2912 | 0 | throw new InvalidElementException(e); |
2913 | 0 | } |
2914 | 0 | return illegalArgumentCollection(handle); |
2915 | |
} |
2916 | |
|
2917 | |
|
2918 | |
public Collection<Message> getPredecessors(Object handle) { |
2919 | |
try { |
2920 | 0 | if (handle instanceof Message) { |
2921 | |
|
2922 | 0 | return Collections.unmodifiableCollection( |
2923 | |
new ArrayList<Message>( |
2924 | |
((Message) handle).getPredecessor())); |
2925 | |
} |
2926 | 0 | } catch (InvalidObjectException e) { |
2927 | 0 | throw new InvalidElementException(e); |
2928 | 0 | } |
2929 | 0 | return illegalArgumentCollection(handle); |
2930 | |
} |
2931 | |
|
2932 | |
|
2933 | |
public List<Attribute> getQualifiers(Object handle) { |
2934 | |
try { |
2935 | 0 | if (handle instanceof AssociationEnd) { |
2936 | 0 | return ((AssociationEnd) handle).getQualifier(); |
2937 | |
} |
2938 | 0 | } catch (InvalidObjectException e) { |
2939 | 0 | throw new InvalidElementException(e); |
2940 | 0 | } |
2941 | 0 | return illegalArgumentList(handle); |
2942 | |
} |
2943 | |
|
2944 | |
|
2945 | |
public boolean hasReturnParameterDirectionKind(Object handle) { |
2946 | |
try { |
2947 | 0 | if (handle instanceof Parameter) { |
2948 | 0 | Parameter parameter = (Parameter) handle; |
2949 | 0 | return (ParameterDirectionKindEnum.PDK_RETURN.equals(parameter |
2950 | |
.getKind())); |
2951 | |
} |
2952 | 0 | } catch (InvalidObjectException e) { |
2953 | 0 | throw new InvalidElementException(e); |
2954 | 0 | } |
2955 | 0 | return illegalArgumentBoolean(handle); |
2956 | |
} |
2957 | |
|
2958 | |
|
2959 | |
public Object getPackage(Object handle) { |
2960 | |
try { |
2961 | 0 | if (handle instanceof ElementImport) { |
2962 | 0 | return ((ElementImport) handle).getUmlPackage(); |
2963 | |
} |
2964 | 0 | } catch (InvalidObjectException e) { |
2965 | 0 | throw new InvalidElementException(e); |
2966 | 0 | } |
2967 | 0 | return illegalArgumentObject(handle); |
2968 | |
} |
2969 | |
|
2970 | |
|
2971 | |
public Object getParameter(Object handle, int n) { |
2972 | 0 | Collection collection = getParameters(handle); |
2973 | 0 | if (collection instanceof List) { |
2974 | 0 | return ((List) collection).get(n); |
2975 | |
} |
2976 | 0 | return illegalArgumentObject(handle); |
2977 | |
} |
2978 | |
|
2979 | |
|
2980 | |
public Object getParameter(Object handle) { |
2981 | 0 | if (handle instanceof TemplateParameter) { |
2982 | 0 | return ((TemplateParameter) handle).getParameter(); |
2983 | |
} |
2984 | 0 | return illegalArgumentObject(handle); |
2985 | |
} |
2986 | |
|
2987 | |
|
2988 | |
public Collection getParameters(Object handle) { |
2989 | |
try { |
2990 | 0 | if (handle instanceof BehavioralFeature |
2991 | |
|| handle instanceof Event) { |
2992 | 0 | return getParametersList(handle); |
2993 | |
} |
2994 | 0 | if (handle instanceof ObjectFlowState) { |
2995 | 0 | return ((ObjectFlowState) handle).getParameter(); |
2996 | |
} |
2997 | 0 | if (handle instanceof Classifier) { |
2998 | 0 | return getRefOutermostPackage(handle).getCore() |
2999 | |
.getATypedParameterType().getTypedParameter( |
3000 | |
(Classifier) handle); |
3001 | |
} |
3002 | 0 | } catch (InvalidObjectException e) { |
3003 | 0 | throw new InvalidElementException(e); |
3004 | 0 | } |
3005 | 0 | return illegalArgumentCollection(handle); |
3006 | |
} |
3007 | |
|
3008 | |
|
3009 | |
public List<Parameter> getParametersList(Object handle) { |
3010 | |
try { |
3011 | 0 | if (handle instanceof BehavioralFeature) { |
3012 | 0 | return ((BehavioralFeature) handle).getParameter(); |
3013 | |
} |
3014 | 0 | if (handle instanceof Event) { |
3015 | 0 | return ((Event) handle).getParameter(); |
3016 | |
} |
3017 | 0 | } catch (InvalidObjectException e) { |
3018 | 0 | throw new InvalidElementException(e); |
3019 | 0 | } |
3020 | 0 | return illegalArgumentList(handle); |
3021 | |
} |
3022 | |
|
3023 | |
|
3024 | |
public Object getGeneral(Object handle) { |
3025 | |
try { |
3026 | 0 | if (handle instanceof Generalization) { |
3027 | 0 | return ((Generalization) handle).getParent(); |
3028 | |
} |
3029 | 0 | } catch (InvalidObjectException e) { |
3030 | 0 | throw new InvalidElementException(e); |
3031 | 0 | } |
3032 | 0 | return illegalArgumentObject(handle); |
3033 | |
} |
3034 | |
|
3035 | |
|
3036 | |
public Collection getRaisedSignals(Object handle) { |
3037 | 0 | return getRaisedExceptions(handle); |
3038 | |
} |
3039 | |
|
3040 | |
|
3041 | |
|
3042 | |
|
3043 | |
|
3044 | |
|
3045 | |
|
3046 | |
|
3047 | |
public Collection getRaisedExceptions(Object handle) { |
3048 | |
try { |
3049 | 0 | if (handle instanceof BehavioralFeature) { |
3050 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
3051 | |
.getAContextRaisedSignal().getRaisedSignal( |
3052 | |
(BehavioralFeature) handle); |
3053 | |
} |
3054 | 0 | } catch (InvalidObjectException e) { |
3055 | 0 | throw new InvalidElementException(e); |
3056 | 0 | } |
3057 | 0 | return illegalArgumentCollection(handle); |
3058 | |
} |
3059 | |
|
3060 | |
|
3061 | |
public Collection getReceptions(Object handle) { |
3062 | |
try { |
3063 | 0 | if (handle instanceof Signal) { |
3064 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
3065 | |
.getASignalReception().getReception((Signal) handle); |
3066 | |
} |
3067 | 0 | } catch (InvalidObjectException e) { |
3068 | 0 | throw new InvalidElementException(e); |
3069 | 0 | } |
3070 | 0 | return illegalArgumentCollection(handle); |
3071 | |
} |
3072 | |
|
3073 | |
|
3074 | |
public Object getRecurrence(Object handle) { |
3075 | |
try { |
3076 | 0 | if (handle instanceof Action) { |
3077 | 0 | return ((Action) handle).getRecurrence(); |
3078 | |
} |
3079 | 0 | } catch (InvalidObjectException e) { |
3080 | 0 | throw new InvalidElementException(e); |
3081 | 0 | } |
3082 | 0 | return illegalArgumentObject(handle); |
3083 | |
} |
3084 | |
|
3085 | |
|
3086 | |
public Object getRepresentedClassifier(Object handle) { |
3087 | |
try { |
3088 | 38 | if (handle instanceof Collaboration) { |
3089 | 38 | return ((Collaboration) handle).getRepresentedClassifier(); |
3090 | |
} |
3091 | 0 | } catch (InvalidObjectException e) { |
3092 | 0 | throw new InvalidElementException(e); |
3093 | 0 | } |
3094 | 0 | return illegalArgumentObject(handle); |
3095 | |
} |
3096 | |
|
3097 | |
|
3098 | |
public Object getRepresentedOperation(Object handle) { |
3099 | |
try { |
3100 | 38 | if (handle instanceof Collaboration) { |
3101 | 38 | return ((Collaboration) handle).getRepresentedOperation(); |
3102 | |
} |
3103 | 0 | } catch (InvalidObjectException e) { |
3104 | 0 | throw new InvalidElementException(e); |
3105 | 0 | } |
3106 | 0 | return illegalArgumentObject(handle); |
3107 | |
} |
3108 | |
|
3109 | |
|
3110 | |
public Object getScript(Object handle) { |
3111 | |
try { |
3112 | 0 | if (handle instanceof Action) { |
3113 | 0 | return ((Action) handle).getScript(); |
3114 | |
} |
3115 | 0 | } catch (InvalidObjectException e) { |
3116 | 0 | throw new InvalidElementException(e); |
3117 | 0 | } |
3118 | 0 | return illegalArgumentObject(handle); |
3119 | |
} |
3120 | |
|
3121 | |
|
3122 | |
public Object getSender(Object handle) { |
3123 | |
try { |
3124 | 0 | if (handle instanceof Stimulus) { |
3125 | 0 | return ((Stimulus) handle).getSender(); |
3126 | |
} |
3127 | 0 | if (handle instanceof Message) { |
3128 | 0 | return ((Message) handle).getSender(); |
3129 | |
} |
3130 | 0 | } catch (InvalidObjectException e) { |
3131 | 0 | throw new InvalidElementException(e); |
3132 | 0 | } |
3133 | 0 | return illegalArgumentObject(handle); |
3134 | |
} |
3135 | |
|
3136 | |
|
3137 | |
public Object getSignal(Object handle) { |
3138 | |
try { |
3139 | 0 | if (handle instanceof SendAction) { |
3140 | 0 | return ((SendAction) handle).getSignal(); |
3141 | |
} |
3142 | 0 | if (handle instanceof SignalEvent) { |
3143 | 0 | return ((SignalEvent) handle).getSignal(); |
3144 | |
} |
3145 | 0 | if (handle instanceof Reception) { |
3146 | 0 | return ((Reception) handle).getSignal(); |
3147 | |
} |
3148 | 0 | } catch (InvalidObjectException e) { |
3149 | 0 | throw new InvalidElementException(e); |
3150 | 0 | } |
3151 | 0 | return illegalArgumentObject(handle); |
3152 | |
} |
3153 | |
|
3154 | |
|
3155 | |
public Object getResident(Object handle) { |
3156 | |
try { |
3157 | 0 | if (handle instanceof ElementResidence) { |
3158 | 0 | return ((ElementResidence) handle).getResident(); |
3159 | |
} |
3160 | 0 | } catch (InvalidObjectException e) { |
3161 | 0 | throw new InvalidElementException(e); |
3162 | 0 | } |
3163 | 0 | return illegalArgumentObject(handle); |
3164 | |
} |
3165 | |
|
3166 | |
|
3167 | |
public Collection<ElementResidence> getResidentElements(Object handle) { |
3168 | |
try { |
3169 | 0 | if (handle instanceof Component) { |
3170 | 0 | return ((Component) handle).getResidentElement(); |
3171 | |
} |
3172 | 0 | return illegalArgumentCollection(handle); |
3173 | 0 | } catch (InvalidObjectException e) { |
3174 | 0 | throw new InvalidElementException(e); |
3175 | |
} |
3176 | |
} |
3177 | |
|
3178 | |
|
3179 | |
public Collection getResidents(Object handle) { |
3180 | |
try { |
3181 | 0 | if (isANodeInstance(handle)) { |
3182 | 0 | return ((NodeInstance) handle).getResident(); |
3183 | |
} |
3184 | 0 | if (isAComponentInstance(handle)) { |
3185 | 0 | return ((ComponentInstance) handle).getResident(); |
3186 | |
} |
3187 | 0 | if (isAComponent(handle)) { |
3188 | 0 | Collection residents = new ArrayList(); |
3189 | 0 | for (Iterator it = |
3190 | |
((Component) handle).getResidentElement().iterator(); |
3191 | 0 | it.hasNext();) { |
3192 | 0 | residents.add( |
3193 | |
((ElementResidence) it.next()).getResident()); |
3194 | |
} |
3195 | 0 | return residents; |
3196 | |
} |
3197 | 0 | return illegalArgumentCollection(handle); |
3198 | 0 | } catch (InvalidObjectException e) { |
3199 | 0 | throw new InvalidElementException(e); |
3200 | |
} |
3201 | |
} |
3202 | |
|
3203 | |
|
3204 | |
public Object getSource(Object handle) { |
3205 | |
try { |
3206 | 0 | if (isATransition(handle)) { |
3207 | 0 | return ((Transition) handle).getSource(); |
3208 | |
} |
3209 | 0 | } catch (InvalidObjectException e) { |
3210 | 0 | throw new InvalidElementException(e); |
3211 | 0 | } |
3212 | 0 | return illegalArgumentObject(handle); |
3213 | |
} |
3214 | |
|
3215 | |
|
3216 | |
public Collection<ModelElement> getSources(Object handle) { |
3217 | |
try { |
3218 | 0 | if (handle instanceof Flow) { |
3219 | 0 | return ((Flow) handle).getSource(); |
3220 | |
} |
3221 | 0 | return illegalArgumentCollection(handle); |
3222 | 0 | } catch (InvalidObjectException e) { |
3223 | 0 | throw new InvalidElementException(e); |
3224 | |
} |
3225 | |
} |
3226 | |
|
3227 | |
|
3228 | |
public Collection getSourceFlows(Object handle) { |
3229 | |
try { |
3230 | 0 | if (handle instanceof ModelElement) { |
3231 | 0 | return ((ModelElement) handle).getSourceFlow(); |
3232 | |
} |
3233 | 0 | return illegalArgumentCollection(handle); |
3234 | 0 | } catch (InvalidObjectException e) { |
3235 | 0 | throw new InvalidElementException(e); |
3236 | |
} |
3237 | |
} |
3238 | |
|
3239 | |
|
3240 | |
public Collection getSpecializations(Object handle) { |
3241 | 35628 | if (!(handle instanceof GeneralizableElement)) { |
3242 | 0 | return illegalArgumentCollection(handle); |
3243 | |
} |
3244 | |
try { |
3245 | 35628 | return getRefOutermostPackage(handle).getCore() |
3246 | |
.getAParentSpecialization().getSpecialization( |
3247 | |
(GeneralizableElement) handle); |
3248 | 0 | } catch (InvalidObjectException e) { |
3249 | 0 | throw new InvalidElementException(e); |
3250 | |
} |
3251 | |
} |
3252 | |
|
3253 | |
|
3254 | |
public Object getStateMachine(Object handle) { |
3255 | |
try { |
3256 | 2457 | if (handle instanceof State) { |
3257 | 2457 | return ((State) handle).getStateMachine(); |
3258 | |
} |
3259 | 0 | if (handle instanceof Transition) { |
3260 | 0 | return ((Transition) handle).getStateMachine(); |
3261 | |
} |
3262 | 0 | } catch (InvalidObjectException e) { |
3263 | 0 | throw new InvalidElementException(e); |
3264 | 0 | } |
3265 | 0 | return illegalArgumentObject(handle); |
3266 | |
} |
3267 | |
|
3268 | |
|
3269 | |
public Object getState(Object handle) { |
3270 | |
try { |
3271 | 0 | if (handle instanceof Transition) { |
3272 | 0 | return getRefOutermostPackage(handle).getStateMachines() |
3273 | |
.getAStateInternalTransition().getState( |
3274 | |
(Transition) handle); |
3275 | |
} |
3276 | 0 | } catch (InvalidObjectException e) { |
3277 | 0 | throw new InvalidElementException(e); |
3278 | 0 | } |
3279 | 0 | return illegalArgumentObject(handle); |
3280 | |
} |
3281 | |
|
3282 | |
|
3283 | |
public Collection getStates(Object handle) { |
3284 | |
try { |
3285 | 0 | if (handle instanceof Event) { |
3286 | 0 | return getRefOutermostPackage(handle).getStateMachines() |
3287 | |
.getAStateDeferrableEvent().getState((Event) handle); |
3288 | |
} |
3289 | 0 | return illegalArgumentCollection(handle); |
3290 | 0 | } catch (InvalidObjectException e) { |
3291 | 0 | throw new InvalidElementException(e); |
3292 | |
} |
3293 | |
} |
3294 | |
|
3295 | |
|
3296 | |
public Collection getStereotypes(Object handle) { |
3297 | 0 | if (!(handle instanceof ModelElement)) { |
3298 | 0 | return illegalArgumentCollection(handle); |
3299 | |
} |
3300 | |
try { |
3301 | 0 | return ((ModelElement) handle).getStereotype(); |
3302 | 0 | } catch (InvalidObjectException e) { |
3303 | 0 | throw new InvalidElementException(e); |
3304 | |
} |
3305 | |
} |
3306 | |
|
3307 | |
|
3308 | |
public Collection getStimuli(Object handle) { |
3309 | |
try { |
3310 | 0 | if (isALink(handle)) { |
3311 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
3312 | |
.getAStimulusCommunicationLink().getStimulus( |
3313 | |
(Link) handle); |
3314 | |
} |
3315 | 0 | if (isAAction(handle)) { |
3316 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
3317 | |
.getADispatchActionStimulus().getStimulus( |
3318 | |
(Action) handle); |
3319 | |
} |
3320 | 0 | return illegalArgumentCollection(handle); |
3321 | 0 | } catch (InvalidObjectException e) { |
3322 | 0 | throw new InvalidElementException(e); |
3323 | |
} |
3324 | |
} |
3325 | |
|
3326 | |
public Collection getReceivedStimuli(Object handle) { |
3327 | |
try { |
3328 | 0 | if (handle instanceof Instance) { |
3329 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
3330 | |
.getAReceiverStimulus().getStimulus((Instance) handle); |
3331 | |
} |
3332 | 0 | return illegalArgumentCollection(handle); |
3333 | 0 | } catch (InvalidObjectException e) { |
3334 | 0 | throw new InvalidElementException(e); |
3335 | |
} |
3336 | |
} |
3337 | |
|
3338 | |
|
3339 | |
public Collection getSentStimuli(Object handle) { |
3340 | |
try { |
3341 | 0 | if (handle instanceof Instance) { |
3342 | 0 | return getRefOutermostPackage(handle).getCommonBehavior() |
3343 | |
.getAStimulusSender().getStimulus((Instance) handle); |
3344 | |
} |
3345 | 0 | return illegalArgumentCollection(handle); |
3346 | 0 | } catch (InvalidObjectException e) { |
3347 | 0 | throw new InvalidElementException(e); |
3348 | |
} |
3349 | |
} |
3350 | |
|
3351 | |
|
3352 | |
public Collection getSubvertices(Object handle) { |
3353 | |
try { |
3354 | 1888 | if (isACompositeState(handle)) { |
3355 | 1888 | return ((CompositeState) handle).getSubvertex(); |
3356 | |
} |
3357 | 0 | return illegalArgumentCollection(handle); |
3358 | 0 | } catch (InvalidObjectException e) { |
3359 | 0 | throw new InvalidElementException(e); |
3360 | |
} |
3361 | |
} |
3362 | |
|
3363 | |
|
3364 | |
public Object getSubmachine(Object handle) { |
3365 | |
try { |
3366 | 0 | if (handle instanceof SubmachineState) { |
3367 | 0 | return ((SubmachineState) handle).getSubmachine(); |
3368 | |
} |
3369 | 0 | } catch (InvalidObjectException e) { |
3370 | 0 | throw new InvalidElementException(e); |
3371 | 0 | } |
3372 | 0 | return illegalArgumentObject(handle); |
3373 | |
} |
3374 | |
|
3375 | |
|
3376 | |
public Collection getSubmachineStates(Object handle) { |
3377 | |
try { |
3378 | 0 | if (handle instanceof StateMachine) { |
3379 | 0 | return ((StateMachine) handle).getSubmachineState(); |
3380 | |
} |
3381 | 0 | return illegalArgumentCollection(handle); |
3382 | 0 | } catch (InvalidObjectException e) { |
3383 | 0 | throw new InvalidElementException(e); |
3384 | |
} |
3385 | |
} |
3386 | |
|
3387 | |
|
3388 | |
public Collection getSupplierDependencies(Object handle) { |
3389 | |
try { |
3390 | 2 | if (handle instanceof ModelElement) { |
3391 | 2 | return Collections.unmodifiableCollection( |
3392 | |
getRefOutermostPackage(handle) |
3393 | |
.getCore().getASupplierSupplierDependency() |
3394 | |
.getSupplierDependency((ModelElement) handle) |
3395 | |
); |
3396 | |
} |
3397 | 0 | } catch (InvalidObjectException e) { |
3398 | 0 | throw new InvalidElementException(e); |
3399 | 0 | } |
3400 | 0 | return illegalArgumentCollection(handle); |
3401 | |
} |
3402 | |
|
3403 | |
|
3404 | |
public Object getTop(Object handle) { |
3405 | |
try { |
3406 | 2280 | if (handle instanceof StateMachine) { |
3407 | 2280 | return ((StateMachine) handle).getTop(); |
3408 | |
} |
3409 | 0 | } catch (InvalidObjectException e) { |
3410 | 0 | throw new InvalidElementException(e); |
3411 | 0 | } |
3412 | 0 | return illegalArgumentObject(handle); |
3413 | |
} |
3414 | |
|
3415 | |
|
3416 | |
public Object getTransition(Object handle) { |
3417 | |
try { |
3418 | 0 | if (handle instanceof Guard) { |
3419 | 0 | return ((Guard) handle).getTransition(); |
3420 | |
} |
3421 | 0 | if (handle instanceof Action) { |
3422 | 0 | return getRefOutermostPackage(handle).getStateMachines() |
3423 | |
.getATransitionEffect().getTransition((Action) handle); |
3424 | |
} |
3425 | 0 | } catch (InvalidObjectException e) { |
3426 | 0 | throw new InvalidElementException(e); |
3427 | 0 | } |
3428 | 0 | return illegalArgumentObject(handle); |
3429 | |
} |
3430 | |
|
3431 | |
|
3432 | |
public Object getTrigger(Object handle) { |
3433 | |
try { |
3434 | 0 | if (handle instanceof Transition) { |
3435 | 0 | return ((Transition) handle).getTrigger(); |
3436 | |
} |
3437 | 0 | return illegalArgumentObject(handle); |
3438 | 0 | } catch (InvalidObjectException e) { |
3439 | 0 | throw new InvalidElementException(e); |
3440 | |
} |
3441 | |
} |
3442 | |
|
3443 | |
|
3444 | |
public Object getType(Object handle) { |
3445 | |
try { |
3446 | 0 | if (handle instanceof StructuralFeature) { |
3447 | 0 | return ((StructuralFeature) handle).getType(); |
3448 | |
} |
3449 | 0 | if (handle instanceof AssociationEnd) { |
3450 | 0 | return ((AssociationEnd) handle).getParticipant(); |
3451 | |
} |
3452 | 0 | if (handle instanceof Parameter) { |
3453 | 0 | return ((Parameter) handle).getType(); |
3454 | |
} |
3455 | 0 | if (handle instanceof ObjectFlowState) { |
3456 | 0 | return ((ObjectFlowState) handle).getType(); |
3457 | |
} |
3458 | 0 | if (handle instanceof TagDefinition) { |
3459 | 0 | return ((TagDefinition) handle).getTagType(); |
3460 | |
} |
3461 | 0 | if (handle instanceof ClassifierInState) { |
3462 | 0 | return ((ClassifierInState) handle).getType(); |
3463 | |
} |
3464 | 0 | if (handle instanceof TaggedValue) { |
3465 | 0 | return ((TaggedValue) handle).getType(); |
3466 | |
} |
3467 | 0 | } catch (InvalidObjectException e) { |
3468 | 0 | throw new InvalidElementException(e); |
3469 | 0 | } |
3470 | 0 | return illegalArgumentObject(handle); |
3471 | |
|
3472 | |
} |
3473 | |
|
3474 | |
|
3475 | |
public Collection getTypedValues(Object handle) { |
3476 | |
try { |
3477 | 0 | if (handle instanceof TagDefinition) { |
3478 | 0 | return getRefOutermostPackage(handle).getCore() |
3479 | |
.getATypeTypedValue().getTypedValue( |
3480 | |
(TagDefinition) handle); |
3481 | |
} |
3482 | 0 | return illegalArgumentCollection(handle); |
3483 | 0 | } catch (InvalidObjectException e) { |
3484 | 0 | throw new InvalidElementException(e); |
3485 | |
} |
3486 | |
} |
3487 | |
|
3488 | |
|
3489 | |
public Object getTarget(Object handle) { |
3490 | |
try { |
3491 | 0 | if (isATransition(handle)) { |
3492 | 0 | return ((Transition) handle).getTarget(); |
3493 | |
} |
3494 | 0 | } catch (InvalidObjectException e) { |
3495 | 0 | throw new InvalidElementException(e); |
3496 | 0 | } |
3497 | 0 | return illegalArgumentObject(handle); |
3498 | |
} |
3499 | |
|
3500 | |
|
3501 | |
@Deprecated |
3502 | |
public Object getTargetScope(Object handle) { |
3503 | |
try { |
3504 | 0 | if (handle instanceof StructuralFeature) { |
3505 | 0 | return ((StructuralFeature) handle).getTargetScope(); |
3506 | |
} |
3507 | 0 | if (handle instanceof AssociationEnd) { |
3508 | 0 | return ((AssociationEnd) handle).getTargetScope(); |
3509 | |
} |
3510 | 0 | } catch (InvalidObjectException e) { |
3511 | 0 | throw new InvalidElementException(e); |
3512 | 0 | } |
3513 | 0 | return illegalArgumentObject(handle); |
3514 | |
} |
3515 | |
|
3516 | |
|
3517 | |
public Collection getTargetFlows(Object handle) { |
3518 | |
try { |
3519 | 0 | if (handle instanceof ModelElement) { |
3520 | 0 | return ((ModelElement) handle).getTargetFlow(); |
3521 | |
} |
3522 | 0 | return illegalArgumentCollection(handle); |
3523 | 0 | } catch (InvalidObjectException e) { |
3524 | 0 | throw new InvalidElementException(e); |
3525 | |
} |
3526 | |
} |
3527 | |
|
3528 | |
|
3529 | |
public int getUpper(Object handle) { |
3530 | |
try { |
3531 | 0 | if (isAAssociationEnd(handle)) { |
3532 | 0 | int upper = 0; |
3533 | 0 | AssociationEnd end = (AssociationEnd) handle; |
3534 | 0 | if (end.getMultiplicity() != null) { |
3535 | 0 | upper = getUpper(end.getMultiplicity()); |
3536 | |
} |
3537 | 0 | return upper; |
3538 | |
} |
3539 | 0 | if (isAMultiplicity(handle)) { |
3540 | 0 | Multiplicity up = (Multiplicity) handle; |
3541 | 0 | List ranges = new ArrayList(up.getRange()); |
3542 | |
|
3543 | 0 | return getUpper(ranges.get(ranges.size() - 1)); |
3544 | |
} |
3545 | 0 | if (isAMultiplicityRange(handle)) { |
3546 | 0 | MultiplicityRange up = (MultiplicityRange) handle; |
3547 | 0 | return up.getUpper(); |
3548 | |
} |
3549 | 0 | } catch (InvalidObjectException e) { |
3550 | 0 | throw new InvalidElementException(e); |
3551 | 0 | } |
3552 | 0 | illegalArgument(handle); |
3553 | 0 | return 0; |
3554 | |
} |
3555 | |
|
3556 | |
|
3557 | |
public Object getUseCase(Object handle) { |
3558 | |
try { |
3559 | 0 | if (handle instanceof ExtensionPoint) { |
3560 | 0 | return ((ExtensionPoint) handle).getUseCase(); |
3561 | |
} |
3562 | 0 | } catch (InvalidObjectException e) { |
3563 | 0 | throw new InvalidElementException(e); |
3564 | 0 | } |
3565 | 0 | return illegalArgumentObject(handle); |
3566 | |
} |
3567 | |
|
3568 | |
|
3569 | |
public int getLower(Object handle) { |
3570 | |
try { |
3571 | 0 | if (isAAssociationEnd(handle)) { |
3572 | 0 | int lower = 0; |
3573 | 0 | AssociationEnd end = (AssociationEnd) handle; |
3574 | 0 | if (end.getMultiplicity() != null) { |
3575 | 0 | lower = getLower(end.getMultiplicity()); |
3576 | |
} |
3577 | 0 | return lower; |
3578 | |
} |
3579 | 0 | if (isAMultiplicity(handle)) { |
3580 | 0 | Multiplicity low = (Multiplicity) handle; |
3581 | 0 | List ranges = new ArrayList(low.getRange()); |
3582 | |
|
3583 | 0 | return getLower(ranges.get(0)); |
3584 | |
} |
3585 | 0 | if (isAMultiplicityRange(handle)) { |
3586 | 0 | MultiplicityRange low = (MultiplicityRange) handle; |
3587 | 0 | return low.getLower(); |
3588 | |
} |
3589 | 0 | } catch (InvalidObjectException e) { |
3590 | 0 | throw new InvalidElementException(e); |
3591 | 0 | } |
3592 | 0 | illegalArgument(handle); |
3593 | 0 | return 0; |
3594 | |
} |
3595 | |
|
3596 | |
|
3597 | |
public Collection getTransitions(Object handle) { |
3598 | |
try { |
3599 | 573 | if (isAStateMachine(handle)) { |
3600 | 573 | return ((StateMachine) handle).getTransitions(); |
3601 | 0 | } else if (isACompositeState(handle)) { |
3602 | 0 | return ((CompositeState) handle).getInternalTransition(); |
3603 | 0 | } else if (isAEvent(handle)) { |
3604 | 0 | return getRefOutermostPackage(handle).getStateMachines() |
3605 | |
.getATransitionTrigger().getTransition((Event) handle); |
3606 | |
} |
3607 | 0 | return illegalArgumentCollection(handle); |
3608 | 0 | } catch (InvalidObjectException e) { |
3609 | 0 | throw new InvalidElementException(e); |
3610 | |
} |
3611 | |
} |
3612 | |
|
3613 | |
|
3614 | |
public List getStructuralFeatures(Object handle) { |
3615 | 0 | if (!(handle instanceof Classifier)) { |
3616 | 0 | return illegalArgumentList(handle); |
3617 | |
} |
3618 | 0 | List result = new ArrayList(); |
3619 | 0 | Classifier mclassifier = (Classifier) handle; |
3620 | |
|
3621 | |
try { |
3622 | 0 | Iterator features = mclassifier.getFeature().iterator(); |
3623 | 0 | while (features.hasNext()) { |
3624 | 0 | Feature feature = (Feature) features.next(); |
3625 | 0 | if (isAStructuralFeature(feature)) { |
3626 | 0 | result.add(feature); |
3627 | |
} |
3628 | 0 | } |
3629 | 0 | return result; |
3630 | 0 | } catch (InvalidObjectException e) { |
3631 | 0 | throw new InvalidElementException(e); |
3632 | |
} |
3633 | |
} |
3634 | |
|
3635 | |
|
3636 | |
public String getSpecification(Object handle) { |
3637 | |
try { |
3638 | 0 | if (handle instanceof Reception) { |
3639 | 0 | return ((Reception) handle).getSpecification(); |
3640 | |
} |
3641 | 0 | if (handle instanceof Operation) { |
3642 | 0 | return ((Operation) handle).getSpecification(); |
3643 | |
} |
3644 | |
|
3645 | |
|
3646 | |
|
3647 | |
|
3648 | |
|
3649 | |
|
3650 | 0 | } catch (InvalidObjectException e) { |
3651 | 0 | throw new InvalidElementException(e); |
3652 | 0 | } |
3653 | |
|
3654 | 0 | return illegalArgumentString(handle); |
3655 | |
} |
3656 | |
|
3657 | |
|
3658 | |
public Collection getSpecifications(Object handle) { |
3659 | |
try { |
3660 | 0 | if (handle instanceof AssociationEnd) { |
3661 | 0 | return ((AssociationEnd) handle).getSpecification(); |
3662 | |
} |
3663 | 0 | if (handle instanceof Classifier) { |
3664 | 0 | return modelImpl.getCoreHelper().getRealizedInterfaces( |
3665 | |
handle); |
3666 | |
} |
3667 | 0 | return illegalArgumentCollection(handle); |
3668 | 0 | } catch (InvalidObjectException e) { |
3669 | 0 | throw new InvalidElementException(e); |
3670 | |
} |
3671 | |
} |
3672 | |
|
3673 | |
|
3674 | |
public Collection getSuppliers(Object handle) { |
3675 | |
try { |
3676 | 0 | if (handle instanceof Dependency) { |
3677 | 0 | return ((Dependency) handle).getSupplier(); |
3678 | |
} |
3679 | 0 | } catch (InvalidObjectException e) { |
3680 | 0 | throw new InvalidElementException(e); |
3681 | 0 | } |
3682 | 0 | return illegalArgumentCollection(handle); |
3683 | |
} |
3684 | |
|
3685 | |
|
3686 | |
|
3687 | |
|
3688 | |
|
3689 | |
public Object getAction(Object handle) { |
3690 | |
try { |
3691 | 0 | if (handle instanceof Message) { |
3692 | 0 | return getRefOutermostPackage(handle).getCollaborations() |
3693 | |
.getAActionMessage().getAction((Message) handle); |
3694 | |
} |
3695 | 0 | if (handle instanceof Argument) { |
3696 | 0 | return ((Argument) handle).getAction(); |
3697 | |
} |
3698 | 0 | } catch (InvalidObjectException e) { |
3699 | 0 | throw new InvalidElementException(e); |
3700 | 0 | } |
3701 | 0 | return illegalArgumentObject(handle); |
3702 | |
} |
3703 | |
|
3704 | |
|
3705 | |
public List getActions(Object handle) { |
3706 | |
try { |
3707 | 0 | if (handle instanceof ActionSequence) { |
3708 | 0 | return ((ActionSequence) handle).getAction(); |
3709 | |
} |
3710 | 0 | } catch (InvalidObjectException e) { |
3711 | 0 | throw new InvalidElementException(e); |
3712 | 0 | } |
3713 | 0 | return illegalArgumentList(handle); |
3714 | |
} |
3715 | |
|
3716 | |
|
3717 | |
public Object getActionSequence(Object handle) { |
3718 | |
try { |
3719 | 0 | if (handle instanceof Action) { |
3720 | 0 | return ((Action) handle).getActionSequence(); |
3721 | |
} |
3722 | 0 | } catch (InvalidObjectException e) { |
3723 | 0 | throw new InvalidElementException(e); |
3724 | 0 | } |
3725 | 0 | return illegalArgumentList(handle); |
3726 | |
} |
3727 | |
|
3728 | |
|
3729 | |
public Object getActivator(Object handle) { |
3730 | |
try { |
3731 | 0 | if (handle instanceof Message) { |
3732 | 0 | return ((Message) handle).getActivator(); |
3733 | |
} |
3734 | 0 | } catch (InvalidObjectException e) { |
3735 | 0 | throw new InvalidElementException(e); |
3736 | 0 | } |
3737 | 0 | return illegalArgumentObject(handle); |
3738 | |
} |
3739 | |
|
3740 | |
|
3741 | |
public Object getActivityGraph(Object handle) { |
3742 | |
try { |
3743 | 0 | if (handle instanceof Partition) { |
3744 | 0 | return ((Partition) handle).getActivityGraph(); |
3745 | |
} |
3746 | 0 | } catch (InvalidObjectException e) { |
3747 | 0 | throw new InvalidElementException(e); |
3748 | 0 | } |
3749 | 0 | return illegalArgumentObject(handle); |
3750 | |
} |
3751 | |
|
3752 | |
|
3753 | |
public Object getActivity(Object handle) { |
3754 | 0 | throw new NotImplementedException( |
3755 | |
"UML 1.x does not support the model element " |
3756 | |
+ handle.getClass().getName()); |
3757 | |
} |
3758 | |
|
3759 | |
|
3760 | |
public List getActualArguments(Object handle) { |
3761 | |
try { |
3762 | 0 | if (handle instanceof Action) { |
3763 | 0 | return ((Action) handle).getActualArgument(); |
3764 | |
} |
3765 | 0 | return illegalArgumentList(handle); |
3766 | 0 | } catch (InvalidObjectException e) { |
3767 | 0 | throw new InvalidElementException(e); |
3768 | |
} |
3769 | |
} |
3770 | |
|
3771 | |
|
3772 | |
public Object getAddition(Object handle) { |
3773 | |
try { |
3774 | 0 | if (handle instanceof Include) { |
3775 | 0 | return ((Include) handle).getAddition(); |
3776 | |
} |
3777 | 0 | } catch (InvalidObjectException e) { |
3778 | 0 | throw new InvalidElementException(e); |
3779 | 0 | } |
3780 | 0 | return illegalArgumentObject(handle); |
3781 | |
} |
3782 | |
|
3783 | |
|
3784 | |
public Object getAggregation(Object handle) { |
3785 | |
try { |
3786 | 0 | if (handle instanceof AssociationEnd) { |
3787 | 0 | return ((AssociationEnd) handle).getAggregation(); |
3788 | |
} |
3789 | 0 | } catch (InvalidObjectException e) { |
3790 | 0 | throw new InvalidElementException(e); |
3791 | 0 | } |
3792 | 0 | return illegalArgumentObject(handle); |
3793 | |
} |
3794 | |
|
3795 | |
|
3796 | |
public String getAlias(Object handle) { |
3797 | |
try { |
3798 | 0 | if (handle instanceof ElementImport) { |
3799 | 0 | return ((ElementImport) handle).getAlias(); |
3800 | |
} |
3801 | 0 | } catch (InvalidObjectException e) { |
3802 | 0 | throw new InvalidElementException(e); |
3803 | 0 | } |
3804 | 0 | throw new IllegalArgumentException( |
3805 | |
"Must have an MDR element supplied. Received a " |
3806 | |
+ handle.getClass().getName()); |
3807 | |
} |
3808 | |
|
3809 | |
|
3810 | |
public Collection getAssociatedClasses(Object handle) { |
3811 | |
try { |
3812 | 0 | Collection col = new ArrayList(); |
3813 | 0 | if (handle instanceof Classifier) { |
3814 | 0 | Classifier classifier = (Classifier) handle; |
3815 | 0 | Collection ends = getAssociationEnds(classifier); |
3816 | 0 | Iterator it = ends.iterator(); |
3817 | 0 | Set associations = new HashSet(); |
3818 | 0 | while (it.hasNext()) { |
3819 | 0 | AssociationEnd ae = (AssociationEnd) it.next(); |
3820 | 0 | associations.add(ae.getAssociation()); |
3821 | 0 | } |
3822 | 0 | Collection otherEnds = new ArrayList(); |
3823 | 0 | it = associations.iterator(); |
3824 | 0 | while (it.hasNext()) { |
3825 | 0 | otherEnds.addAll(((UmlAssociation) it.next()) |
3826 | |
.getConnection()); |
3827 | |
} |
3828 | 0 | otherEnds.removeAll(ends); |
3829 | 0 | it = otherEnds.iterator(); |
3830 | 0 | while (it.hasNext()) { |
3831 | 0 | col.add(((AssociationEnd) it.next()).getParticipant()); |
3832 | |
} |
3833 | 0 | return col; |
3834 | |
} |
3835 | 0 | } catch (InvalidObjectException e) { |
3836 | 0 | throw new InvalidElementException(e); |
3837 | 0 | } |
3838 | 0 | return illegalArgumentCollection(handle); |
3839 | |
} |
3840 | |
|
3841 | |
|
3842 | |
public String getName(Object handle) { |
3843 | |
try { |
3844 | 220566 | if (handle instanceof OrderingKindEnum) { |
3845 | 0 | return handle.toString().replaceAll("ok_", ""); |
3846 | |
} |
3847 | 220566 | if (handle instanceof CallConcurrencyKindEnum) { |
3848 | 0 | return handle.toString().replaceAll("cck_", ""); |
3849 | |
} |
3850 | 220566 | if (handle instanceof ChangeableKindEnum) { |
3851 | 0 | return handle.toString().replaceAll("ck_", ""); |
3852 | |
} |
3853 | 220566 | if (handle instanceof VisibilityKindEnum) { |
3854 | 0 | return handle.toString().replaceAll("vk_", ""); |
3855 | |
} |
3856 | 220566 | if (handle instanceof AggregationKindEnum) { |
3857 | 0 | return handle.toString().replaceAll("ak_", ""); |
3858 | |
} |
3859 | 220566 | if (handle instanceof ParameterDirectionKindEnum) { |
3860 | 0 | return handle.toString().replaceAll("pdk_", ""); |
3861 | |
} |
3862 | 220566 | if (handle instanceof PseudostateKind) { |
3863 | 0 | return handle.toString().replaceAll("pk_", ""); |
3864 | |
} |
3865 | 220566 | if (handle instanceof ModelElement) { |
3866 | 220566 | ModelElement me = (ModelElement) handle; |
3867 | 220566 | return me.getName(); |
3868 | |
} |
3869 | 0 | if (handle instanceof Multiplicity) { |
3870 | 0 | return modelImpl.getDataTypesHelper().multiplicityToString( |
3871 | |
handle); |
3872 | |
} |
3873 | 0 | if (handle instanceof Expression) { |
3874 | 0 | return ((Expression) handle).getBody(); |
3875 | |
} |
3876 | 0 | if (handle instanceof ElementResidence) { |
3877 | 0 | return ""; |
3878 | |
} |
3879 | 0 | if (handle instanceof TemplateParameter) { |
3880 | 0 | TemplateParameter templateParameter = |
3881 | |
(TemplateParameter) handle; |
3882 | |
|
3883 | 0 | StringBuffer result = new StringBuffer(); |
3884 | 0 | ModelElement template = templateParameter.getTemplate(); |
3885 | 0 | if (template != null) { |
3886 | 0 | String name = template.getName(); |
3887 | 0 | if (name != null) { |
3888 | 0 | result.append(name); |
3889 | |
} |
3890 | |
} |
3891 | 0 | result.append(":"); |
3892 | 0 | ModelElement parameter = templateParameter.getParameter(); |
3893 | 0 | if (parameter != null) { |
3894 | 0 | String name = parameter.getName(); |
3895 | 0 | if (name != null) { |
3896 | 0 | result.append(name); |
3897 | |
} |
3898 | |
} |
3899 | 0 | return ""; |
3900 | |
} |
3901 | |
|
3902 | 0 | } catch (InvalidObjectException e) { |
3903 | 0 | String uuid = getUUID(handle); |
3904 | 0 | if (uuid != null) { |
3905 | 0 | throw new InvalidElementException("UUID: " + uuid, e); |
3906 | |
} else { |
3907 | 0 | throw new InvalidElementException(e); |
3908 | |
} |
3909 | 0 | } |
3910 | 0 | throw new IllegalArgumentException( |
3911 | |
"Must have an MDR element supplied. Received a " |
3912 | |
+ handle.getClass().getName()); |
3913 | |
} |
3914 | |
|
3915 | |
|
3916 | |
public Object getOwner(Object handle) { |
3917 | |
try { |
3918 | 0 | if ((handle instanceof Attribute) |
3919 | |
&& ((Attribute) handle).getAssociationEnd() != null) { |
3920 | 0 | return ((Attribute) handle).getAssociationEnd(); |
3921 | |
} |
3922 | 0 | if (handle instanceof Feature) { |
3923 | 0 | return ((Feature) handle).getOwner(); |
3924 | |
} |
3925 | 0 | if (handle instanceof TagDefinition) { |
3926 | 0 | return ((TagDefinition) handle).getOwner(); |
3927 | |
} |
3928 | 0 | return illegalArgumentObject(handle); |
3929 | 0 | } catch (InvalidObjectException e) { |
3930 | 0 | throw new InvalidElementException(e); |
3931 | |
} |
3932 | |
} |
3933 | |
|
3934 | |
|
3935 | |
public String getTag(Object handle) { |
3936 | |
try { |
3937 | 0 | if (handle instanceof TaggedValue) { |
3938 | 0 | TagDefinition td = ((TaggedValue) handle).getType(); |
3939 | 0 | if (td != null) { |
3940 | 0 | return td.getName(); |
3941 | |
} |
3942 | 0 | return null; |
3943 | |
} |
3944 | 0 | } catch (InvalidObjectException e) { |
3945 | 0 | throw new InvalidElementException(e); |
3946 | 0 | } |
3947 | 0 | return illegalArgumentString(handle); |
3948 | |
} |
3949 | |
|
3950 | |
|
3951 | |
public Iterator getTaggedValues(Object handle) { |
3952 | |
try { |
3953 | 0 | if (handle instanceof ModelElement) { |
3954 | 0 | return getTaggedValuesCollection(handle).iterator(); |
3955 | |
} |
3956 | 0 | } catch (InvalidObjectException e) { |
3957 | 0 | throw new InvalidElementException(e); |
3958 | 0 | } |
3959 | 0 | throw new IllegalArgumentException("Expected a ModelElement. Got a " |
3960 | |
+ handle.getClass().getName()); |
3961 | |
} |
3962 | |
|
3963 | |
|
3964 | |
public Collection getTaggedValuesCollection(Object handle) { |
3965 | |
try { |
3966 | 0 | if (handle instanceof ModelElement) { |
3967 | 0 | return ((ModelElement) handle).getTaggedValue(); |
3968 | |
} |
3969 | 0 | } catch (InvalidObjectException e) { |
3970 | 0 | throw new InvalidElementException(e); |
3971 | 0 | } |
3972 | 0 | return illegalArgumentCollection(handle); |
3973 | |
} |
3974 | |
|
3975 | |
|
3976 | |
public Object getTaggedValue(Object handle, String name) { |
3977 | |
try { |
3978 | 0 | if (handle instanceof ModelElement) { |
3979 | 0 | ModelElement me = ((ModelElement) handle); |
3980 | 0 | Iterator i = me.getTaggedValue().iterator(); |
3981 | 0 | while (i.hasNext()) { |
3982 | 0 | TaggedValue tv = (TaggedValue) i.next(); |
3983 | 0 | if (tv.getType() != null |
3984 | |
&& name.equals(tv.getType().getName())) { |
3985 | 0 | return tv; |
3986 | |
} |
3987 | 0 | } |
3988 | 0 | return null; |
3989 | |
} |
3990 | 0 | } catch (InvalidObjectException e) { |
3991 | 0 | throw new InvalidElementException(e); |
3992 | 0 | } |
3993 | 0 | return illegalArgumentObject(handle); |
3994 | |
} |
3995 | |
|
3996 | |
|
3997 | |
public String getTaggedValueValue(Object handle, String name) { |
3998 | |
try { |
3999 | 0 | Object taggedValue = getTaggedValue(handle, name); |
4000 | 0 | if (taggedValue == null) { |
4001 | 0 | return ""; |
4002 | |
} |
4003 | 0 | return getValueOfTag(taggedValue); |
4004 | 0 | } catch (InvalidObjectException e) { |
4005 | 0 | throw new InvalidElementException(e); |
4006 | |
} |
4007 | |
} |
4008 | |
|
4009 | |
|
4010 | |
public String getTagOfTag(Object handle) { |
4011 | 0 | return getTag(handle); |
4012 | |
} |
4013 | |
|
4014 | |
|
4015 | |
public Object getTagDefinition(Object handle) { |
4016 | |
try { |
4017 | 0 | if (handle instanceof TaggedValue) { |
4018 | 0 | return ((TaggedValue) handle).getType(); |
4019 | |
} |
4020 | 0 | } catch (InvalidObjectException e) { |
4021 | 0 | throw new InvalidElementException(e); |
4022 | 0 | } |
4023 | 0 | return illegalArgumentObject(handle); |
4024 | |
} |
4025 | |
|
4026 | |
|
4027 | |
public Collection getTagDefinitions(Object handle) { |
4028 | |
try { |
4029 | 0 | if (handle instanceof Stereotype) { |
4030 | 0 | return ((Stereotype) handle).getDefinedTag(); |
4031 | |
} |
4032 | 0 | } catch (InvalidObjectException e) { |
4033 | 0 | throw new InvalidElementException(e); |
4034 | 0 | } |
4035 | 0 | return illegalArgumentCollection(handle); |
4036 | |
} |
4037 | |
|
4038 | |
|
4039 | |
public Object getValue(Object handle) { |
4040 | |
try { |
4041 | 0 | if (handle instanceof TaggedValue) { |
4042 | 0 | return getValueOfTag(handle); |
4043 | |
} |
4044 | 0 | if (handle instanceof Argument) { |
4045 | 0 | return ((Argument) handle).getValue(); |
4046 | |
} |
4047 | 0 | if (handle instanceof AttributeLink) { |
4048 | 0 | return ((AttributeLink) handle).getValue(); |
4049 | |
} |
4050 | 0 | if (handle instanceof AggregationKind) { |
4051 | 0 | return Integer.valueOf(((AggregationKind) handle).toString()); |
4052 | |
} |
4053 | 0 | if (handle instanceof OrderingKind) { |
4054 | 0 | return Integer.valueOf(((OrderingKind) handle).toString()); |
4055 | |
} |
4056 | 0 | if (handle instanceof ParameterDirectionKind) { |
4057 | 0 | return Integer.valueOf(((ParameterDirectionKind) handle) |
4058 | |
.toString()); |
4059 | |
} |
4060 | 0 | if (handle instanceof VisibilityKind) { |
4061 | 0 | return Integer.valueOf(((VisibilityKind) handle).toString()); |
4062 | |
} |
4063 | 0 | if (handle instanceof ScopeKind) { |
4064 | 0 | return Integer.valueOf(((ScopeKind) handle).toString()); |
4065 | |
} |
4066 | |
|
4067 | |
|
4068 | |
|
4069 | |
|
4070 | 0 | if (handle instanceof ChangeableKind) { |
4071 | 0 | return Integer.valueOf(((ChangeableKind) handle).toString()); |
4072 | |
} |
4073 | 0 | if (handle instanceof PseudostateKind) { |
4074 | 0 | return Integer.valueOf(((PseudostateKind) handle).toString()); |
4075 | |
} |
4076 | 0 | if (handle instanceof CallConcurrencyKind) { |
4077 | 0 | return Integer.valueOf(((CallConcurrencyKind) handle) |
4078 | |
.toString()); |
4079 | |
} |
4080 | 0 | } catch (InvalidObjectException e) { |
4081 | 0 | throw new InvalidElementException(e); |
4082 | 0 | } |
4083 | 0 | return illegalArgumentObject(handle); |
4084 | |
} |
4085 | |
|
4086 | |
|
4087 | |
public String getValueOfTag(Object handle) { |
4088 | |
try { |
4089 | 0 | if (handle instanceof TaggedValue) { |
4090 | 0 | TaggedValue tv = (TaggedValue) handle; |
4091 | 0 | Collection refValues = tv.getReferenceValue(); |
4092 | 0 | Collection values = tv.getDataValue(); |
4093 | |
|
4094 | 0 | if (values.isEmpty() && refValues.isEmpty()) { |
4095 | 0 | return ""; |
4096 | |
} |
4097 | |
|
4098 | 0 | if (values.size() + refValues.size() > 1) { |
4099 | 0 | LOG.warn("Don't know how to manage multiple values " |
4100 | |
+ "for a TaggedValue, returning first value"); |
4101 | |
} |
4102 | |
|
4103 | |
|
4104 | |
Object value; |
4105 | 0 | if (refValues.size() > 0) { |
4106 | 0 | value = refValues.iterator().next(); |
4107 | |
} else { |
4108 | 0 | value = values.iterator().next(); |
4109 | |
} |
4110 | 0 | if (value instanceof String) { |
4111 | 0 | return (String) value; |
4112 | 0 | } else if (value instanceof EnumerationLiteral) { |
4113 | |
|
4114 | 0 | return ((EnumerationLiteral) value).getName(); |
4115 | |
} else { |
4116 | |
|
4117 | 0 | LOG.warn("Can't handled TaggedValue.dataValues which " |
4118 | |
+ " aren't Strings. Converting to String"); |
4119 | 0 | return value.toString(); |
4120 | |
} |
4121 | |
} |
4122 | 0 | } catch (InvalidObjectException e) { |
4123 | 0 | throw new InvalidElementException(e); |
4124 | 0 | } |
4125 | 0 | return illegalArgumentString(handle); |
4126 | |
} |
4127 | |
|
4128 | |
public Object getValueOfTag(Object handle, Object property) { |
4129 | 0 | throw new NotImplementedException(); |
4130 | |
} |
4131 | |
|
4132 | |
public Collection getReferenceValue(Object taggedValue) { |
4133 | |
try { |
4134 | 0 | if (taggedValue instanceof TaggedValue) { |
4135 | 0 | TaggedValue tv = (TaggedValue) taggedValue; |
4136 | 0 | return tv.getReferenceValue(); |
4137 | |
} |
4138 | 0 | } catch (InvalidObjectException e) { |
4139 | 0 | throw new InvalidElementException(e); |
4140 | 0 | } |
4141 | 0 | return illegalArgumentCollection(taggedValue); |
4142 | |
} |
4143 | |
|
4144 | |
|
4145 | |
public Collection getDataValue(Object taggedValue) { |
4146 | |
try { |
4147 | 0 | if (taggedValue instanceof TaggedValue) { |
4148 | 0 | TaggedValue tv = (TaggedValue) taggedValue; |
4149 | 0 | return tv.getDataValue(); |
4150 | |
} |
4151 | 0 | } catch (InvalidObjectException e) { |
4152 | 0 | throw new InvalidElementException(e); |
4153 | 0 | } |
4154 | 0 | return illegalArgumentCollection(taggedValue); |
4155 | |
} |
4156 | |
|
4157 | |
|
4158 | |
public String getUUID(Object base) { |
4159 | |
try { |
4160 | 1967 | if (base instanceof RefBaseObject) { |
4161 | 1967 | String mofId = ((RefBaseObject) base).refMofId(); |
4162 | |
|
4163 | 1967 | XmiReference ref = ((XmiReference) modelImpl |
4164 | |
.getObjectToId().get(mofId)); |
4165 | 1967 | if (ref == null) { |
4166 | 1967 | return mofId; |
4167 | |
} else { |
4168 | 0 | return ref.getXmiId(); |
4169 | |
} |
4170 | |
} |
4171 | 0 | } catch (InvalidObjectException e) { |
4172 | 0 | throw new InvalidElementException(e); |
4173 | 0 | } |
4174 | 0 | return illegalArgumentString(base); |
4175 | |
} |
4176 | |
|
4177 | |
|
4178 | |
public Object getVisibility(Object handle) { |
4179 | |
try { |
4180 | 0 | if (handle instanceof ModelElement) { |
4181 | 0 | return ((ModelElement) handle).getVisibility(); |
4182 | |
} |
4183 | 0 | if (handle instanceof ElementResidence) { |
4184 | 0 | return ((ElementResidence) handle).getVisibility(); |
4185 | |
} |
4186 | 0 | if (handle instanceof ElementImport) { |
4187 | 0 | return ((ElementImport) handle).getVisibility(); |
4188 | |
} |
4189 | 0 | } catch (InvalidObjectException e) { |
4190 | 0 | throw new InvalidElementException(e); |
4191 | 0 | } |
4192 | 0 | return illegalArgumentObject(handle); |
4193 | |
} |
4194 | |
|
4195 | |
|
4196 | |
public Object getWhen(Object target) { |
4197 | |
try { |
4198 | 0 | if (isATimeEvent(target)) { |
4199 | 0 | return ((TimeEvent) target).getWhen(); |
4200 | |
} |
4201 | 0 | } catch (InvalidObjectException e) { |
4202 | 0 | throw new InvalidElementException(e); |
4203 | 0 | } |
4204 | 0 | return illegalArgumentObject(target); |
4205 | |
} |
4206 | |
|
4207 | |
|
4208 | |
public Object getChangeExpression(Object target) { |
4209 | |
try { |
4210 | 0 | if (isAChangeEvent(target)) { |
4211 | 0 | return ((ChangeEvent) target).getChangeExpression(); |
4212 | |
} |
4213 | 0 | } catch (InvalidObjectException e) { |
4214 | 0 | throw new InvalidElementException(e); |
4215 | 0 | } |
4216 | 0 | return illegalArgumentObject(target); |
4217 | |
} |
4218 | |
|
4219 | |
|
4220 | |
public Collection getPartitions(Object container) { |
4221 | |
try { |
4222 | 0 | if (container instanceof ActivityGraph) { |
4223 | 0 | return ((ActivityGraph) container).getPartition(); |
4224 | |
} |
4225 | 0 | } catch (InvalidObjectException e) { |
4226 | 0 | throw new InvalidElementException(e); |
4227 | 0 | } |
4228 | 0 | return illegalArgumentCollection(container); |
4229 | |
} |
4230 | |
|
4231 | |
|
4232 | |
public String getReferenceState(Object o) { |
4233 | |
try { |
4234 | 0 | if (o instanceof StubState) { |
4235 | 0 | return ((StubState) o).getReferenceState(); |
4236 | |
} |
4237 | 0 | } catch (InvalidObjectException e) { |
4238 | 0 | throw new InvalidElementException(e); |
4239 | 0 | } |
4240 | 0 | return illegalArgumentString(o); |
4241 | |
} |
4242 | |
|
4243 | |
|
4244 | |
public Object lookupIn(Object handle, String name) { |
4245 | |
try { |
4246 | 0 | if (handle instanceof Model) { |
4247 | 0 | return lookup((Model) handle, name); |
4248 | |
} |
4249 | 0 | if (handle instanceof Namespace) { |
4250 | 0 | return lookup((Namespace) handle, name); |
4251 | |
} |
4252 | 0 | if (handle instanceof Classifier) { |
4253 | 0 | return lookup((Classifier) handle, name); |
4254 | |
} |
4255 | 0 | } catch (InvalidObjectException e) { |
4256 | 0 | throw new InvalidElementException(e); |
4257 | 0 | } |
4258 | 0 | return illegalArgumentObject(handle); |
4259 | |
} |
4260 | |
|
4261 | |
private ModelElement lookup(Namespace ns, String name) { |
4262 | |
try { |
4263 | 0 | int idx = name.indexOf("::"); |
4264 | |
|
4265 | 0 | if (idx != -1) { |
4266 | |
String nm; |
4267 | 0 | nm = name.substring(0, idx); |
4268 | 0 | ModelElement e = lookup(ns, nm); |
4269 | 0 | if (e == null || !(e instanceof Namespace)) { |
4270 | 0 | return null; |
4271 | |
} |
4272 | 0 | Namespace n = (Namespace) e; |
4273 | 0 | nm = name.substring(idx + 2); |
4274 | 0 | return lookup(n, nm); |
4275 | |
} |
4276 | 0 | Iterator i = ns.getOwnedElement().iterator(); |
4277 | 0 | while (i.hasNext()) { |
4278 | 0 | ModelElement e = (ModelElement) i.next(); |
4279 | 0 | if (name.equals(e.getName())) { |
4280 | 0 | return e; |
4281 | |
} |
4282 | 0 | } |
4283 | 0 | } catch (InvalidObjectException e) { |
4284 | 0 | throw new InvalidElementException(e); |
4285 | 0 | } |
4286 | 0 | return null; |
4287 | |
} |
4288 | |
|
4289 | |
|
4290 | |
public String toString(Object modelElement) { |
4291 | |
try { |
4292 | 0 | if (modelElement instanceof Multiplicity) { |
4293 | 0 | return org.argouml.model.Model.getDataTypesHelper() |
4294 | |
.multiplicityToString(modelElement); |
4295 | 0 | } else if (modelElement instanceof Expression) { |
4296 | 0 | Expression exp = (Expression) modelElement; |
4297 | 0 | String result = getUMLClassName(modelElement); |
4298 | 0 | String language = exp.getLanguage(); |
4299 | 0 | String body = exp.getBody(); |
4300 | |
|
4301 | 0 | if (language != null && language.length() > 0) { |
4302 | 0 | result += " (" + language + ")"; |
4303 | |
} |
4304 | 0 | if (body != null && body.length() > 0) { |
4305 | 0 | result += ": " + body; |
4306 | |
} |
4307 | 0 | return result; |
4308 | 0 | } else if (modelElement instanceof ElementImport) { |
4309 | 0 | ElementImport ei = (ElementImport) modelElement; |
4310 | 0 | ModelElement me = ei.getImportedElement(); |
4311 | 0 | String typeName = getUMLClassName(me); |
4312 | 0 | String elemName = toString(me); |
4313 | 0 | String alias = ei.getAlias(); |
4314 | 0 | if (alias != null && alias.length() > 0) { |
4315 | |
|
4316 | |
|
4317 | |
|
4318 | |
|
4319 | |
|
4320 | |
|
4321 | 0 | return "Imported " + typeName + ": " + elemName + " alias " |
4322 | |
+ alias; |
4323 | |
} else { |
4324 | |
|
4325 | |
|
4326 | |
|
4327 | |
|
4328 | 0 | return "Imported " + typeName + ": " + elemName; |
4329 | |
} |
4330 | 0 | } else if (isAUMLElement(modelElement)) { |
4331 | 0 | return getUMLClassName(modelElement) + ": " |
4332 | |
+ getName(modelElement); |
4333 | 0 | } else if (modelElement == null) { |
4334 | 0 | return ""; |
4335 | |
} |
4336 | 0 | } catch (InvalidObjectException e) { |
4337 | 0 | throw new InvalidElementException(e); |
4338 | 0 | } |
4339 | 0 | return modelElement.toString(); |
4340 | |
} |
4341 | |
|
4342 | |
public String getUMLClassName(Object handle) { |
4343 | 9920 | if (!isAUMLElement(handle)) { |
4344 | 0 | return illegalArgumentString(handle); |
4345 | |
} |
4346 | |
try { |
4347 | 9920 | return modelImpl.getMetaTypes().getName(handle); |
4348 | 0 | } catch (InvalidObjectException e) { |
4349 | 0 | throw new InvalidElementException(e); |
4350 | |
} |
4351 | |
} |
4352 | |
|
4353 | |
|
4354 | |
|
4355 | |
|
4356 | |
|
4357 | |
|
4358 | |
|
4359 | |
|
4360 | |
|
4361 | |
private Object illegalArgumentObject(Object arg) { |
4362 | 0 | illegalArgument(arg); |
4363 | 0 | return null; |
4364 | |
} |
4365 | |
|
4366 | |
|
4367 | |
|
4368 | |
|
4369 | |
|
4370 | |
|
4371 | |
|
4372 | |
|
4373 | |
|
4374 | |
private String illegalArgumentString(Object arg) { |
4375 | 0 | illegalArgument(arg); |
4376 | 0 | return null; |
4377 | |
} |
4378 | |
|
4379 | |
|
4380 | |
|
4381 | |
|
4382 | |
|
4383 | |
|
4384 | |
|
4385 | |
|
4386 | |
private void illegalArgument(Object arg) { |
4387 | 0 | throw new IllegalArgumentException("Unrecognized object " |
4388 | |
+ getClassNull(arg)); |
4389 | |
} |
4390 | |
|
4391 | |
|
4392 | |
|
4393 | |
|
4394 | |
|
4395 | |
|
4396 | |
protected String getClassNull(Object handle) { |
4397 | 0 | if (handle == null) { |
4398 | 0 | return "[null]"; |
4399 | |
} |
4400 | 0 | return "[" + handle + "/" + handle.getClass() + "]"; |
4401 | |
} |
4402 | |
|
4403 | |
|
4404 | |
public String getTipString(Object modelElement) { |
4405 | 0 | return getUMLClassName(modelElement) + ": " + getName(modelElement); |
4406 | |
} |
4407 | |
|
4408 | |
|
4409 | |
|
4410 | |
|
4411 | |
|
4412 | |
|
4413 | |
|
4414 | |
|
4415 | |
|
4416 | |
private Collection illegalArgumentCollection(Object arg) { |
4417 | 0 | illegalArgument(arg); |
4418 | 0 | return null; |
4419 | |
} |
4420 | |
|
4421 | |
|
4422 | |
|
4423 | |
|
4424 | |
|
4425 | |
|
4426 | |
|
4427 | |
|
4428 | |
|
4429 | |
private List illegalArgumentList(Object arg) { |
4430 | 0 | illegalArgument(arg); |
4431 | 0 | return null; |
4432 | |
} |
4433 | |
|
4434 | |
|
4435 | |
|
4436 | |
|
4437 | |
|
4438 | |
|
4439 | |
|
4440 | |
|
4441 | |
|
4442 | |
private boolean illegalArgumentBoolean(Object arg) { |
4443 | 0 | illegalArgument(arg); |
4444 | 0 | return false; |
4445 | |
} |
4446 | |
|
4447 | |
|
4448 | |
|
4449 | |
|
4450 | |
|
4451 | |
|
4452 | |
|
4453 | |
|
4454 | |
|
4455 | |
private int illegalArgumentInt(Object arg) { |
4456 | 0 | illegalArgument(arg); |
4457 | 0 | return 0; |
4458 | |
} |
4459 | |
|
4460 | |
public boolean isATagDefinition(Object handle) { |
4461 | 0 | return handle instanceof TagDefinition; |
4462 | |
} |
4463 | |
|
4464 | |
public List getEnumerationLiterals(Object handle) { |
4465 | |
try { |
4466 | 0 | if (!isAEnumeration(handle)) { |
4467 | 0 | throw new IllegalArgumentException("handle: " + handle); |
4468 | |
} |
4469 | 0 | return ((Enumeration) handle).getLiteral(); |
4470 | 0 | } catch (InvalidObjectException e) { |
4471 | 0 | throw new InvalidElementException(e); |
4472 | |
} |
4473 | |
} |
4474 | |
|
4475 | |
public boolean isAEnumeration(Object handle) { |
4476 | 117853 | return handle instanceof Enumeration; |
4477 | |
} |
4478 | |
|
4479 | |
public boolean isAEnumerationLiteral(Object handle) { |
4480 | 93914 | return handle instanceof EnumerationLiteral; |
4481 | |
} |
4482 | |
|
4483 | |
public List getArguments(Object handle) { |
4484 | |
try { |
4485 | 0 | if (handle instanceof Binding) { |
4486 | 0 | return ((Binding) handle).getArgument(); |
4487 | 0 | } else if (handle instanceof Action) { |
4488 | 0 | return ((Action) handle).getActualArgument(); |
4489 | |
} |
4490 | 0 | } catch (InvalidObjectException e) { |
4491 | 0 | throw new InvalidElementException(e); |
4492 | 0 | } |
4493 | 0 | return illegalArgumentList(handle); |
4494 | |
} |
4495 | |
|
4496 | |
public Object getBinding(Object handle) { |
4497 | |
try { |
4498 | 0 | if (handle instanceof TemplateArgument) { |
4499 | 0 | return ((TemplateArgument) handle).getBinding(); |
4500 | |
} |
4501 | 0 | } catch (InvalidObjectException e) { |
4502 | 0 | throw new InvalidElementException(e); |
4503 | 0 | } |
4504 | 0 | return illegalArgumentObject(handle); |
4505 | |
} |
4506 | |
|
4507 | |
public Object getDefaultElement(Object handle) { |
4508 | |
try { |
4509 | 0 | if (handle instanceof TemplateParameter) { |
4510 | 0 | return ((TemplateParameter) handle).getDefaultElement(); |
4511 | |
} |
4512 | 0 | } catch (InvalidObjectException e) { |
4513 | 0 | throw new InvalidElementException(e); |
4514 | 0 | } |
4515 | 0 | return illegalArgumentObject(handle); |
4516 | |
} |
4517 | |
|
4518 | |
public Object getTemplate(Object handle) { |
4519 | |
try { |
4520 | 0 | if (handle instanceof TemplateParameter) { |
4521 | 0 | return ((TemplateParameter) handle).getTemplate(); |
4522 | |
} |
4523 | 0 | } catch (InvalidObjectException e) { |
4524 | 0 | throw new InvalidElementException(e); |
4525 | 0 | } |
4526 | 0 | return illegalArgumentObject(handle); |
4527 | |
} |
4528 | |
|
4529 | |
public List getTemplateParameters(Object handle) { |
4530 | |
try { |
4531 | 0 | if (handle instanceof ModelElement) { |
4532 | 0 | return ((ModelElement) handle).getTemplateParameter(); |
4533 | |
} |
4534 | 0 | } catch (InvalidObjectException e) { |
4535 | 0 | throw new InvalidElementException(e); |
4536 | 0 | } |
4537 | 0 | return illegalArgumentList(handle); |
4538 | |
} |
4539 | |
|
4540 | |
public boolean isSynch(Object handle) { |
4541 | |
try { |
4542 | 0 | return ((ObjectFlowState) handle).isSynch(); |
4543 | 0 | } catch (InvalidObjectException e) { |
4544 | 0 | throw new InvalidElementException(e); |
4545 | 0 | } catch (ClassCastException e) { |
4546 | 0 | throw new IllegalArgumentException(e); |
4547 | |
} |
4548 | |
} |
4549 | |
|
4550 | |
|
4551 | |
public String[] getMetatypeNames() { |
4552 | |
|
4553 | 0 | Collection<MofClass> metaTypes = getMetaClasses(); |
4554 | 0 | String[] names = new String[metaTypes.size()]; |
4555 | 0 | int i = 0; |
4556 | 0 | for (MofClass mofClass : metaTypes) { |
4557 | |
|
4558 | 0 | names[i++] = mofClass.getName(); |
4559 | |
} |
4560 | 0 | return names; |
4561 | |
} |
4562 | |
|
4563 | |
Collection<MofClass> getMetaClasses() { |
4564 | 8078 | Collection<MofClass> metaTypes = modelImpl.getModelPackage() |
4565 | |
.getMofClass().refAllOfClass(); |
4566 | 8078 | return metaTypes; |
4567 | |
} |
4568 | |
|
4569 | |
public boolean isA(String metatypeName, Object element) { |
4570 | 106875 | MofClass metaObject = (MofClass) ((RefObject) element).refMetaObject(); |
4571 | 106875 | return metatypeName != null |
4572 | |
&& metatypeName.equals(metaObject.getName()); |
4573 | |
} |
4574 | |
|
4575 | |
MofClass getMofClass(String metatypeName) { |
4576 | 4039 | Collection<MofClass> metaTypes = getMetaClasses(); |
4577 | 4039 | for (MofClass mofClass : metaTypes) { |
4578 | |
|
4579 | |
|
4580 | 339009 | if (metatypeName.equals(mofClass.getName())) { |
4581 | 4039 | return mofClass; |
4582 | |
} |
4583 | |
} |
4584 | 0 | return null; |
4585 | |
} |
4586 | |
|
4587 | |
RefClass getProxy(String metatypeName, RefPackage extent) { |
4588 | 4039 | Collection<MofClass> metaTypes = getMetaClasses(); |
4589 | 4039 | MofClass mofClass = getMofClass(metatypeName); |
4590 | 4039 | List<String> names = mofClass.getQualifiedName(); |
4591 | |
|
4592 | |
|
4593 | |
|
4594 | 4039 | RefPackage pkg = extent.refPackage(names.get(0)); |
4595 | |
|
4596 | 4039 | return pkg.refClass(names.get(1)); |
4597 | |
} |
4598 | |
|
4599 | |
|
4600 | |
public Collection getTargets(Object handle) { |
4601 | 0 | return illegalArgumentCollection(handle); |
4602 | |
} |
4603 | |
|
4604 | |
public boolean isADirectedRelationship(Object handle) { |
4605 | 0 | return false; |
4606 | |
} |
4607 | |
} |