001    /**
002     * <copyright>
003     * </copyright>
004     *
005     * $Id$
006     */
007    package com.hammurapi.party.util;
008    
009    import com.hammurapi.party.*;
010    
011    import java.util.List;
012    
013    import org.eclipse.emf.ecore.EClass;
014    import org.eclipse.emf.ecore.EObject;
015    
016    /**
017     * <!-- begin-user-doc -->
018     * The <b>Switch</b> for the model's inheritance hierarchy.
019     * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
020     * to invoke the <code>caseXXX</code> method for each class of the model,
021     * starting with the actual class of the object
022     * and proceeding up the inheritance hierarchy
023     * until a non-null result is returned,
024     * which is the result of the switch.
025     * <!-- end-user-doc -->
026     * @see com.hammurapi.party.PartyPackage
027     * @generated
028     */
029    public class PartySwitch<T> {
030            /**
031             * The cached model package
032             * <!-- begin-user-doc -->
033             * <!-- end-user-doc -->
034             * @generated
035             */
036            protected static PartyPackage modelPackage;
037    
038            /**
039             * Creates an instance of the switch.
040             * <!-- begin-user-doc -->
041             * <!-- end-user-doc -->
042             * @generated
043             */
044            public PartySwitch() {
045                    if (modelPackage == null) {
046                            modelPackage = PartyPackage.eINSTANCE;
047                    }
048            }
049    
050            /**
051             * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
052             * <!-- begin-user-doc -->
053             * <!-- end-user-doc -->
054             * @return the first non-null result returned by a <code>caseXXX</code> call.
055             * @generated
056             */
057            public T doSwitch(EObject theEObject) {
058                    return doSwitch(theEObject.eClass(), theEObject);
059            }
060    
061            /**
062             * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
063             * <!-- begin-user-doc -->
064             * <!-- end-user-doc -->
065             * @return the first non-null result returned by a <code>caseXXX</code> call.
066             * @generated
067             */
068            protected T doSwitch(EClass theEClass, EObject theEObject) {
069                    if (theEClass.eContainer() == modelPackage) {
070                            return doSwitch(theEClass.getClassifierID(), theEObject);
071                    }
072                    else {
073                            List<EClass> eSuperTypes = theEClass.getESuperTypes();
074                            return
075                                    eSuperTypes.isEmpty() ?
076                                            defaultCase(theEObject) :
077                                            doSwitch(eSuperTypes.get(0), theEObject);
078                    }
079            }
080    
081            /**
082             * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
083             * <!-- begin-user-doc -->
084             * <!-- end-user-doc -->
085             * @return the first non-null result returned by a <code>caseXXX</code> call.
086             * @generated
087             */
088            protected T doSwitch(int classifierID, EObject theEObject) {
089                    switch (classifierID) {
090                            case PartyPackage.PARTY: {
091                                    Party party = (Party)theEObject;
092                                    T result = caseParty(party);
093                                    if (result == null) result = caseTagged(party);
094                                    if (result == null) result = defaultCase(theEObject);
095                                    return result;
096                            }
097                            case PartyPackage.IDENTITY: {
098                                    Identity identity = (Identity)theEObject;
099                                    T result = caseIdentity(identity);
100                                    if (result == null) result = defaultCase(theEObject);
101                                    return result;
102                            }
103                            case PartyPackage.TAGGED: {
104                                    Tagged tagged = (Tagged)theEObject;
105                                    T result = caseTagged(tagged);
106                                    if (result == null) result = defaultCase(theEObject);
107                                    return result;
108                            }
109                            case PartyPackage.DATE_EFFECTIVE_OBJECT: {
110                                    DateEffectiveObject dateEffectiveObject = (DateEffectiveObject)theEObject;
111                                    T result = caseDateEffectiveObject(dateEffectiveObject);
112                                    if (result == null) result = caseTagged(dateEffectiveObject);
113                                    if (result == null) result = defaultCase(theEObject);
114                                    return result;
115                            }
116                            case PartyPackage.CONTACT_INFO: {
117                                    ContactInfo contactInfo = (ContactInfo)theEObject;
118                                    T result = caseContactInfo(contactInfo);
119                                    if (result == null) result = caseDateEffectiveObject(contactInfo);
120                                    if (result == null) result = caseTagged(contactInfo);
121                                    if (result == null) result = defaultCase(theEObject);
122                                    return result;
123                            }
124                            case PartyPackage.PHONE: {
125                                    Phone phone = (Phone)theEObject;
126                                    T result = casePhone(phone);
127                                    if (result == null) result = caseContactInfo(phone);
128                                    if (result == null) result = caseDateEffectiveObject(phone);
129                                    if (result == null) result = caseTagged(phone);
130                                    if (result == null) result = defaultCase(theEObject);
131                                    return result;
132                            }
133                            case PartyPackage.WEB: {
134                                    Web web = (Web)theEObject;
135                                    T result = caseWeb(web);
136                                    if (result == null) result = caseURL(web);
137                                    if (result == null) result = caseContactInfo(web);
138                                    if (result == null) result = caseDateEffectiveObject(web);
139                                    if (result == null) result = caseTagged(web);
140                                    if (result == null) result = defaultCase(theEObject);
141                                    return result;
142                            }
143                            case PartyPackage.EMAIL: {
144                                    EMail eMail = (EMail)theEObject;
145                                    T result = caseEMail(eMail);
146                                    if (result == null) result = caseURL(eMail);
147                                    if (result == null) result = caseContactInfo(eMail);
148                                    if (result == null) result = caseDateEffectiveObject(eMail);
149                                    if (result == null) result = caseTagged(eMail);
150                                    if (result == null) result = defaultCase(theEObject);
151                                    return result;
152                            }
153                            case PartyPackage.ADDRESS: {
154                                    Address address = (Address)theEObject;
155                                    T result = caseAddress(address);
156                                    if (result == null) result = caseContactInfo(address);
157                                    if (result == null) result = caseDateEffectiveObject(address);
158                                    if (result == null) result = caseTagged(address);
159                                    if (result == null) result = defaultCase(theEObject);
160                                    return result;
161                            }
162                            case PartyPackage.CUSTOM: {
163                                    Custom custom = (Custom)theEObject;
164                                    T result = caseCustom(custom);
165                                    if (result == null) result = caseContactInfo(custom);
166                                    if (result == null) result = caseDateEffectiveObject(custom);
167                                    if (result == null) result = caseTagged(custom);
168                                    if (result == null) result = defaultCase(theEObject);
169                                    return result;
170                            }
171                            case PartyPackage.US_ADDRESS: {
172                                    USAddress usAddress = (USAddress)theEObject;
173                                    T result = caseUSAddress(usAddress);
174                                    if (result == null) result = caseAddress(usAddress);
175                                    if (result == null) result = caseContactInfo(usAddress);
176                                    if (result == null) result = caseDateEffectiveObject(usAddress);
177                                    if (result == null) result = caseTagged(usAddress);
178                                    if (result == null) result = defaultCase(theEObject);
179                                    return result;
180                            }
181                            case PartyPackage.ORGANIZATION: {
182                                    Organization organization = (Organization)theEObject;
183                                    T result = caseOrganization(organization);
184                                    if (result == null) result = caseParty(organization);
185                                    if (result == null) result = caseTagged(organization);
186                                    if (result == null) result = defaultCase(theEObject);
187                                    return result;
188                            }
189                            case PartyPackage.PERSON: {
190                                    Person person = (Person)theEObject;
191                                    T result = casePerson(person);
192                                    if (result == null) result = caseParty(person);
193                                    if (result == null) result = caseTagged(person);
194                                    if (result == null) result = defaultCase(theEObject);
195                                    return result;
196                            }
197                            case PartyPackage.TAG: {
198                                    Tag tag = (Tag)theEObject;
199                                    T result = caseTag(tag);
200                                    if (result == null) result = defaultCase(theEObject);
201                                    return result;
202                            }
203                            case PartyPackage.ROLE: {
204                                    Role role = (Role)theEObject;
205                                    T result = caseRole(role);
206                                    if (result == null) result = caseDateEffectiveObject(role);
207                                    if (result == null) result = caseTagged(role);
208                                    if (result == null) result = defaultCase(theEObject);
209                                    return result;
210                            }
211                            case PartyPackage.URL: {
212                                    URL url = (URL)theEObject;
213                                    T result = caseURL(url);
214                                    if (result == null) result = caseContactInfo(url);
215                                    if (result == null) result = caseDateEffectiveObject(url);
216                                    if (result == null) result = caseTagged(url);
217                                    if (result == null) result = defaultCase(theEObject);
218                                    return result;
219                            }
220                            case PartyPackage.COMMON_OBJECT: {
221                                    CommonObject commonObject = (CommonObject)theEObject;
222                                    T result = caseCommonObject(commonObject);
223                                    if (result == null) result = defaultCase(theEObject);
224                                    return result;
225                            }
226                            case PartyPackage.MATRIX_RELATIONSHIP: {
227                                    MatrixRelationship matrixRelationship = (MatrixRelationship)theEObject;
228                                    T result = caseMatrixRelationship(matrixRelationship);
229                                    if (result == null) result = caseDateEffectiveObject(matrixRelationship);
230                                    if (result == null) result = caseTagged(matrixRelationship);
231                                    if (result == null) result = defaultCase(theEObject);
232                                    return result;
233                            }
234                            default: return defaultCase(theEObject);
235                    }
236            }
237    
238            /**
239             * Returns the result of interpreting the object as an instance of '<em>Party</em>'.
240             * <!-- begin-user-doc -->
241             * This implementation returns null;
242             * returning a non-null result will terminate the switch.
243             * <!-- end-user-doc -->
244             * @param object the target of the switch.
245             * @return the result of interpreting the object as an instance of '<em>Party</em>'.
246             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
247             * @generated
248             */
249            public T caseParty(Party object) {
250                    return null;
251            }
252    
253            /**
254             * Returns the result of interpreting the object as an instance of '<em>Identity</em>'.
255             * <!-- begin-user-doc -->
256             * This implementation returns null;
257             * returning a non-null result will terminate the switch.
258             * <!-- end-user-doc -->
259             * @param object the target of the switch.
260             * @return the result of interpreting the object as an instance of '<em>Identity</em>'.
261             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
262             * @generated
263             */
264            public T caseIdentity(Identity object) {
265                    return null;
266            }
267    
268            /**
269             * Returns the result of interpreting the object as an instance of '<em>Tagged</em>'.
270             * <!-- begin-user-doc -->
271             * This implementation returns null;
272             * returning a non-null result will terminate the switch.
273             * <!-- end-user-doc -->
274             * @param object the target of the switch.
275             * @return the result of interpreting the object as an instance of '<em>Tagged</em>'.
276             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
277             * @generated
278             */
279            public T caseTagged(Tagged object) {
280                    return null;
281            }
282    
283            /**
284             * Returns the result of interpreting the object as an instance of '<em>Date Effective Object</em>'.
285             * <!-- begin-user-doc -->
286             * This implementation returns null;
287             * returning a non-null result will terminate the switch.
288             * <!-- end-user-doc -->
289             * @param object the target of the switch.
290             * @return the result of interpreting the object as an instance of '<em>Date Effective Object</em>'.
291             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
292             * @generated
293             */
294            public T caseDateEffectiveObject(DateEffectiveObject object) {
295                    return null;
296            }
297    
298            /**
299             * Returns the result of interpreting the object as an instance of '<em>Contact Info</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>Contact Info</em>'.
306             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
307             * @generated
308             */
309            public T caseContactInfo(ContactInfo object) {
310                    return null;
311            }
312    
313            /**
314             * Returns the result of interpreting the object as an instance of '<em>Phone</em>'.
315             * <!-- begin-user-doc -->
316             * This implementation returns null;
317             * returning a non-null result will terminate the switch.
318             * <!-- end-user-doc -->
319             * @param object the target of the switch.
320             * @return the result of interpreting the object as an instance of '<em>Phone</em>'.
321             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
322             * @generated
323             */
324            public T casePhone(Phone object) {
325                    return null;
326            }
327    
328            /**
329             * Returns the result of interpreting the object as an instance of '<em>Web</em>'.
330             * <!-- begin-user-doc -->
331             * This implementation returns null;
332             * returning a non-null result will terminate the switch.
333             * <!-- end-user-doc -->
334             * @param object the target of the switch.
335             * @return the result of interpreting the object as an instance of '<em>Web</em>'.
336             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
337             * @generated
338             */
339            public T caseWeb(Web object) {
340                    return null;
341            }
342    
343            /**
344             * Returns the result of interpreting the object as an instance of '<em>EMail</em>'.
345             * <!-- begin-user-doc -->
346             * This implementation returns null;
347             * returning a non-null result will terminate the switch.
348             * <!-- end-user-doc -->
349             * @param object the target of the switch.
350             * @return the result of interpreting the object as an instance of '<em>EMail</em>'.
351             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
352             * @generated
353             */
354            public T caseEMail(EMail object) {
355                    return null;
356            }
357    
358            /**
359             * Returns the result of interpreting the object as an instance of '<em>Address</em>'.
360             * <!-- begin-user-doc -->
361             * This implementation returns null;
362             * returning a non-null result will terminate the switch.
363             * <!-- end-user-doc -->
364             * @param object the target of the switch.
365             * @return the result of interpreting the object as an instance of '<em>Address</em>'.
366             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
367             * @generated
368             */
369            public T caseAddress(Address object) {
370                    return null;
371            }
372    
373            /**
374             * Returns the result of interpreting the object as an instance of '<em>Custom</em>'.
375             * <!-- begin-user-doc -->
376             * This implementation returns null;
377             * returning a non-null result will terminate the switch.
378             * <!-- end-user-doc -->
379             * @param object the target of the switch.
380             * @return the result of interpreting the object as an instance of '<em>Custom</em>'.
381             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
382             * @generated
383             */
384            public T caseCustom(Custom object) {
385                    return null;
386            }
387    
388            /**
389             * Returns the result of interpreting the object as an instance of '<em>US Address</em>'.
390             * <!-- begin-user-doc -->
391             * This implementation returns null;
392             * returning a non-null result will terminate the switch.
393             * <!-- end-user-doc -->
394             * @param object the target of the switch.
395             * @return the result of interpreting the object as an instance of '<em>US Address</em>'.
396             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
397             * @generated
398             */
399            public T caseUSAddress(USAddress object) {
400                    return null;
401            }
402    
403            /**
404             * Returns the result of interpreting the object as an instance of '<em>Organization</em>'.
405             * <!-- begin-user-doc -->
406             * This implementation returns null;
407             * returning a non-null result will terminate the switch.
408             * <!-- end-user-doc -->
409             * @param object the target of the switch.
410             * @return the result of interpreting the object as an instance of '<em>Organization</em>'.
411             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
412             * @generated
413             */
414            public T caseOrganization(Organization object) {
415                    return null;
416            }
417    
418            /**
419             * Returns the result of interpreting the object as an instance of '<em>Person</em>'.
420             * <!-- begin-user-doc -->
421             * This implementation returns null;
422             * returning a non-null result will terminate the switch.
423             * <!-- end-user-doc -->
424             * @param object the target of the switch.
425             * @return the result of interpreting the object as an instance of '<em>Person</em>'.
426             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
427             * @generated
428             */
429            public T casePerson(Person object) {
430                    return null;
431            }
432    
433            /**
434             * Returns the result of interpreting the object as an instance of '<em>Tag</em>'.
435             * <!-- begin-user-doc -->
436             * This implementation returns null;
437             * returning a non-null result will terminate the switch.
438             * <!-- end-user-doc -->
439             * @param object the target of the switch.
440             * @return the result of interpreting the object as an instance of '<em>Tag</em>'.
441             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
442             * @generated
443             */
444            public T caseTag(Tag object) {
445                    return null;
446            }
447    
448            /**
449             * Returns the result of interpreting the object as an instance of '<em>Role</em>'.
450             * <!-- begin-user-doc -->
451             * This implementation returns null;
452             * returning a non-null result will terminate the switch.
453             * <!-- end-user-doc -->
454             * @param object the target of the switch.
455             * @return the result of interpreting the object as an instance of '<em>Role</em>'.
456             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
457             * @generated
458             */
459            public T caseRole(Role object) {
460                    return null;
461            }
462    
463            /**
464             * Returns the result of interpreting the object as an instance of '<em>URL</em>'.
465             * <!-- begin-user-doc -->
466             * This implementation returns null;
467             * returning a non-null result will terminate the switch.
468             * <!-- end-user-doc -->
469             * @param object the target of the switch.
470             * @return the result of interpreting the object as an instance of '<em>URL</em>'.
471             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
472             * @generated
473             */
474            public T caseURL(URL object) {
475                    return null;
476            }
477    
478            /**
479             * Returns the result of interpreting the object as an instance of '<em>Common Object</em>'.
480             * <!-- begin-user-doc -->
481             * This implementation returns null;
482             * returning a non-null result will terminate the switch.
483             * <!-- end-user-doc -->
484             * @param object the target of the switch.
485             * @return the result of interpreting the object as an instance of '<em>Common Object</em>'.
486             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
487             * @generated
488             */
489            public T caseCommonObject(CommonObject object) {
490                    return null;
491            }
492    
493            /**
494             * Returns the result of interpreting the object as an instance of '<em>Matrix Relationship</em>'.
495             * <!-- begin-user-doc -->
496             * This implementation returns null;
497             * returning a non-null result will terminate the switch.
498             * <!-- end-user-doc -->
499             * @param object the target of the switch.
500             * @return the result of interpreting the object as an instance of '<em>Matrix Relationship</em>'.
501             * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
502             * @generated
503             */
504            public T caseMatrixRelationship(MatrixRelationship object) {
505                    return null;
506            }
507    
508            /**
509             * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
510             * <!-- begin-user-doc -->
511             * This implementation returns null;
512             * returning a non-null result will terminate the switch, but this is the last case anyway.
513             * <!-- end-user-doc -->
514             * @param object the target of the switch.
515             * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
516             * @see #doSwitch(org.eclipse.emf.ecore.EObject)
517             * @generated
518             */
519            public T defaultCase(EObject object) {
520                    return null;
521            }
522    
523    } //PartySwitch