Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLSwitch.java')
-rw-r--r--plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLSwitch.java43
1 files changed, 15 insertions, 28 deletions
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLSwitch.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLSwitch.java
index 563be13c..5dac305a 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLSwitch.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLSwitch.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2009 IBM Corporation, Embarcadero Technologies, and others.
+ * Copyright (c) 2005, 2010 IBM Corporation, Embarcadero Technologies, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,17 +8,17 @@
* Contributors:
* IBM - initial API and implementation
* Kenn Hussey (Embarcadero Technologies) - 205188
+ * Kenn Hussey - 323181
*
- * $Id: UMLSwitch.java,v 1.19 2009/02/27 18:37:53 jbruck Exp $
+ * $Id: UMLSwitch.java,v 1.20 2011/01/21 01:17:37 khussey Exp $
*/
package org.eclipse.uml2.uml.util;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.Switch;
import org.eclipse.uml2.uml.Abstraction;
import org.eclipse.uml2.uml.AcceptCallAction;
import org.eclipse.uml2.uml.AcceptEventAction;
@@ -279,7 +279,8 @@ import org.eclipse.uml2.uml.WriteVariableAction;
* @see org.eclipse.uml2.uml.UMLPackage
* @generated
*/
-public class UMLSwitch<T> {
+public class UMLSwitch<T>
+ extends Switch<T> {
/**
* The cached model package
@@ -302,32 +303,16 @@ public class UMLSwitch<T> {
}
/**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * Checks whether this is a switch for the given package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
* @generated
*/
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- } else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty()
- ? defaultCase(theEObject)
- : doSwitch(eSuperTypes.get(0), theEObject);
- }
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
}
/**
@@ -337,6 +322,7 @@ public class UMLSwitch<T> {
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
+ @Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case UMLPackage.COMMENT : {
@@ -9232,6 +9218,7 @@ public class UMLSwitch<T> {
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
+ @Override
public T defaultCase(EObject object) {
return null;
}

Back to the top