001/** 002 * ****************************************************************************** 003 * Copyright (c) 2018 Red Hat Inc 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * * 009 * Contributors: 010 * Jens Reimann - initial API and implementation 011 * ****************************************************************************** 012 */ 013package de.dentrassi.varlink.idl.varlinkIdl.util; 014 015import de.dentrassi.varlink.idl.varlinkIdl.Arguments; 016import de.dentrassi.varlink.idl.varlinkIdl.Array; 017import de.dentrassi.varlink.idl.varlinkIdl.BasicType; 018import de.dentrassi.varlink.idl.varlinkIdl.Dictionary; 019import de.dentrassi.varlink.idl.varlinkIdl.ElementType; 020import de.dentrassi.varlink.idl.varlinkIdl.Field; 021import de.dentrassi.varlink.idl.varlinkIdl.Interface; 022import de.dentrassi.varlink.idl.varlinkIdl.Member; 023import de.dentrassi.varlink.idl.varlinkIdl.Method; 024import de.dentrassi.varlink.idl.varlinkIdl.Optional; 025import de.dentrassi.varlink.idl.varlinkIdl.Result; 026import de.dentrassi.varlink.idl.varlinkIdl.TypeAlias; 027import de.dentrassi.varlink.idl.varlinkIdl.TypeAliasDefinition; 028import de.dentrassi.varlink.idl.varlinkIdl.TypeReference; 029import de.dentrassi.varlink.idl.varlinkIdl.VarlinkIdlPackage; 030 031import org.eclipse.emf.ecore.EObject; 032import org.eclipse.emf.ecore.EPackage; 033 034import org.eclipse.emf.ecore.util.Switch; 035 036/** 037 * <!-- begin-user-doc --> 038 * The <b>Switch</b> for the model's inheritance hierarchy. 039 * It supports the call {@link #doSwitch(EObject) doSwitch(object)} 040 * to invoke the <code>caseXXX</code> method for each class of the model, 041 * starting with the actual class of the object 042 * and proceeding up the inheritance hierarchy 043 * until a non-null result is returned, 044 * which is the result of the switch. 045 * <!-- end-user-doc --> 046 * @see de.dentrassi.varlink.idl.varlinkIdl.VarlinkIdlPackage 047 * @generated 048 */ 049public class VarlinkIdlSwitch<T> extends Switch<T> 050{ 051 /** 052 * The cached model package 053 * <!-- begin-user-doc --> 054 * <!-- end-user-doc --> 055 * @generated 056 */ 057 protected static VarlinkIdlPackage modelPackage; 058 059 /** 060 * Creates an instance of the switch. 061 * <!-- begin-user-doc --> 062 * <!-- end-user-doc --> 063 * @generated 064 */ 065 public VarlinkIdlSwitch() 066 { 067 if (modelPackage == null) 068 { 069 modelPackage = VarlinkIdlPackage.eINSTANCE; 070 } 071 } 072 073 /** 074 * Checks whether this is a switch for the given package. 075 * <!-- begin-user-doc --> 076 * <!-- end-user-doc --> 077 * @param ePackage the package in question. 078 * @return whether this is a switch for the given package. 079 * @generated 080 */ 081 @Override 082 protected boolean isSwitchFor(EPackage ePackage) 083 { 084 return ePackage == modelPackage; 085 } 086 087 /** 088 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. 089 * <!-- begin-user-doc --> 090 * <!-- end-user-doc --> 091 * @return the first non-null result returned by a <code>caseXXX</code> call. 092 * @generated 093 */ 094 @Override 095 protected T doSwitch(int classifierID, EObject theEObject) 096 { 097 switch (classifierID) 098 { 099 case VarlinkIdlPackage.INTERFACE: 100 { 101 Interface interface_ = (Interface)theEObject; 102 T result = caseInterface(interface_); 103 if (result == null) result = defaultCase(theEObject); 104 return result; 105 } 106 case VarlinkIdlPackage.MEMBER: 107 { 108 Member member = (Member)theEObject; 109 T result = caseMember(member); 110 if (result == null) result = defaultCase(theEObject); 111 return result; 112 } 113 case VarlinkIdlPackage.TYPE_ALIAS: 114 { 115 TypeAlias typeAlias = (TypeAlias)theEObject; 116 T result = caseTypeAlias(typeAlias); 117 if (result == null) result = caseMember(typeAlias); 118 if (result == null) result = defaultCase(theEObject); 119 return result; 120 } 121 case VarlinkIdlPackage.TYPE_ALIAS_DEFINITION: 122 { 123 TypeAliasDefinition typeAliasDefinition = (TypeAliasDefinition)theEObject; 124 T result = caseTypeAliasDefinition(typeAliasDefinition); 125 if (result == null) result = defaultCase(theEObject); 126 return result; 127 } 128 case VarlinkIdlPackage.ENUM: 129 { 130 de.dentrassi.varlink.idl.varlinkIdl.Enum enum_ = (de.dentrassi.varlink.idl.varlinkIdl.Enum)theEObject; 131 T result = caseEnum(enum_); 132 if (result == null) result = caseTypeAliasDefinition(enum_); 133 if (result == null) result = caseElementType(enum_); 134 if (result == null) result = defaultCase(theEObject); 135 return result; 136 } 137 case VarlinkIdlPackage.OBJECT: 138 { 139 de.dentrassi.varlink.idl.varlinkIdl.Object object = (de.dentrassi.varlink.idl.varlinkIdl.Object)theEObject; 140 T result = caseObject(object); 141 if (result == null) result = caseTypeAliasDefinition(object); 142 if (result == null) result = caseElementType(object); 143 if (result == null) result = defaultCase(theEObject); 144 return result; 145 } 146 case VarlinkIdlPackage.FIELD: 147 { 148 Field field = (Field)theEObject; 149 T result = caseField(field); 150 if (result == null) result = defaultCase(theEObject); 151 return result; 152 } 153 case VarlinkIdlPackage.ELEMENT_TYPE: 154 { 155 ElementType elementType = (ElementType)theEObject; 156 T result = caseElementType(elementType); 157 if (result == null) result = defaultCase(theEObject); 158 return result; 159 } 160 case VarlinkIdlPackage.ARRAY: 161 { 162 Array array = (Array)theEObject; 163 T result = caseArray(array); 164 if (result == null) result = caseElementType(array); 165 if (result == null) result = defaultCase(theEObject); 166 return result; 167 } 168 case VarlinkIdlPackage.DICTIONARY: 169 { 170 Dictionary dictionary = (Dictionary)theEObject; 171 T result = caseDictionary(dictionary); 172 if (result == null) result = caseElementType(dictionary); 173 if (result == null) result = defaultCase(theEObject); 174 return result; 175 } 176 case VarlinkIdlPackage.OPTIONAL: 177 { 178 Optional optional = (Optional)theEObject; 179 T result = caseOptional(optional); 180 if (result == null) result = caseElementType(optional); 181 if (result == null) result = defaultCase(theEObject); 182 return result; 183 } 184 case VarlinkIdlPackage.TYPE_REFERENCE: 185 { 186 TypeReference typeReference = (TypeReference)theEObject; 187 T result = caseTypeReference(typeReference); 188 if (result == null) result = caseElementType(typeReference); 189 if (result == null) result = defaultCase(theEObject); 190 return result; 191 } 192 case VarlinkIdlPackage.BASIC_TYPE: 193 { 194 BasicType basicType = (BasicType)theEObject; 195 T result = caseBasicType(basicType); 196 if (result == null) result = caseElementType(basicType); 197 if (result == null) result = defaultCase(theEObject); 198 return result; 199 } 200 case VarlinkIdlPackage.METHOD: 201 { 202 Method method = (Method)theEObject; 203 T result = caseMethod(method); 204 if (result == null) result = caseMember(method); 205 if (result == null) result = defaultCase(theEObject); 206 return result; 207 } 208 case VarlinkIdlPackage.ARGUMENTS: 209 { 210 Arguments arguments = (Arguments)theEObject; 211 T result = caseArguments(arguments); 212 if (result == null) result = defaultCase(theEObject); 213 return result; 214 } 215 case VarlinkIdlPackage.RESULT: 216 { 217 Result result = (Result)theEObject; 218 T theResult = caseResult(result); 219 if (theResult == null) theResult = defaultCase(theEObject); 220 return theResult; 221 } 222 case VarlinkIdlPackage.ERROR: 223 { 224 de.dentrassi.varlink.idl.varlinkIdl.Error error = (de.dentrassi.varlink.idl.varlinkIdl.Error)theEObject; 225 T result = caseError(error); 226 if (result == null) result = caseMember(error); 227 if (result == null) result = defaultCase(theEObject); 228 return result; 229 } 230 default: return defaultCase(theEObject); 231 } 232 } 233 234 /** 235 * Returns the result of interpreting the object as an instance of '<em>Interface</em>'. 236 * <!-- begin-user-doc --> 237 * This implementation returns null; 238 * returning a non-null result will terminate the switch. 239 * <!-- end-user-doc --> 240 * @param object the target of the switch. 241 * @return the result of interpreting the object as an instance of '<em>Interface</em>'. 242 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 243 * @generated 244 */ 245 public T caseInterface(Interface object) 246 { 247 return null; 248 } 249 250 /** 251 * Returns the result of interpreting the object as an instance of '<em>Member</em>'. 252 * <!-- begin-user-doc --> 253 * This implementation returns null; 254 * returning a non-null result will terminate the switch. 255 * <!-- end-user-doc --> 256 * @param object the target of the switch. 257 * @return the result of interpreting the object as an instance of '<em>Member</em>'. 258 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 259 * @generated 260 */ 261 public T caseMember(Member object) 262 { 263 return null; 264 } 265 266 /** 267 * Returns the result of interpreting the object as an instance of '<em>Type Alias</em>'. 268 * <!-- begin-user-doc --> 269 * This implementation returns null; 270 * returning a non-null result will terminate the switch. 271 * <!-- end-user-doc --> 272 * @param object the target of the switch. 273 * @return the result of interpreting the object as an instance of '<em>Type Alias</em>'. 274 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 275 * @generated 276 */ 277 public T caseTypeAlias(TypeAlias object) 278 { 279 return null; 280 } 281 282 /** 283 * Returns the result of interpreting the object as an instance of '<em>Type Alias Definition</em>'. 284 * <!-- begin-user-doc --> 285 * This implementation returns null; 286 * returning a non-null result will terminate the switch. 287 * <!-- end-user-doc --> 288 * @param object the target of the switch. 289 * @return the result of interpreting the object as an instance of '<em>Type Alias Definition</em>'. 290 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 291 * @generated 292 */ 293 public T caseTypeAliasDefinition(TypeAliasDefinition object) 294 { 295 return null; 296 } 297 298 /** 299 * Returns the result of interpreting the object as an instance of '<em>Enum</em>'. 300 * <!-- begin-user-doc --> 301 * This implementation returns null; 302 * returning a non-null result will terminate the switch. 303 * <!-- end-user-doc --> 304 * @param object the target of the switch. 305 * @return the result of interpreting the object as an instance of '<em>Enum</em>'. 306 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 307 * @generated 308 */ 309 public T caseEnum(de.dentrassi.varlink.idl.varlinkIdl.Enum object) 310 { 311 return null; 312 } 313 314 /** 315 * Returns the result of interpreting the object as an instance of '<em>Object</em>'. 316 * <!-- begin-user-doc --> 317 * This implementation returns null; 318 * returning a non-null result will terminate the switch. 319 * <!-- end-user-doc --> 320 * @param object the target of the switch. 321 * @return the result of interpreting the object as an instance of '<em>Object</em>'. 322 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 323 * @generated 324 */ 325 public T caseObject(de.dentrassi.varlink.idl.varlinkIdl.Object object) 326 { 327 return null; 328 } 329 330 /** 331 * Returns the result of interpreting the object as an instance of '<em>Field</em>'. 332 * <!-- begin-user-doc --> 333 * This implementation returns null; 334 * returning a non-null result will terminate the switch. 335 * <!-- end-user-doc --> 336 * @param object the target of the switch. 337 * @return the result of interpreting the object as an instance of '<em>Field</em>'. 338 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 339 * @generated 340 */ 341 public T caseField(Field object) 342 { 343 return null; 344 } 345 346 /** 347 * Returns the result of interpreting the object as an instance of '<em>Element Type</em>'. 348 * <!-- begin-user-doc --> 349 * This implementation returns null; 350 * returning a non-null result will terminate the switch. 351 * <!-- end-user-doc --> 352 * @param object the target of the switch. 353 * @return the result of interpreting the object as an instance of '<em>Element Type</em>'. 354 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 355 * @generated 356 */ 357 public T caseElementType(ElementType object) 358 { 359 return null; 360 } 361 362 /** 363 * Returns the result of interpreting the object as an instance of '<em>Array</em>'. 364 * <!-- begin-user-doc --> 365 * This implementation returns null; 366 * returning a non-null result will terminate the switch. 367 * <!-- end-user-doc --> 368 * @param object the target of the switch. 369 * @return the result of interpreting the object as an instance of '<em>Array</em>'. 370 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 371 * @generated 372 */ 373 public T caseArray(Array object) 374 { 375 return null; 376 } 377 378 /** 379 * Returns the result of interpreting the object as an instance of '<em>Dictionary</em>'. 380 * <!-- begin-user-doc --> 381 * This implementation returns null; 382 * returning a non-null result will terminate the switch. 383 * <!-- end-user-doc --> 384 * @param object the target of the switch. 385 * @return the result of interpreting the object as an instance of '<em>Dictionary</em>'. 386 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 387 * @generated 388 */ 389 public T caseDictionary(Dictionary object) 390 { 391 return null; 392 } 393 394 /** 395 * Returns the result of interpreting the object as an instance of '<em>Optional</em>'. 396 * <!-- begin-user-doc --> 397 * This implementation returns null; 398 * returning a non-null result will terminate the switch. 399 * <!-- end-user-doc --> 400 * @param object the target of the switch. 401 * @return the result of interpreting the object as an instance of '<em>Optional</em>'. 402 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 403 * @generated 404 */ 405 public T caseOptional(Optional object) 406 { 407 return null; 408 } 409 410 /** 411 * Returns the result of interpreting the object as an instance of '<em>Type Reference</em>'. 412 * <!-- begin-user-doc --> 413 * This implementation returns null; 414 * returning a non-null result will terminate the switch. 415 * <!-- end-user-doc --> 416 * @param object the target of the switch. 417 * @return the result of interpreting the object as an instance of '<em>Type Reference</em>'. 418 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 419 * @generated 420 */ 421 public T caseTypeReference(TypeReference object) 422 { 423 return null; 424 } 425 426 /** 427 * Returns the result of interpreting the object as an instance of '<em>Basic Type</em>'. 428 * <!-- begin-user-doc --> 429 * This implementation returns null; 430 * returning a non-null result will terminate the switch. 431 * <!-- end-user-doc --> 432 * @param object the target of the switch. 433 * @return the result of interpreting the object as an instance of '<em>Basic Type</em>'. 434 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 435 * @generated 436 */ 437 public T caseBasicType(BasicType object) 438 { 439 return null; 440 } 441 442 /** 443 * Returns the result of interpreting the object as an instance of '<em>Method</em>'. 444 * <!-- begin-user-doc --> 445 * This implementation returns null; 446 * returning a non-null result will terminate the switch. 447 * <!-- end-user-doc --> 448 * @param object the target of the switch. 449 * @return the result of interpreting the object as an instance of '<em>Method</em>'. 450 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 451 * @generated 452 */ 453 public T caseMethod(Method object) 454 { 455 return null; 456 } 457 458 /** 459 * Returns the result of interpreting the object as an instance of '<em>Arguments</em>'. 460 * <!-- begin-user-doc --> 461 * This implementation returns null; 462 * returning a non-null result will terminate the switch. 463 * <!-- end-user-doc --> 464 * @param object the target of the switch. 465 * @return the result of interpreting the object as an instance of '<em>Arguments</em>'. 466 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 467 * @generated 468 */ 469 public T caseArguments(Arguments object) 470 { 471 return null; 472 } 473 474 /** 475 * Returns the result of interpreting the object as an instance of '<em>Result</em>'. 476 * <!-- begin-user-doc --> 477 * This implementation returns null; 478 * returning a non-null result will terminate the switch. 479 * <!-- end-user-doc --> 480 * @param object the target of the switch. 481 * @return the result of interpreting the object as an instance of '<em>Result</em>'. 482 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 483 * @generated 484 */ 485 public T caseResult(Result object) 486 { 487 return null; 488 } 489 490 /** 491 * Returns the result of interpreting the object as an instance of '<em>Error</em>'. 492 * <!-- begin-user-doc --> 493 * This implementation returns null; 494 * returning a non-null result will terminate the switch. 495 * <!-- end-user-doc --> 496 * @param object the target of the switch. 497 * @return the result of interpreting the object as an instance of '<em>Error</em>'. 498 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) 499 * @generated 500 */ 501 public T caseError(de.dentrassi.varlink.idl.varlinkIdl.Error object) 502 { 503 return null; 504 } 505 506 /** 507 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. 508 * <!-- begin-user-doc --> 509 * This implementation returns null; 510 * returning a non-null result will terminate the switch, but this is the last case anyway. 511 * <!-- end-user-doc --> 512 * @param object the target of the switch. 513 * @return the result of interpreting the object as an instance of '<em>EObject</em>'. 514 * @see #doSwitch(org.eclipse.emf.ecore.EObject) 515 * @generated 516 */ 517 @Override 518 public T defaultCase(EObject object) 519 { 520 return null; 521 } 522 523} //VarlinkIdlSwitch