| /** |
| * 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.Layer_weight_initializers.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.papyrus.aiml.profile.AIML.Layer_weight_initializers.Layer_weight_initializersPackage; |
| import org.eclipse.papyrus.aiml.profile.AIML.Layer_weight_initializers.variance_scaling; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>variance scaling</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Layer_weight_initializers.impl.variance_scalingImpl#getScale <em>Scale</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Layer_weight_initializers.impl.variance_scalingImpl#getMode <em>Mode</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Layer_weight_initializers.impl.variance_scalingImpl#getDistribution <em>Distribution</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class variance_scalingImpl extends initializer_with_seedImpl implements variance_scaling { |
| /** |
| * The default value of the '{@link #getScale() <em>Scale</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getScale() |
| * @generated |
| * @ordered |
| */ |
| protected static final double SCALE_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getScale() <em>Scale</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getScale() |
| * @generated |
| * @ordered |
| */ |
| protected double scale = SCALE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getMode() <em>Mode</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMode() |
| * @generated |
| * @ordered |
| */ |
| protected static final String MODE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getMode() <em>Mode</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMode() |
| * @generated |
| * @ordered |
| */ |
| protected String mode = MODE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getDistribution() <em>Distribution</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDistribution() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DISTRIBUTION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDistribution() <em>Distribution</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDistribution() |
| * @generated |
| * @ordered |
| */ |
| protected String distribution = DISTRIBUTION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected variance_scalingImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return Layer_weight_initializersPackage.Literals.VARIANCE_SCALING; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public double getScale() { |
| return scale; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setScale(double newScale) { |
| double oldScale = scale; |
| scale = newScale; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Layer_weight_initializersPackage.VARIANCE_SCALING__SCALE, oldScale, scale)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getMode() { |
| return mode; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setMode(String newMode) { |
| String oldMode = mode; |
| mode = newMode; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Layer_weight_initializersPackage.VARIANCE_SCALING__MODE, oldMode, mode)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getDistribution() { |
| return distribution; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDistribution(String newDistribution) { |
| String oldDistribution = distribution; |
| distribution = newDistribution; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Layer_weight_initializersPackage.VARIANCE_SCALING__DISTRIBUTION, oldDistribution, distribution)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__SCALE: |
| return getScale(); |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__MODE: |
| return getMode(); |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__DISTRIBUTION: |
| return getDistribution(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__SCALE: |
| setScale((Double)newValue); |
| return; |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__MODE: |
| setMode((String)newValue); |
| return; |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__DISTRIBUTION: |
| setDistribution((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__SCALE: |
| setScale(SCALE_EDEFAULT); |
| return; |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__MODE: |
| setMode(MODE_EDEFAULT); |
| return; |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__DISTRIBUTION: |
| setDistribution(DISTRIBUTION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__SCALE: |
| return scale != SCALE_EDEFAULT; |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__MODE: |
| return MODE_EDEFAULT == null ? mode != null : !MODE_EDEFAULT.equals(mode); |
| case Layer_weight_initializersPackage.VARIANCE_SCALING__DISTRIBUTION: |
| return DISTRIBUTION_EDEFAULT == null ? distribution != null : !DISTRIBUTION_EDEFAULT.equals(distribution); |
| } |
| 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(" (scale: "); //$NON-NLS-1$ |
| result.append(scale); |
| result.append(", mode: "); //$NON-NLS-1$ |
| result.append(mode); |
| result.append(", distribution: "); //$NON-NLS-1$ |
| result.append(distribution); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //variance_scalingImpl |