blob: 860bbe457458c5422980e73b730501465a50e088 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* BMW Car IT - Initial API and implementation
* Technische Universitaet Muenchen - Major refactoring and extension
*******************************************************************************/
package org.eclipse.emf.edapt.spi.history.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.edapt.spi.history.Change;
import org.eclipse.emf.edapt.spi.history.HistoryPackage;
import org.eclipse.emf.edapt.spi.history.Release;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Change</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.edapt.spi.history.impl.ChangeImpl#isBreaking <em>Breaking</em>}</li>
* <li>{@link org.eclipse.emf.edapt.spi.history.impl.ChangeImpl#getDescription <em>Description</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class ChangeImpl extends EObjectImpl implements Change {
/**
* The default value of the '{@link #isBreaking() <em>Breaking</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #isBreaking()
* @generated
* @ordered
*/
protected static final boolean BREAKING_EDEFAULT = false;
/**
* The cached value of the '{@link #isBreaking() <em>Breaking</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #isBreaking()
* @generated
* @ordered
*/
protected boolean breaking = BREAKING_EDEFAULT;
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected ChangeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return HistoryPackage.Literals.CHANGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isBreaking() {
return breaking;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setBreaking(boolean newBreaking) {
final boolean oldBreaking = breaking;
breaking = newBreaking;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, HistoryPackage.CHANGE__BREAKING, oldBreaking,
breaking));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setDescription(String newDescription) {
final String oldDescription = description;
description = newDescription;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, HistoryPackage.CHANGE__DESCRIPTION, oldDescription,
description));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public Release getRelease() {
EObject element = eContainer();
while (element != null && !(element instanceof Release)) {
element = element.eContainer();
}
return (Release) element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case HistoryPackage.CHANGE__BREAKING:
return isBreaking();
case HistoryPackage.CHANGE__DESCRIPTION:
return getDescription();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case HistoryPackage.CHANGE__BREAKING:
setBreaking((Boolean) newValue);
return;
case HistoryPackage.CHANGE__DESCRIPTION:
setDescription((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case HistoryPackage.CHANGE__BREAKING:
setBreaking(BREAKING_EDEFAULT);
return;
case HistoryPackage.CHANGE__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case HistoryPackage.CHANGE__BREAKING:
return breaking != BREAKING_EDEFAULT;
case HistoryPackage.CHANGE__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
final StringBuffer result = new StringBuffer(super.toString());
result.append(" (breaking: "); //$NON-NLS-1$
result.append(breaking);
result.append(", description: "); //$NON-NLS-1$
result.append(description);
result.append(')');
return result.toString();
}
} // ChangeImpl