blob: ec05dd049cebfab00ecd8174246b2d8589623628 [file] [log] [blame]
/**
* Copyright (c) 2020 CEA LIST.
*
* 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\n\nContributors:
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr
* - Initial API and Implementation
*/
package org.eclipse.efm.ecore.formalml.statemachine.impl;
import java.util.Collection;
import org.eclipse.efm.ecore.formalml.statemachine.Region;
import org.eclipse.efm.ecore.formalml.statemachine.State;
import org.eclipse.efm.ecore.formalml.statemachine.StatemachinePackage;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>State</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.efm.ecore.formalml.statemachine.impl.StateImpl#isSimple <em>Simple</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statemachine.impl.StateImpl#isComposite <em>Composite</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statemachine.impl.StateImpl#isOrthogonal <em>Orthogonal</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statemachine.impl.StateImpl#getRegion <em>Region</em>}</li>
* </ul>
*
* @generated
*/
public class StateImpl extends VertexImpl implements State {
/**
* The default value of the '{@link #isSimple() <em>Simple</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSimple()
* @generated
* @ordered
*/
protected static final boolean SIMPLE_EDEFAULT = false;
/**
* The cached value of the '{@link #isSimple() <em>Simple</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSimple()
* @generated
* @ordered
*/
protected boolean simple = SIMPLE_EDEFAULT;
/**
* The default value of the '{@link #isComposite() <em>Composite</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isComposite()
* @generated
* @ordered
*/
protected static final boolean COMPOSITE_EDEFAULT = false;
/**
* The cached value of the '{@link #isComposite() <em>Composite</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isComposite()
* @generated
* @ordered
*/
protected boolean composite = COMPOSITE_EDEFAULT;
/**
* The default value of the '{@link #isOrthogonal() <em>Orthogonal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOrthogonal()
* @generated
* @ordered
*/
protected static final boolean ORTHOGONAL_EDEFAULT = false;
/**
* The cached value of the '{@link #isOrthogonal() <em>Orthogonal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOrthogonal()
* @generated
* @ordered
*/
protected boolean orthogonal = ORTHOGONAL_EDEFAULT;
/**
* The cached value of the '{@link #getRegion() <em>Region</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRegion()
* @generated
* @ordered
*/
protected EList<Region> region;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected StateImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatemachinePackage.Literals.STATE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isSimple() {
return simple;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setSimple(boolean newSimple) {
boolean oldSimple = simple;
simple = newSimple;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.STATE__SIMPLE, oldSimple, simple));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isComposite() {
return composite;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setComposite(boolean newComposite) {
boolean oldComposite = composite;
composite = newComposite;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.STATE__COMPOSITE, oldComposite, composite));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isOrthogonal() {
return orthogonal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOrthogonal(boolean newOrthogonal) {
boolean oldOrthogonal = orthogonal;
orthogonal = newOrthogonal;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.STATE__ORTHOGONAL, oldOrthogonal, orthogonal));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Region> getRegion() {
if (region == null) {
region = new EObjectContainmentEList<Region>(Region.class, this, StatemachinePackage.STATE__REGION);
}
return region;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatemachinePackage.STATE__REGION:
return ((InternalEList<?>)getRegion()).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 StatemachinePackage.STATE__SIMPLE:
return isSimple();
case StatemachinePackage.STATE__COMPOSITE:
return isComposite();
case StatemachinePackage.STATE__ORTHOGONAL:
return isOrthogonal();
case StatemachinePackage.STATE__REGION:
return getRegion();
}
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 StatemachinePackage.STATE__SIMPLE:
setSimple((Boolean)newValue);
return;
case StatemachinePackage.STATE__COMPOSITE:
setComposite((Boolean)newValue);
return;
case StatemachinePackage.STATE__ORTHOGONAL:
setOrthogonal((Boolean)newValue);
return;
case StatemachinePackage.STATE__REGION:
getRegion().clear();
getRegion().addAll((Collection<? extends Region>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatemachinePackage.STATE__SIMPLE:
setSimple(SIMPLE_EDEFAULT);
return;
case StatemachinePackage.STATE__COMPOSITE:
setComposite(COMPOSITE_EDEFAULT);
return;
case StatemachinePackage.STATE__ORTHOGONAL:
setOrthogonal(ORTHOGONAL_EDEFAULT);
return;
case StatemachinePackage.STATE__REGION:
getRegion().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatemachinePackage.STATE__SIMPLE:
return simple != SIMPLE_EDEFAULT;
case StatemachinePackage.STATE__COMPOSITE:
return composite != COMPOSITE_EDEFAULT;
case StatemachinePackage.STATE__ORTHOGONAL:
return orthogonal != ORTHOGONAL_EDEFAULT;
case StatemachinePackage.STATE__REGION:
return region != null && !region.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (simple: ");
result.append(simple);
result.append(", composite: ");
result.append(composite);
result.append(", orthogonal: ");
result.append(orthogonal);
result.append(')');
return result.toString();
}
} //StateImpl