blob: c824e0b416c7f1bb39d2346083bc3dec7d247ee9 [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 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:
* Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.aas.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.papyrus.aas.AASPackage;
import org.eclipse.papyrus.aas.Key;
import org.eclipse.papyrus.aas.KeyElements;
import org.eclipse.papyrus.aas.KeyType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Key</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.aas.impl.KeyImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.papyrus.aas.impl.KeyImpl#isLocal <em>Local</em>}</li>
* <li>{@link org.eclipse.papyrus.aas.impl.KeyImpl#getValue <em>Value</em>}</li>
* <li>{@link org.eclipse.papyrus.aas.impl.KeyImpl#getIdType <em>Id Type</em>}</li>
* </ul>
*
* @generated
*/
public class KeyImpl extends MinimalEObjectImpl.Container implements Key {
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getType()
* @generated
* @ordered
*/
protected static final KeyElements TYPE_EDEFAULT = KeyElements.GLOBAL_REFERENCE;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getType()
* @generated
* @ordered
*/
protected KeyElements type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #isLocal() <em>Local</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #isLocal()
* @generated
* @ordered
*/
protected static final boolean LOCAL_EDEFAULT = true;
/**
* The cached value of the '{@link #isLocal() <em>Local</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #isLocal()
* @generated
* @ordered
*/
protected boolean local = LOCAL_EDEFAULT;
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getIdType() <em>Id Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getIdType()
* @generated
* @ordered
*/
protected static final KeyType ID_TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getIdType() <em>Id Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getIdType()
* @generated
* @ordered
*/
protected KeyType idType = ID_TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected KeyImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return AASPackage.Literals.KEY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public KeyElements getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setType(KeyElements newType) {
KeyElements oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.KEY__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public boolean isLocal() {
return local;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setLocal(boolean newLocal) {
boolean oldLocal = local;
local = newLocal;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.KEY__LOCAL, oldLocal, local));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.KEY__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public KeyType getIdType() {
return idType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setIdType(KeyType newIdType) {
KeyType oldIdType = idType;
idType = newIdType == null ? ID_TYPE_EDEFAULT : newIdType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.KEY__ID_TYPE, oldIdType, idType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AASPackage.KEY__TYPE:
return getType();
case AASPackage.KEY__LOCAL:
return isLocal();
case AASPackage.KEY__VALUE:
return getValue();
case AASPackage.KEY__ID_TYPE:
return getIdType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AASPackage.KEY__TYPE:
setType((KeyElements) newValue);
return;
case AASPackage.KEY__LOCAL:
setLocal((Boolean) newValue);
return;
case AASPackage.KEY__VALUE:
setValue((String) newValue);
return;
case AASPackage.KEY__ID_TYPE:
setIdType((KeyType) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AASPackage.KEY__TYPE:
setType(TYPE_EDEFAULT);
return;
case AASPackage.KEY__LOCAL:
setLocal(LOCAL_EDEFAULT);
return;
case AASPackage.KEY__VALUE:
setValue(VALUE_EDEFAULT);
return;
case AASPackage.KEY__ID_TYPE:
setIdType(ID_TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AASPackage.KEY__TYPE:
return type != TYPE_EDEFAULT;
case AASPackage.KEY__LOCAL:
return local != LOCAL_EDEFAULT;
case AASPackage.KEY__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
case AASPackage.KEY__ID_TYPE:
return idType != ID_TYPE_EDEFAULT;
}
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(" (type: ");
result.append(type);
result.append(", local: ");
result.append(local);
result.append(", value: ");
result.append(value);
result.append(", idType: ");
result.append(idType);
result.append(')');
return result.toString();
}
} // KeyImpl