/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.foundation.businessinformation.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import orgomg.cwm.foundation.businessinformation.BusinessinformationPackage;
import orgomg.cwm.foundation.businessinformation.Contact;
import orgomg.cwm.foundation.businessinformation.Location;
import orgomg.cwm.objectmodel.core.impl.ModelElementImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Location</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getLocationType <em>Location Type</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getAddress <em>Address</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getCity <em>City</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getPostCode <em>Post Code</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getArea <em>Area</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getCountry <em>Country</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.LocationImpl#getContact <em>Contact</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LocationImpl extends ModelElementImpl implements Location {
/**
* The default value of the '{@link #getLocationType() <em>Location Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLocationType()
* @generated
* @ordered
*/
protected static final String LOCATION_TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getLocationType() <em>Location Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLocationType()
* @generated
* @ordered
*/
protected String locationType = LOCATION_TYPE_EDEFAULT;
/**
* The default value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected static final String ADDRESS_EDEFAULT = null;
/**
* The cached value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected String address = ADDRESS_EDEFAULT;
/**
* The default value of the '{@link #getCity() <em>City</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCity()
* @generated
* @ordered
*/
protected static final String CITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getCity() <em>City</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCity()
* @generated
* @ordered
*/
protected String city = CITY_EDEFAULT;
/**
* The default value of the '{@link #getPostCode() <em>Post Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPostCode()
* @generated
* @ordered
*/
protected static final String POST_CODE_EDEFAULT = null;
/**
* The cached value of the '{@link #getPostCode() <em>Post Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPostCode()
* @generated
* @ordered
*/
protected String postCode = POST_CODE_EDEFAULT;
/**
* The default value of the '{@link #getArea() <em>Area</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArea()
* @generated
* @ordered
*/
protected static final String AREA_EDEFAULT = null;
/**
* The cached value of the '{@link #getArea() <em>Area</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArea()
* @generated
* @ordered
*/
protected String area = AREA_EDEFAULT;
/**
* The default value of the '{@link #getCountry() <em>Country</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCountry()
* @generated
* @ordered
*/
protected static final String COUNTRY_EDEFAULT = null;
/**
* The cached value of the '{@link #getCountry() <em>Country</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCountry()
* @generated
* @ordered
*/
protected String country = COUNTRY_EDEFAULT;
/**
* The cached value of the '{@link #getContact() <em>Contact</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContact()
* @generated
* @ordered
*/
protected EList<Contact> contact;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LocationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BusinessinformationPackage.Literals.LOCATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLocationType() {
return locationType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLocationType(String newLocationType) {
String oldLocationType = locationType;
locationType = newLocationType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.LOCATION__LOCATION_TYPE, oldLocationType, locationType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAddress() {
return address;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAddress(String newAddress) {
String oldAddress = address;
address = newAddress;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.LOCATION__ADDRESS, oldAddress, address));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCity() {
return city;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCity(String newCity) {
String oldCity = city;
city = newCity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.LOCATION__CITY, oldCity, city));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPostCode() {
return postCode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPostCode(String newPostCode) {
String oldPostCode = postCode;
postCode = newPostCode;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.LOCATION__POST_CODE, oldPostCode, postCode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getArea() {
return area;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setArea(String newArea) {
String oldArea = area;
area = newArea;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.LOCATION__AREA, oldArea, area));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCountry() {
return country;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCountry(String newCountry) {
String oldCountry = country;
country = newCountry;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.LOCATION__COUNTRY, oldCountry, country));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Contact> getContact() {
if (contact == null) {
contact = new EObjectWithInverseResolvingEList.ManyInverse<Contact>(Contact.class, this, BusinessinformationPackage.LOCATION__CONTACT, BusinessinformationPackage.CONTACT__LOCATION);
}
return contact;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BusinessinformationPackage.LOCATION__CONTACT:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getContact()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BusinessinformationPackage.LOCATION__CONTACT:
return ((InternalEList<?>)getContact()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BusinessinformationPackage.LOCATION__LOCATION_TYPE:
return getLocationType();
case BusinessinformationPackage.LOCATION__ADDRESS:
return getAddress();
case BusinessinformationPackage.LOCATION__CITY:
return getCity();
case BusinessinformationPackage.LOCATION__POST_CODE:
return getPostCode();
case BusinessinformationPackage.LOCATION__AREA:
return getArea();
case BusinessinformationPackage.LOCATION__COUNTRY:
return getCountry();
case BusinessinformationPackage.LOCATION__CONTACT:
return getContact();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BusinessinformationPackage.LOCATION__LOCATION_TYPE:
setLocationType((String)newValue);
return;
case BusinessinformationPackage.LOCATION__ADDRESS:
setAddress((String)newValue);
return;
case BusinessinformationPackage.LOCATION__CITY:
setCity((String)newValue);
return;
case BusinessinformationPackage.LOCATION__POST_CODE:
setPostCode((String)newValue);
return;
case BusinessinformationPackage.LOCATION__AREA:
setArea((String)newValue);
return;
case BusinessinformationPackage.LOCATION__COUNTRY:
setCountry((String)newValue);
return;
case BusinessinformationPackage.LOCATION__CONTACT:
getContact().clear();
getContact().addAll((Collection<? extends Contact>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BusinessinformationPackage.LOCATION__LOCATION_TYPE:
setLocationType(LOCATION_TYPE_EDEFAULT);
return;
case BusinessinformationPackage.LOCATION__ADDRESS:
setAddress(ADDRESS_EDEFAULT);
return;
case BusinessinformationPackage.LOCATION__CITY:
setCity(CITY_EDEFAULT);
return;
case BusinessinformationPackage.LOCATION__POST_CODE:
setPostCode(POST_CODE_EDEFAULT);
return;
case BusinessinformationPackage.LOCATION__AREA:
setArea(AREA_EDEFAULT);
return;
case BusinessinformationPackage.LOCATION__COUNTRY:
setCountry(COUNTRY_EDEFAULT);
return;
case BusinessinformationPackage.LOCATION__CONTACT:
getContact().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BusinessinformationPackage.LOCATION__LOCATION_TYPE:
return LOCATION_TYPE_EDEFAULT == null ? locationType != null : !LOCATION_TYPE_EDEFAULT.equals(locationType);
case BusinessinformationPackage.LOCATION__ADDRESS:
return ADDRESS_EDEFAULT == null ? address != null : !ADDRESS_EDEFAULT.equals(address);
case BusinessinformationPackage.LOCATION__CITY:
return CITY_EDEFAULT == null ? city != null : !CITY_EDEFAULT.equals(city);
case BusinessinformationPackage.LOCATION__POST_CODE:
return POST_CODE_EDEFAULT == null ? postCode != null : !POST_CODE_EDEFAULT.equals(postCode);
case BusinessinformationPackage.LOCATION__AREA:
return AREA_EDEFAULT == null ? area != null : !AREA_EDEFAULT.equals(area);
case BusinessinformationPackage.LOCATION__COUNTRY:
return COUNTRY_EDEFAULT == null ? country != null : !COUNTRY_EDEFAULT.equals(country);
case BusinessinformationPackage.LOCATION__CONTACT:
return contact != null && !contact.isEmpty();
}
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(" (locationType: ");
result.append(locationType);
result.append(", address: ");
result.append(address);
result.append(", city: ");
result.append(city);
result.append(", postCode: ");
result.append(postCode);
result.append(", area: ");
result.append(area);
result.append(", country: ");
result.append(country);
result.append(')');
return result.toString();
}
} //LocationImpl