blob: d1c9243c0c2fc9d8dbfc932a57481e81cab8f509 [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 v2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*/
package org.eclipse.papyrus.aiml.profile.AIML.Transformer_layers.impl;
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.papyrus.aiml.profile.AIML.Normalization_layers.LayerNorm;
import org.eclipse.papyrus.aiml.profile.AIML.Transformer_layers.Transformer_layersPackage;
import org.eclipse.papyrus.aiml.profile.AIML.Transformer_layers.Transformer_layers_2;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Transformer layers 2</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Transformer_layers.impl.Transformer_layers_2Impl#getNum_layers <em>Num layers</em>}</li>
* <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Transformer_layers.impl.Transformer_layers_2Impl#getNorm <em>Norm</em>}</li>
* </ul>
*
* @generated
*/
public abstract class Transformer_layers_2Impl extends Transformer_layersImpl implements Transformer_layers_2 {
/**
* The default value of the '{@link #getNum_layers() <em>Num layers</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNum_layers()
* @generated
* @ordered
*/
protected static final int NUM_LAYERS_EDEFAULT = 0;
/**
* The cached value of the '{@link #getNum_layers() <em>Num layers</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNum_layers()
* @generated
* @ordered
*/
protected int num_layers = NUM_LAYERS_EDEFAULT;
/**
* The cached value of the '{@link #getNorm() <em>Norm</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNorm()
* @generated
* @ordered
*/
protected LayerNorm norm;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Transformer_layers_2Impl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return Transformer_layersPackage.Literals.TRANSFORMER_LAYERS_2;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int getNum_layers() {
return num_layers;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setNum_layers(int newNum_layers) {
int oldNum_layers = num_layers;
num_layers = newNum_layers;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Transformer_layersPackage.TRANSFORMER_LAYERS_2__NUM_LAYERS, oldNum_layers, num_layers));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LayerNorm getNorm() {
if (norm != null && norm.eIsProxy()) {
InternalEObject oldNorm = (InternalEObject)norm;
norm = (LayerNorm)eResolveProxy(oldNorm);
if (norm != oldNorm) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, Transformer_layersPackage.TRANSFORMER_LAYERS_2__NORM, oldNorm, norm));
}
}
return norm;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LayerNorm basicGetNorm() {
return norm;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setNorm(LayerNorm newNorm) {
LayerNorm oldNorm = norm;
norm = newNorm;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Transformer_layersPackage.TRANSFORMER_LAYERS_2__NORM, oldNorm, norm));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NUM_LAYERS:
return getNum_layers();
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NORM:
if (resolve) return getNorm();
return basicGetNorm();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NUM_LAYERS:
setNum_layers((Integer)newValue);
return;
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NORM:
setNorm((LayerNorm)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NUM_LAYERS:
setNum_layers(NUM_LAYERS_EDEFAULT);
return;
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NORM:
setNorm((LayerNorm)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NUM_LAYERS:
return num_layers != NUM_LAYERS_EDEFAULT;
case Transformer_layersPackage.TRANSFORMER_LAYERS_2__NORM:
return norm != null;
}
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(" (num_layers: "); //$NON-NLS-1$
result.append(num_layers);
result.append(')');
return result.toString();
}
} //Transformer_layers_2Impl