/*******************************************************************************
* Copyright (c) 2013-2016 Jean-Marie Gauthier, University of Franche-Comte, and Samares-Engineering
* 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:
* Jean-Marie Gauthier, University of Franche-Comte - initial API and implementation
* Jean-Marie Gauthier, Samares-Engineering - Neon implementation
*******************************************************************************/
/**
*/
package edu.ufc.femtost.disc.sysml4modelica.profile.other.impl;
import edu.ufc.femtost.disc.sysml4modelica.profile.classes.ModelicaModel;
import edu.ufc.femtost.disc.sysml4modelica.profile.other.ModelicaSimulation;
import edu.ufc.femtost.disc.sysml4modelica.profile.other.otherPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Modelica Simulation</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.other.impl.ModelicaSimulationImpl#getStartTime <em>Start Time</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.other.impl.ModelicaSimulationImpl#getStopTime <em>Stop Time</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.other.impl.ModelicaSimulationImpl#getModel <em>Model</em>}</li>
* </ul>
*
* @generated
*/
public class ModelicaSimulationImpl extends MinimalEObjectImpl.Container implements ModelicaSimulation {
/**
* The default value of the '{@link #getStartTime() <em>Start Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartTime()
* @generated
* @ordered
*/
protected static final double START_TIME_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getStartTime() <em>Start Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartTime()
* @generated
* @ordered
*/
protected double startTime = START_TIME_EDEFAULT;
/**
* The default value of the '{@link #getStopTime() <em>Stop Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStopTime()
* @generated
* @ordered
*/
protected static final double STOP_TIME_EDEFAULT = 1.0;
/**
* The cached value of the '{@link #getStopTime() <em>Stop Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStopTime()
* @generated
* @ordered
*/
protected double stopTime = STOP_TIME_EDEFAULT;
/**
* The cached value of the '{@link #getModel() <em>Model</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModel()
* @generated
* @ordered
*/
protected ModelicaModel model;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ModelicaSimulationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return otherPackage.Literals.MODELICA_SIMULATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public double getStartTime() {
return startTime;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStartTime(double newStartTime) {
double oldStartTime = startTime;
startTime = newStartTime;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, otherPackage.MODELICA_SIMULATION__START_TIME, oldStartTime, startTime));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public double getStopTime() {
return stopTime;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStopTime(double newStopTime) {
double oldStopTime = stopTime;
stopTime = newStopTime;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, otherPackage.MODELICA_SIMULATION__STOP_TIME, oldStopTime, stopTime));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelicaModel getModel() {
if (model != null && model.eIsProxy()) {
InternalEObject oldModel = (InternalEObject)model;
model = (ModelicaModel)eResolveProxy(oldModel);
if (model != oldModel) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, otherPackage.MODELICA_SIMULATION__MODEL, oldModel, model));
}
}
return model;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelicaModel basicGetModel() {
return model;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setModel(ModelicaModel newModel) {
ModelicaModel oldModel = model;
model = newModel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, otherPackage.MODELICA_SIMULATION__MODEL, oldModel, model));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case otherPackage.MODELICA_SIMULATION__START_TIME:
return getStartTime();
case otherPackage.MODELICA_SIMULATION__STOP_TIME:
return getStopTime();
case otherPackage.MODELICA_SIMULATION__MODEL:
if (resolve) return getModel();
return basicGetModel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case otherPackage.MODELICA_SIMULATION__START_TIME:
setStartTime((Double)newValue);
return;
case otherPackage.MODELICA_SIMULATION__STOP_TIME:
setStopTime((Double)newValue);
return;
case otherPackage.MODELICA_SIMULATION__MODEL:
setModel((ModelicaModel)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case otherPackage.MODELICA_SIMULATION__START_TIME:
setStartTime(START_TIME_EDEFAULT);
return;
case otherPackage.MODELICA_SIMULATION__STOP_TIME:
setStopTime(STOP_TIME_EDEFAULT);
return;
case otherPackage.MODELICA_SIMULATION__MODEL:
setModel((ModelicaModel)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case otherPackage.MODELICA_SIMULATION__START_TIME:
return startTime != START_TIME_EDEFAULT;
case otherPackage.MODELICA_SIMULATION__STOP_TIME:
return stopTime != STOP_TIME_EDEFAULT;
case otherPackage.MODELICA_SIMULATION__MODEL:
return model != null;
}
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(" (startTime: ");
result.append(startTime);
result.append(", stopTime: ");
result.append(stopTime);
result.append(')');
return result.toString();
}
} //ModelicaSimulationImpl