0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.s60tools.imaker.internal.model.iContent.util;
|
|
18 |
|
|
19 |
import com.nokia.s60tools.imaker.internal.model.iContent.*;
|
|
20 |
|
|
21 |
import java.util.List;
|
|
22 |
|
|
23 |
import org.eclipse.emf.ecore.EClass;
|
|
24 |
import org.eclipse.emf.ecore.EObject;
|
|
25 |
|
|
26 |
/**
|
|
27 |
* <!-- begin-user-doc -->
|
|
28 |
* The <b>Switch</b> for the model's inheritance hierarchy.
|
|
29 |
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
|
|
30 |
* to invoke the <code>caseXXX</code> method for each class of the model,
|
|
31 |
* starting with the actual class of the object
|
|
32 |
* and proceeding up the inheritance hierarchy
|
|
33 |
* until a non-null result is returned,
|
|
34 |
* which is the result of the switch.
|
|
35 |
* <!-- end-user-doc -->
|
|
36 |
* @see com.nokia.s60tools.imaker.internal.model.iContent.IContentPackage
|
|
37 |
* @generated
|
|
38 |
*/
|
|
39 |
public class IContentSwitch<T> {
|
|
40 |
/**
|
|
41 |
* The cached model package
|
|
42 |
* <!-- begin-user-doc -->
|
|
43 |
* <!-- end-user-doc -->
|
|
44 |
* @generated
|
|
45 |
*/
|
|
46 |
protected static IContentPackage modelPackage;
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Creates an instance of the switch.
|
|
50 |
* <!-- begin-user-doc -->
|
|
51 |
* <!-- end-user-doc -->
|
|
52 |
* @generated
|
|
53 |
*/
|
|
54 |
public IContentSwitch() {
|
|
55 |
if (modelPackage == null) {
|
|
56 |
modelPackage = IContentPackage.eINSTANCE;
|
|
57 |
}
|
|
58 |
}
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
|
|
62 |
* <!-- begin-user-doc -->
|
|
63 |
* <!-- end-user-doc -->
|
|
64 |
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
|
65 |
* @generated
|
|
66 |
*/
|
|
67 |
public T doSwitch(EObject theEObject) {
|
|
68 |
return doSwitch(theEObject.eClass(), theEObject);
|
|
69 |
}
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
|
|
73 |
* <!-- begin-user-doc -->
|
|
74 |
* <!-- end-user-doc -->
|
|
75 |
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
|
76 |
* @generated
|
|
77 |
*/
|
|
78 |
protected T doSwitch(EClass theEClass, EObject theEObject) {
|
|
79 |
if (theEClass.eContainer() == modelPackage) {
|
|
80 |
return doSwitch(theEClass.getClassifierID(), theEObject);
|
|
81 |
}
|
|
82 |
else {
|
|
83 |
List<EClass> eSuperTypes = theEClass.getESuperTypes();
|
|
84 |
return
|
|
85 |
eSuperTypes.isEmpty() ?
|
|
86 |
defaultCase(theEObject) :
|
|
87 |
doSwitch(eSuperTypes.get(0), theEObject);
|
|
88 |
}
|
|
89 |
}
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
|
|
93 |
* <!-- begin-user-doc -->
|
|
94 |
* <!-- end-user-doc -->
|
|
95 |
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
|
96 |
* @generated
|
|
97 |
*/
|
|
98 |
protected T doSwitch(int classifierID, EObject theEObject) {
|
|
99 |
switch (classifierID) {
|
|
100 |
case IContentPackage.IMAGE_CONTENT: {
|
|
101 |
ImageContent imageContent = (ImageContent)theEObject;
|
|
102 |
T result = caseImageContent(imageContent);
|
|
103 |
if (result == null) result = defaultCase(theEObject);
|
|
104 |
return result;
|
|
105 |
}
|
|
106 |
case IContentPackage.IBY_ENTRY: {
|
|
107 |
IbyEntry ibyEntry = (IbyEntry)theEObject;
|
|
108 |
T result = caseIbyEntry(ibyEntry);
|
|
109 |
if (result == null) result = defaultCase(theEObject);
|
|
110 |
return result;
|
|
111 |
}
|
|
112 |
default: return defaultCase(theEObject);
|
|
113 |
}
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Returns the result of interpreting the object as an instance of '<em>Image Content</em>'.
|
|
118 |
* <!-- begin-user-doc -->
|
|
119 |
* This implementation returns null;
|
|
120 |
* returning a non-null result will terminate the switch.
|
|
121 |
* <!-- end-user-doc -->
|
|
122 |
* @param object the target of the switch.
|
|
123 |
* @return the result of interpreting the object as an instance of '<em>Image Content</em>'.
|
|
124 |
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
|
125 |
* @generated
|
|
126 |
*/
|
|
127 |
public T caseImageContent(ImageContent object) {
|
|
128 |
return null;
|
|
129 |
}
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Returns the result of interpreting the object as an instance of '<em>Iby Entry</em>'.
|
|
133 |
* <!-- begin-user-doc -->
|
|
134 |
* This implementation returns null;
|
|
135 |
* returning a non-null result will terminate the switch.
|
|
136 |
* <!-- end-user-doc -->
|
|
137 |
* @param object the target of the switch.
|
|
138 |
* @return the result of interpreting the object as an instance of '<em>Iby Entry</em>'.
|
|
139 |
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
|
140 |
* @generated
|
|
141 |
*/
|
|
142 |
public T caseIbyEntry(IbyEntry object) {
|
|
143 |
return null;
|
|
144 |
}
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
|
|
148 |
* <!-- begin-user-doc -->
|
|
149 |
* This implementation returns null;
|
|
150 |
* returning a non-null result will terminate the switch, but this is the last case anyway.
|
|
151 |
* <!-- end-user-doc -->
|
|
152 |
* @param object the target of the switch.
|
|
153 |
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
|
|
154 |
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
|
|
155 |
* @generated
|
|
156 |
*/
|
|
157 |
public T defaultCase(EObject object) {
|
|
158 |
return null;
|
|
159 |
}
|
|
160 |
|
|
161 |
} //IContentSwitch
|