/*******************************************************************************
* Copyright (c) 2010 Michal Antkiewicz.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Michal Antkiewicz - initial API and implementation
******************************************************************************/
/**
*
*
*
* $Id: PartImpl.java,v 1.7 2008/06/26 19:28:45 Michal Antkiewicz <mantkiew@gsd.uwaterloo.ca> $
*/
package ca.uwaterloo.gsd.wpi.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import ca.uwaterloo.gsd.fsml.fsml.impl.ConceptImpl;
import ca.uwaterloo.gsd.wpi.Part;
import ca.uwaterloo.gsd.wpi.WpiPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Part</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link ca.uwaterloo.gsd.wpi.impl.PartImpl#getName <em>Name</em>}</li>
* <li>{@link ca.uwaterloo.gsd.wpi.impl.PartImpl#getPackage <em>Package</em>}</li>
* <li>{@link ca.uwaterloo.gsd.wpi.impl.PartImpl#isLocal <em>Local</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class PartImpl extends ConceptImpl implements Part {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getPackage() <em>Package</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPackage()
* @generated
* @ordered
*/
protected static final String PACKAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getPackage() <em>Package</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPackage()
* @generated
* @ordered
*/
protected String package_ = PACKAGE_EDEFAULT;
/**
* The default value of the '{@link #isLocal() <em>Local</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isLocal()
* @generated
* @ordered
*/
protected static final boolean LOCAL_EDEFAULT = true;
/**
* The cached value of the '{@link #isLocal() <em>Local</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isLocal()
* @generated
* @ordered
*/
protected boolean local = LOCAL_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PartImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return WpiPackage.Literals.PART;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WpiPackage.PART__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPackage() {
return package_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPackage(String newPackage) {
String oldPackage = package_;
package_ = newPackage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WpiPackage.PART__PACKAGE, oldPackage, package_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isLocal() {
return local;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLocal(boolean newLocal) {
boolean oldLocal = local;
local = newLocal;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WpiPackage.PART__LOCAL, oldLocal, local));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String getFullyQualifiedName() {
if (package_ != null)
return package_ + "." + name;
else
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case WpiPackage.PART__NAME:
return getName();
case WpiPackage.PART__PACKAGE:
return getPackage();
case WpiPackage.PART__LOCAL:
return isLocal() ? Boolean.TRUE : Boolean.FALSE;
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case WpiPackage.PART__NAME:
setName((String)newValue);
return;
case WpiPackage.PART__PACKAGE:
setPackage((String)newValue);
return;
case WpiPackage.PART__LOCAL:
setLocal(((Boolean)newValue).booleanValue());
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case WpiPackage.PART__NAME:
setName(NAME_EDEFAULT);
return;
case WpiPackage.PART__PACKAGE:
setPackage(PACKAGE_EDEFAULT);
return;
case WpiPackage.PART__LOCAL:
setLocal(LOCAL_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case WpiPackage.PART__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case WpiPackage.PART__PACKAGE:
return PACKAGE_EDEFAULT == null ? package_ != null : !PACKAGE_EDEFAULT.equals(package_);
case WpiPackage.PART__LOCAL:
return local != LOCAL_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", package: ");
result.append(package_);
result.append(", local: ");
result.append(local);
result.append(')');
return result.toString();
}
} //PartImpl