core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/gen/CSConfig/impl/FlagsTypeImpl.java
branchRCL_2_0
changeset 33 2d1c891725ea
equal deleted inserted replaced
32:5d3382869e48 33:2d1c891725ea
       
     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 the License "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 
       
    18 package com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.impl;
       
    19 
       
    20 import com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.CSConfigPackage;
       
    21 import com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.CategoryType;
       
    22 import com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.FlagsType;
       
    23 import com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.SeverityType;
       
    24 
       
    25 import org.eclipse.emf.common.notify.Notification;
       
    26 
       
    27 import org.eclipse.emf.ecore.EClass;
       
    28 
       
    29 import org.eclipse.emf.ecore.impl.ENotificationImpl;
       
    30 import org.eclipse.emf.ecore.impl.EObjectImpl;
       
    31 
       
    32 /**
       
    33  * <!-- begin-user-doc -->
       
    34  * An implementation of the model object '<em><b>Flags Type</b></em>'.
       
    35  * <!-- end-user-doc -->
       
    36  * <p>
       
    37  * The following features are implemented:
       
    38  * <ul>
       
    39  *   <li>{@link com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.impl.FlagsTypeImpl#getCategory <em>Category</em>}</li>
       
    40  *   <li>{@link com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.impl.FlagsTypeImpl#isEnable <em>Enable</em>}</li>
       
    41  *   <li>{@link com.nokia.carbide.cpp.internal.codescanner.gen.CSConfig.impl.FlagsTypeImpl#getSeverity <em>Severity</em>}</li>
       
    42  * </ul>
       
    43  * </p>
       
    44  *
       
    45  * @generated
       
    46  */
       
    47 public class FlagsTypeImpl extends EObjectImpl implements FlagsType {
       
    48 	/**
       
    49 	 * The default value of the '{@link #getCategory() <em>Category</em>}' attribute.
       
    50 	 * <!-- begin-user-doc -->
       
    51 	 * <!-- end-user-doc -->
       
    52 	 * @see #getCategory()
       
    53 	 * @generated
       
    54 	 * @ordered
       
    55 	 */
       
    56 	protected static final CategoryType CATEGORY_EDEFAULT = CategoryType.CANPANIC;
       
    57 
       
    58 	/**
       
    59 	 * The cached value of the '{@link #getCategory() <em>Category</em>}' attribute.
       
    60 	 * <!-- begin-user-doc -->
       
    61 	 * <!-- end-user-doc -->
       
    62 	 * @see #getCategory()
       
    63 	 * @generated
       
    64 	 * @ordered
       
    65 	 */
       
    66 	protected CategoryType category = CATEGORY_EDEFAULT;
       
    67 
       
    68 	/**
       
    69 	 * This is true if the Category attribute has been set.
       
    70 	 * <!-- begin-user-doc -->
       
    71 	 * <!-- end-user-doc -->
       
    72 	 * @generated
       
    73 	 * @ordered
       
    74 	 */
       
    75 	protected boolean categoryESet;
       
    76 
       
    77 	/**
       
    78 	 * The default value of the '{@link #isEnable() <em>Enable</em>}' attribute.
       
    79 	 * <!-- begin-user-doc -->
       
    80 	 * <!-- end-user-doc -->
       
    81 	 * @see #isEnable()
       
    82 	 * @generated
       
    83 	 * @ordered
       
    84 	 */
       
    85 	protected static final boolean ENABLE_EDEFAULT = false;
       
    86 
       
    87 	/**
       
    88 	 * The cached value of the '{@link #isEnable() <em>Enable</em>}' attribute.
       
    89 	 * <!-- begin-user-doc -->
       
    90 	 * <!-- end-user-doc -->
       
    91 	 * @see #isEnable()
       
    92 	 * @generated
       
    93 	 * @ordered
       
    94 	 */
       
    95 	protected boolean enable = ENABLE_EDEFAULT;
       
    96 
       
    97 	/**
       
    98 	 * This is true if the Enable attribute has been set.
       
    99 	 * <!-- begin-user-doc -->
       
   100 	 * <!-- end-user-doc -->
       
   101 	 * @generated
       
   102 	 * @ordered
       
   103 	 */
       
   104 	protected boolean enableESet;
       
   105 
       
   106 	/**
       
   107 	 * The default value of the '{@link #getSeverity() <em>Severity</em>}' attribute.
       
   108 	 * <!-- begin-user-doc -->
       
   109 	 * <!-- end-user-doc -->
       
   110 	 * @see #getSeverity()
       
   111 	 * @generated
       
   112 	 * @ordered
       
   113 	 */
       
   114 	protected static final SeverityType SEVERITY_EDEFAULT = SeverityType.HIGH;
       
   115 
       
   116 	/**
       
   117 	 * The cached value of the '{@link #getSeverity() <em>Severity</em>}' attribute.
       
   118 	 * <!-- begin-user-doc -->
       
   119 	 * <!-- end-user-doc -->
       
   120 	 * @see #getSeverity()
       
   121 	 * @generated
       
   122 	 * @ordered
       
   123 	 */
       
   124 	protected SeverityType severity = SEVERITY_EDEFAULT;
       
   125 
       
   126 	/**
       
   127 	 * This is true if the Severity attribute has been set.
       
   128 	 * <!-- begin-user-doc -->
       
   129 	 * <!-- end-user-doc -->
       
   130 	 * @generated
       
   131 	 * @ordered
       
   132 	 */
       
   133 	protected boolean severityESet;
       
   134 
       
   135 	/**
       
   136 	 * <!-- begin-user-doc -->
       
   137 	 * <!-- end-user-doc -->
       
   138 	 * @generated
       
   139 	 */
       
   140 	protected FlagsTypeImpl() {
       
   141 		super();
       
   142 	}
       
   143 
       
   144 	/**
       
   145 	 * <!-- begin-user-doc -->
       
   146 	 * <!-- end-user-doc -->
       
   147 	 * @generated
       
   148 	 */
       
   149 	@Override
       
   150 	protected EClass eStaticClass() {
       
   151 		return CSConfigPackage.eINSTANCE.getFlagsType();
       
   152 	}
       
   153 
       
   154 	/**
       
   155 	 * <!-- begin-user-doc -->
       
   156 	 * <!-- end-user-doc -->
       
   157 	 * @generated
       
   158 	 */
       
   159 	public CategoryType getCategory() {
       
   160 		return category;
       
   161 	}
       
   162 
       
   163 	/**
       
   164 	 * <!-- begin-user-doc -->
       
   165 	 * <!-- end-user-doc -->
       
   166 	 * @generated
       
   167 	 */
       
   168 	public void setCategory(CategoryType newCategory) {
       
   169 		CategoryType oldCategory = category;
       
   170 		category = newCategory == null ? CATEGORY_EDEFAULT : newCategory;
       
   171 		boolean oldCategoryESet = categoryESet;
       
   172 		categoryESet = true;
       
   173 		if (eNotificationRequired())
       
   174 			eNotify(new ENotificationImpl(this, Notification.SET, CSConfigPackage.FLAGS_TYPE__CATEGORY, oldCategory, category, !oldCategoryESet));
       
   175 	}
       
   176 
       
   177 	/**
       
   178 	 * <!-- begin-user-doc -->
       
   179 	 * <!-- end-user-doc -->
       
   180 	 * @generated
       
   181 	 */
       
   182 	public void unsetCategory() {
       
   183 		CategoryType oldCategory = category;
       
   184 		boolean oldCategoryESet = categoryESet;
       
   185 		category = CATEGORY_EDEFAULT;
       
   186 		categoryESet = false;
       
   187 		if (eNotificationRequired())
       
   188 			eNotify(new ENotificationImpl(this, Notification.UNSET, CSConfigPackage.FLAGS_TYPE__CATEGORY, oldCategory, CATEGORY_EDEFAULT, oldCategoryESet));
       
   189 	}
       
   190 
       
   191 	/**
       
   192 	 * <!-- begin-user-doc -->
       
   193 	 * <!-- end-user-doc -->
       
   194 	 * @generated
       
   195 	 */
       
   196 	public boolean isSetCategory() {
       
   197 		return categoryESet;
       
   198 	}
       
   199 
       
   200 	/**
       
   201 	 * <!-- begin-user-doc -->
       
   202 	 * <!-- end-user-doc -->
       
   203 	 * @generated
       
   204 	 */
       
   205 	public boolean isEnable() {
       
   206 		return enable;
       
   207 	}
       
   208 
       
   209 	/**
       
   210 	 * <!-- begin-user-doc -->
       
   211 	 * <!-- end-user-doc -->
       
   212 	 * @generated
       
   213 	 */
       
   214 	public void setEnable(boolean newEnable) {
       
   215 		boolean oldEnable = enable;
       
   216 		enable = newEnable;
       
   217 		boolean oldEnableESet = enableESet;
       
   218 		enableESet = true;
       
   219 		if (eNotificationRequired())
       
   220 			eNotify(new ENotificationImpl(this, Notification.SET, CSConfigPackage.FLAGS_TYPE__ENABLE, oldEnable, enable, !oldEnableESet));
       
   221 	}
       
   222 
       
   223 	/**
       
   224 	 * <!-- begin-user-doc -->
       
   225 	 * <!-- end-user-doc -->
       
   226 	 * @generated
       
   227 	 */
       
   228 	public void unsetEnable() {
       
   229 		boolean oldEnable = enable;
       
   230 		boolean oldEnableESet = enableESet;
       
   231 		enable = ENABLE_EDEFAULT;
       
   232 		enableESet = false;
       
   233 		if (eNotificationRequired())
       
   234 			eNotify(new ENotificationImpl(this, Notification.UNSET, CSConfigPackage.FLAGS_TYPE__ENABLE, oldEnable, ENABLE_EDEFAULT, oldEnableESet));
       
   235 	}
       
   236 
       
   237 	/**
       
   238 	 * <!-- begin-user-doc -->
       
   239 	 * <!-- end-user-doc -->
       
   240 	 * @generated
       
   241 	 */
       
   242 	public boolean isSetEnable() {
       
   243 		return enableESet;
       
   244 	}
       
   245 
       
   246 	/**
       
   247 	 * <!-- begin-user-doc -->
       
   248 	 * <!-- end-user-doc -->
       
   249 	 * @generated
       
   250 	 */
       
   251 	public SeverityType getSeverity() {
       
   252 		return severity;
       
   253 	}
       
   254 
       
   255 	/**
       
   256 	 * <!-- begin-user-doc -->
       
   257 	 * <!-- end-user-doc -->
       
   258 	 * @generated
       
   259 	 */
       
   260 	public void setSeverity(SeverityType newSeverity) {
       
   261 		SeverityType oldSeverity = severity;
       
   262 		severity = newSeverity == null ? SEVERITY_EDEFAULT : newSeverity;
       
   263 		boolean oldSeverityESet = severityESet;
       
   264 		severityESet = true;
       
   265 		if (eNotificationRequired())
       
   266 			eNotify(new ENotificationImpl(this, Notification.SET, CSConfigPackage.FLAGS_TYPE__SEVERITY, oldSeverity, severity, !oldSeverityESet));
       
   267 	}
       
   268 
       
   269 	/**
       
   270 	 * <!-- begin-user-doc -->
       
   271 	 * <!-- end-user-doc -->
       
   272 	 * @generated
       
   273 	 */
       
   274 	public void unsetSeverity() {
       
   275 		SeverityType oldSeverity = severity;
       
   276 		boolean oldSeverityESet = severityESet;
       
   277 		severity = SEVERITY_EDEFAULT;
       
   278 		severityESet = false;
       
   279 		if (eNotificationRequired())
       
   280 			eNotify(new ENotificationImpl(this, Notification.UNSET, CSConfigPackage.FLAGS_TYPE__SEVERITY, oldSeverity, SEVERITY_EDEFAULT, oldSeverityESet));
       
   281 	}
       
   282 
       
   283 	/**
       
   284 	 * <!-- begin-user-doc -->
       
   285 	 * <!-- end-user-doc -->
       
   286 	 * @generated
       
   287 	 */
       
   288 	public boolean isSetSeverity() {
       
   289 		return severityESet;
       
   290 	}
       
   291 
       
   292 	/**
       
   293 	 * <!-- begin-user-doc -->
       
   294 	 * <!-- end-user-doc -->
       
   295 	 * @generated
       
   296 	 */
       
   297 	@Override
       
   298 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
       
   299 		switch (featureID) {
       
   300 			case CSConfigPackage.FLAGS_TYPE__CATEGORY:
       
   301 				return getCategory();
       
   302 			case CSConfigPackage.FLAGS_TYPE__ENABLE:
       
   303 				return isEnable() ? Boolean.TRUE : Boolean.FALSE;
       
   304 			case CSConfigPackage.FLAGS_TYPE__SEVERITY:
       
   305 				return getSeverity();
       
   306 		}
       
   307 		return super.eGet(featureID, resolve, coreType);
       
   308 	}
       
   309 
       
   310 	/**
       
   311 	 * <!-- begin-user-doc -->
       
   312 	 * <!-- end-user-doc -->
       
   313 	 * @generated
       
   314 	 */
       
   315 	@Override
       
   316 	public void eSet(int featureID, Object newValue) {
       
   317 		switch (featureID) {
       
   318 			case CSConfigPackage.FLAGS_TYPE__CATEGORY:
       
   319 				setCategory((CategoryType)newValue);
       
   320 				return;
       
   321 			case CSConfigPackage.FLAGS_TYPE__ENABLE:
       
   322 				setEnable(((Boolean)newValue).booleanValue());
       
   323 				return;
       
   324 			case CSConfigPackage.FLAGS_TYPE__SEVERITY:
       
   325 				setSeverity((SeverityType)newValue);
       
   326 				return;
       
   327 		}
       
   328 		super.eSet(featureID, newValue);
       
   329 	}
       
   330 
       
   331 	/**
       
   332 	 * <!-- begin-user-doc -->
       
   333 	 * <!-- end-user-doc -->
       
   334 	 * @generated
       
   335 	 */
       
   336 	@Override
       
   337 	public void eUnset(int featureID) {
       
   338 		switch (featureID) {
       
   339 			case CSConfigPackage.FLAGS_TYPE__CATEGORY:
       
   340 				unsetCategory();
       
   341 				return;
       
   342 			case CSConfigPackage.FLAGS_TYPE__ENABLE:
       
   343 				unsetEnable();
       
   344 				return;
       
   345 			case CSConfigPackage.FLAGS_TYPE__SEVERITY:
       
   346 				unsetSeverity();
       
   347 				return;
       
   348 		}
       
   349 		super.eUnset(featureID);
       
   350 	}
       
   351 
       
   352 	/**
       
   353 	 * <!-- begin-user-doc -->
       
   354 	 * <!-- end-user-doc -->
       
   355 	 * @generated
       
   356 	 */
       
   357 	@Override
       
   358 	public boolean eIsSet(int featureID) {
       
   359 		switch (featureID) {
       
   360 			case CSConfigPackage.FLAGS_TYPE__CATEGORY:
       
   361 				return isSetCategory();
       
   362 			case CSConfigPackage.FLAGS_TYPE__ENABLE:
       
   363 				return isSetEnable();
       
   364 			case CSConfigPackage.FLAGS_TYPE__SEVERITY:
       
   365 				return isSetSeverity();
       
   366 		}
       
   367 		return super.eIsSet(featureID);
       
   368 	}
       
   369 
       
   370 	/**
       
   371 	 * <!-- begin-user-doc -->
       
   372 	 * <!-- end-user-doc -->
       
   373 	 * @generated
       
   374 	 */
       
   375 	@Override
       
   376 	public String toString() {
       
   377 		if (eIsProxy()) return super.toString();
       
   378 
       
   379 		StringBuffer result = new StringBuffer(super.toString());
       
   380 		result.append(" (category: ");
       
   381 		if (categoryESet) result.append(category); else result.append("<unset>");
       
   382 		result.append(", enable: ");
       
   383 		if (enableESet) result.append(enable); else result.append("<unset>");
       
   384 		result.append(", severity: ");
       
   385 		if (severityESet) result.append(severity); else result.append("<unset>");
       
   386 		result.append(')');
       
   387 		return result.toString();
       
   388 	}
       
   389 
       
   390 } //FlagsTypeImpl