| /** |
| * 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.Dropout_layers.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| |
| import org.eclipse.papyrus.aiml.profile.AIML.Dropout_layers.Dropout_layers; |
| import org.eclipse.papyrus.aiml.profile.AIML.Dropout_layers.Dropout_layersPackage; |
| import org.eclipse.papyrus.aiml.profile.AIML.Module.impl.ModelImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Dropout layers</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Dropout_layers.impl.Dropout_layersImpl#getP <em>P</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Dropout_layers.impl.Dropout_layersImpl#isInplace <em>Inplace</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Dropout_layers.impl.Dropout_layersImpl#getNoise_shape <em>Noise shape</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Dropout_layers.impl.Dropout_layersImpl#getSeed <em>Seed</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class Dropout_layersImpl extends ModelImpl implements Dropout_layers { |
| /** |
| * The default value of the '{@link #getP() <em>P</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getP() |
| * @generated |
| * @ordered |
| */ |
| protected static final double P_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getP() <em>P</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getP() |
| * @generated |
| * @ordered |
| */ |
| protected double p = P_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isInplace() <em>Inplace</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isInplace() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean INPLACE_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isInplace() <em>Inplace</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isInplace() |
| * @generated |
| * @ordered |
| */ |
| protected boolean inplace = INPLACE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getNoise_shape() <em>Noise shape</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNoise_shape() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Integer> noise_shape; |
| |
| /** |
| * The default value of the '{@link #getSeed() <em>Seed</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSeed() |
| * @generated |
| * @ordered |
| */ |
| protected static final int SEED_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getSeed() <em>Seed</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSeed() |
| * @generated |
| * @ordered |
| */ |
| protected int seed = SEED_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected Dropout_layersImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return Dropout_layersPackage.Literals.DROPOUT_LAYERS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public double getP() { |
| return p; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setP(double newP) { |
| double oldP = p; |
| p = newP; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Dropout_layersPackage.DROPOUT_LAYERS__P, oldP, p)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isInplace() { |
| return inplace; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setInplace(boolean newInplace) { |
| boolean oldInplace = inplace; |
| inplace = newInplace; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Dropout_layersPackage.DROPOUT_LAYERS__INPLACE, oldInplace, inplace)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<Integer> getNoise_shape() { |
| if (noise_shape == null) { |
| noise_shape = new EDataTypeUniqueEList<Integer>(Integer.class, this, Dropout_layersPackage.DROPOUT_LAYERS__NOISE_SHAPE); |
| } |
| return noise_shape; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getSeed() { |
| return seed; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setSeed(int newSeed) { |
| int oldSeed = seed; |
| seed = newSeed; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Dropout_layersPackage.DROPOUT_LAYERS__SEED, oldSeed, seed)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case Dropout_layersPackage.DROPOUT_LAYERS__P: |
| return getP(); |
| case Dropout_layersPackage.DROPOUT_LAYERS__INPLACE: |
| return isInplace(); |
| case Dropout_layersPackage.DROPOUT_LAYERS__NOISE_SHAPE: |
| return getNoise_shape(); |
| case Dropout_layersPackage.DROPOUT_LAYERS__SEED: |
| return getSeed(); |
| } |
| 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 Dropout_layersPackage.DROPOUT_LAYERS__P: |
| setP((Double)newValue); |
| return; |
| case Dropout_layersPackage.DROPOUT_LAYERS__INPLACE: |
| setInplace((Boolean)newValue); |
| return; |
| case Dropout_layersPackage.DROPOUT_LAYERS__NOISE_SHAPE: |
| getNoise_shape().clear(); |
| getNoise_shape().addAll((Collection<? extends Integer>)newValue); |
| return; |
| case Dropout_layersPackage.DROPOUT_LAYERS__SEED: |
| setSeed((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case Dropout_layersPackage.DROPOUT_LAYERS__P: |
| setP(P_EDEFAULT); |
| return; |
| case Dropout_layersPackage.DROPOUT_LAYERS__INPLACE: |
| setInplace(INPLACE_EDEFAULT); |
| return; |
| case Dropout_layersPackage.DROPOUT_LAYERS__NOISE_SHAPE: |
| getNoise_shape().clear(); |
| return; |
| case Dropout_layersPackage.DROPOUT_LAYERS__SEED: |
| setSeed(SEED_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case Dropout_layersPackage.DROPOUT_LAYERS__P: |
| return p != P_EDEFAULT; |
| case Dropout_layersPackage.DROPOUT_LAYERS__INPLACE: |
| return inplace != INPLACE_EDEFAULT; |
| case Dropout_layersPackage.DROPOUT_LAYERS__NOISE_SHAPE: |
| return noise_shape != null && !noise_shape.isEmpty(); |
| case Dropout_layersPackage.DROPOUT_LAYERS__SEED: |
| return seed != SEED_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(" (p: "); //$NON-NLS-1$ |
| result.append(p); |
| result.append(", inplace: "); //$NON-NLS-1$ |
| result.append(inplace); |
| result.append(", noise_shape: "); //$NON-NLS-1$ |
| result.append(noise_shape); |
| result.append(", seed: "); //$NON-NLS-1$ |
| result.append(seed); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //Dropout_layersImpl |