[1624] | 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 |
|
---|
[1604] | 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 |
|
---|
[1624] | 21 | /**
|
---|
| 22 | * <p>
|
---|
| 23 | * Event type for transitions in UML sequence diagrams
|
---|
| 24 | * </p>
|
---|
| 25 | *
|
---|
| 26 | * @author Steffen Herbold
|
---|
| 27 | */
|
---|
[1604] | 28 | public class UMLTransitionType implements IEventType {
|
---|
| 29 |
|
---|
[1624] | 30 | /**
|
---|
| 31 | * Id for object serialization.
|
---|
| 32 | */
|
---|
[1604] | 33 | private static final long serialVersionUID = 1L;
|
---|
[1624] | 34 |
|
---|
| 35 | /**
|
---|
| 36 | * associated UML transition
|
---|
| 37 | */
|
---|
[1604] | 38 | private final Transition transition;
|
---|
[1624] | 39 |
|
---|
| 40 | /**
|
---|
| 41 | * <p>
|
---|
| 42 | * Constructor. Creates a new instance.
|
---|
| 43 | * </p>
|
---|
| 44 | *
|
---|
| 45 | * @param transition
|
---|
| 46 | * the instance
|
---|
| 47 | */
|
---|
[1604] | 48 | public UMLTransitionType(Transition transition) {
|
---|
[1624] | 49 | if (transition == null) {
|
---|
| 50 | throw new IllegalArgumentException("Transition must not be null");
|
---|
| 51 | }
|
---|
[1604] | 52 | this.transition = transition;
|
---|
| 53 | }
|
---|
[1624] | 54 |
|
---|
| 55 | /**
|
---|
| 56 | * <p>
|
---|
| 57 | * Returns the associated UML element
|
---|
| 58 | * </p>
|
---|
| 59 | *
|
---|
| 60 | * @return
|
---|
| 61 | */
|
---|
[1604] | 62 | public Transition getTransition() {
|
---|
| 63 | return transition;
|
---|
| 64 | }
|
---|
[1624] | 65 |
|
---|
| 66 | /*
|
---|
| 67 | * (non-Javadoc)
|
---|
| 68 | *
|
---|
| 69 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
| 70 | */
|
---|
[1604] | 71 | @Override
|
---|
| 72 | public boolean equals(Object other) {
|
---|
[1624] | 73 | if (other == this) {
|
---|
[1604] | 74 | return true;
|
---|
| 75 | }
|
---|
[1624] | 76 | if (other instanceof UMLTransitionType) {
|
---|
[1604] | 77 | return ((UMLTransitionType) other).transition.equals(transition);
|
---|
| 78 | }
|
---|
| 79 | return false;
|
---|
| 80 | };
|
---|
[1624] | 81 |
|
---|
| 82 | /*
|
---|
| 83 | * (non-Javadoc)
|
---|
| 84 | *
|
---|
| 85 | * @see java.lang.Object#hashCode()
|
---|
| 86 | */
|
---|
[1604] | 87 | @Override
|
---|
| 88 | public int hashCode() {
|
---|
| 89 | return transition.hashCode();
|
---|
| 90 | }
|
---|
[1624] | 91 |
|
---|
| 92 | /*
|
---|
| 93 | * (non-Javadoc)
|
---|
| 94 | *
|
---|
| 95 | * @see de.ugoe.cs.autoquest.eventcore.IEventType#getName()
|
---|
| 96 | */
|
---|
[1604] | 97 | @Override
|
---|
| 98 | public String getName() {
|
---|
[1624] | 99 | return transition.getName();
|
---|
[1604] | 100 | }
|
---|
| 101 |
|
---|
| 102 | }
|
---|