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