/**
* Copyright (c) 2012-2016 Marsha Chechik, Alessio Di Sandro, Michalis Famelis,
* Rick Salay.
* 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:
* Alessio Di Sandro - Implementation.
*/
package edu.toronto.cs.se.modelepedia.tutorial.state.impl;
import edu.toronto.cs.se.modelepedia.tutorial.state.City;
import edu.toronto.cs.se.modelepedia.tutorial.state.StatePackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>City</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link edu.toronto.cs.se.modelepedia.tutorial.state.impl.CityImpl#getPopulation <em>Population</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class CityImpl extends NamedElementImpl implements City {
/**
* The default value of the '{@link #getPopulation() <em>Population</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopulation()
* @generated
* @ordered
*/
protected static final int POPULATION_EDEFAULT = 0;
/**
* The cached value of the '{@link #getPopulation() <em>Population</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopulation()
* @generated
* @ordered
*/
protected int population = POPULATION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CityImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatePackage.Literals.CITY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getPopulation() {
return population;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPopulation(int newPopulation) {
int oldPopulation = population;
population = newPopulation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatePackage.CITY__POPULATION, oldPopulation, population));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case StatePackage.CITY__POPULATION:
return getPopulation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StatePackage.CITY__POPULATION:
setPopulation((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatePackage.CITY__POPULATION:
setPopulation(POPULATION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatePackage.CITY__POPULATION:
return population != POPULATION_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(" (population: ");
result.append(population);
result.append(')');
return result.toString();
}
} //CityImpl