1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 |
|
---|
15 | package de.ugoe.cs.autoquest.plugin.uml.eventcore;
|
---|
16 |
|
---|
17 | import org.eclipse.uml2.uml.Transition;
|
---|
18 |
|
---|
19 | import de.ugoe.cs.autoquest.eventcore.IEventType;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * <p>
|
---|
23 | * Event type for transitions in UML sequence diagrams
|
---|
24 | * </p>
|
---|
25 | *
|
---|
26 | * @author Steffen Herbold
|
---|
27 | */
|
---|
28 | public class UMLTransitionType implements IEventType {
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Id for object serialization.
|
---|
32 | */
|
---|
33 | private static final long serialVersionUID = 1L;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * associated UML transition
|
---|
37 | */
|
---|
38 | private final Transition transition;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * <p>
|
---|
42 | * Constructor. Creates a new instance.
|
---|
43 | * </p>
|
---|
44 | *
|
---|
45 | * @param transition
|
---|
46 | * the instance
|
---|
47 | */
|
---|
48 | public UMLTransitionType(Transition transition) {
|
---|
49 | if (transition == null) {
|
---|
50 | throw new IllegalArgumentException("Transition must not be null");
|
---|
51 | }
|
---|
52 | this.transition = transition;
|
---|
53 | }
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * <p>
|
---|
57 | * Returns the associated UML element
|
---|
58 | * </p>
|
---|
59 | *
|
---|
60 | * @return
|
---|
61 | */
|
---|
62 | public Transition getTransition() {
|
---|
63 | return transition;
|
---|
64 | }
|
---|
65 |
|
---|
66 | /*
|
---|
67 | * (non-Javadoc)
|
---|
68 | *
|
---|
69 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
70 | */
|
---|
71 | @Override
|
---|
72 | public boolean equals(Object other) {
|
---|
73 | if (other == this) {
|
---|
74 | return true;
|
---|
75 | }
|
---|
76 | if (other instanceof UMLTransitionType) {
|
---|
77 | return ((UMLTransitionType) other).transition.equals(transition);
|
---|
78 | }
|
---|
79 | return false;
|
---|
80 | };
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * (non-Javadoc)
|
---|
84 | *
|
---|
85 | * @see java.lang.Object#hashCode()
|
---|
86 | */
|
---|
87 | @Override
|
---|
88 | public int hashCode() {
|
---|
89 | return transition.hashCode();
|
---|
90 | }
|
---|
91 |
|
---|
92 | /*
|
---|
93 | * (non-Javadoc)
|
---|
94 | *
|
---|
95 | * @see de.ugoe.cs.autoquest.eventcore.IEventType#getName()
|
---|
96 | */
|
---|
97 | @Override
|
---|
98 | public String getName() {
|
---|
99 | return transition.getName();
|
---|
100 | }
|
---|
101 |
|
---|
102 | }
|
---|