imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/iqrf/impl/TargetImpl.java
changeset 0 61163b28edca
equal deleted inserted replaced
-1:000000000000 0:61163b28edca
       
     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.iqrf.impl;
       
    18 
       
    19 
       
    20 import org.eclipse.emf.common.notify.Notification;
       
    21 import org.eclipse.emf.ecore.EClass;
       
    22 import org.eclipse.emf.ecore.impl.ENotificationImpl;
       
    23 import org.eclipse.emf.ecore.impl.EObjectImpl;
       
    24 
       
    25 import com.nokia.s60tools.imaker.internal.iqrf.IQRFPackage;
       
    26 import com.nokia.s60tools.imaker.internal.iqrf.Target;
       
    27 import com.nokia.s60tools.imaker.internal.iqrf.util.IQRFUtil;
       
    28 
       
    29 /**
       
    30  * <!-- begin-user-doc -->
       
    31  * An implementation of the model object '<em><b>Target</b></em>'.
       
    32  * <!-- end-user-doc -->
       
    33  * <p>
       
    34  * The following features are implemented:
       
    35  * <ul>
       
    36  *   <li>{@link com.nokia.s60tools.imaker.internal.iqrf.impl.TargetImpl#getName <em>Name</em>}</li>
       
    37  *   <li>{@link com.nokia.s60tools.imaker.internal.iqrf.impl.TargetImpl#getDescription <em>Description</em>}</li>
       
    38  * </ul>
       
    39  * </p>
       
    40  *
       
    41  * @generated
       
    42  */
       
    43 public class TargetImpl extends EObjectImpl implements Target {
       
    44 	/**
       
    45 	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
       
    46 	 * <!-- begin-user-doc -->
       
    47 	 * <!-- end-user-doc -->
       
    48 	 * @see #getName()
       
    49 	 * @generated
       
    50 	 * @ordered
       
    51 	 */
       
    52 	protected static final String NAME_EDEFAULT = "";
       
    53 
       
    54 	/**
       
    55 	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
       
    56 	 * <!-- begin-user-doc -->
       
    57 	 * <!-- end-user-doc -->
       
    58 	 * @see #getName()
       
    59 	 * @generated
       
    60 	 * @ordered
       
    61 	 */
       
    62 	protected String name = NAME_EDEFAULT;
       
    63 
       
    64 	/**
       
    65 	 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
       
    66 	 * <!-- begin-user-doc -->
       
    67 	 * <!-- end-user-doc -->
       
    68 	 * @see #getDescription()
       
    69 	 * @generated
       
    70 	 * @ordered
       
    71 	 */
       
    72 	protected static final String DESCRIPTION_EDEFAULT = "";
       
    73 
       
    74 	/**
       
    75 	 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
       
    76 	 * <!-- begin-user-doc -->
       
    77 	 * <!-- end-user-doc -->
       
    78 	 * @see #getDescription()
       
    79 	 * @generated
       
    80 	 * @ordered
       
    81 	 */
       
    82 	protected String description = DESCRIPTION_EDEFAULT;
       
    83 
       
    84 	/**
       
    85 	 * <!-- begin-user-doc -->
       
    86 	 * <!-- end-user-doc -->
       
    87 	 * @generated
       
    88 	 */
       
    89 	protected TargetImpl() {
       
    90 		super();
       
    91 	}
       
    92 
       
    93 	/**
       
    94 	 * <!-- begin-user-doc -->
       
    95 	 * <!-- end-user-doc -->
       
    96 	 * @generated
       
    97 	 */
       
    98 	protected EClass eStaticClass() {
       
    99 		return IQRFPackage.Literals.TARGET;
       
   100 	}
       
   101 
       
   102 	/**
       
   103 	 * <!-- begin-user-doc -->
       
   104 	 * <!-- end-user-doc -->
       
   105 	 * @generated
       
   106 	 */
       
   107 	public String getName() {
       
   108 		return name;
       
   109 	}
       
   110 
       
   111 	/**
       
   112 	 * <!-- begin-user-doc -->
       
   113 	 * <!-- end-user-doc -->
       
   114 	 * @generated
       
   115 	 */
       
   116 	public void setName(String newName) {
       
   117 		String oldName = name;
       
   118 		name = newName;
       
   119 		if (eNotificationRequired())
       
   120 			eNotify(new ENotificationImpl(this, Notification.SET, IQRFPackage.TARGET__NAME, oldName, name));
       
   121 	}
       
   122 
       
   123 	/**
       
   124 	 * <!-- begin-user-doc -->
       
   125 	 * <!-- end-user-doc -->
       
   126 	 * @generated
       
   127 	 */
       
   128 	public String getDescription() {
       
   129 		return description;
       
   130 	}
       
   131 
       
   132 	/**
       
   133 	 * <!-- begin-user-doc -->
       
   134 	 * <!-- end-user-doc -->
       
   135 	 * @generated
       
   136 	 */
       
   137 	public void setDescription(String newDescription) {
       
   138 		String oldDescription = description;
       
   139 		description = newDescription;
       
   140 		if (eNotificationRequired())
       
   141 			eNotify(new ENotificationImpl(this, Notification.SET, IQRFPackage.TARGET__DESCRIPTION, oldDescription, description));
       
   142 	}
       
   143 
       
   144 	/**
       
   145 	 * <!-- begin-user-doc -->
       
   146 	 * <!-- end-user-doc -->
       
   147 	 * @generated
       
   148 	 */
       
   149 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
       
   150 		switch (featureID) {
       
   151 			case IQRFPackage.TARGET__NAME:
       
   152 				return getName();
       
   153 			case IQRFPackage.TARGET__DESCRIPTION:
       
   154 				return getDescription();
       
   155 		}
       
   156 		return super.eGet(featureID, resolve, coreType);
       
   157 	}
       
   158 
       
   159 	/**
       
   160 	 * <!-- begin-user-doc -->
       
   161 	 * <!-- end-user-doc -->
       
   162 	 * @generated
       
   163 	 */
       
   164 	public void eSet(int featureID, Object newValue) {
       
   165 		switch (featureID) {
       
   166 			case IQRFPackage.TARGET__NAME:
       
   167 				setName((String)newValue);
       
   168 				return;
       
   169 			case IQRFPackage.TARGET__DESCRIPTION:
       
   170 				setDescription((String)newValue);
       
   171 				return;
       
   172 		}
       
   173 		super.eSet(featureID, newValue);
       
   174 	}
       
   175 
       
   176 	/**
       
   177 	 * <!-- begin-user-doc -->
       
   178 	 * <!-- end-user-doc -->
       
   179 	 * @generated
       
   180 	 */
       
   181 	public void eUnset(int featureID) {
       
   182 		switch (featureID) {
       
   183 			case IQRFPackage.TARGET__NAME:
       
   184 				setName(NAME_EDEFAULT);
       
   185 				return;
       
   186 			case IQRFPackage.TARGET__DESCRIPTION:
       
   187 				setDescription(DESCRIPTION_EDEFAULT);
       
   188 				return;
       
   189 		}
       
   190 		super.eUnset(featureID);
       
   191 	}
       
   192 
       
   193 	/**
       
   194 	 * <!-- begin-user-doc -->
       
   195 	 * <!-- end-user-doc -->
       
   196 	 * @generated
       
   197 	 */
       
   198 	public boolean eIsSet(int featureID) {
       
   199 		switch (featureID) {
       
   200 			case IQRFPackage.TARGET__NAME:
       
   201 				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
       
   202 			case IQRFPackage.TARGET__DESCRIPTION:
       
   203 				return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
       
   204 		}
       
   205 		return super.eIsSet(featureID);
       
   206 	}
       
   207 
       
   208 	/**
       
   209 	 * <!-- begin-user-doc -->
       
   210 	 * <!-- end-user-doc -->
       
   211 	 * @generated
       
   212 	 */
       
   213 	public String toString() {
       
   214 		if (eIsProxy()) return super.toString();
       
   215 
       
   216 		StringBuffer result = new StringBuffer(super.toString());
       
   217 		result.append(" (name: ");
       
   218 		result.append(name);
       
   219 		result.append(", description: ");
       
   220 		result.append(description);
       
   221 		result.append(')');
       
   222 		return result.toString();
       
   223 	}
       
   224 	
       
   225 	public boolean equals(Object object) {
       
   226 		if(object==null || !(object instanceof Target)) return false;
       
   227 		Target other = (Target)object;
       
   228 		return IQRFUtil.equals(getName(),other.getName()) && 
       
   229 		       IQRFUtil.equals(getDescription(),other.getDescription());
       
   230 	}
       
   231 	
       
   232 	@Override
       
   233 	public int hashCode() {
       
   234 		final int hashMultiplier = 41;
       
   235 		int result = 7;
       
   236 		result=result*hashMultiplier + getName().hashCode();
       
   237 		result=result*hashMultiplier + getDescription().hashCode();
       
   238 		return result;
       
   239 	}
       
   240 } //TargetImpl