| /** |
| * 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.NonLinearActivations.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.NonLinearActivations.NonLinearActivationsPackage; |
| import org.eclipse.papyrus.aiml.profile.AIML.NonLinearActivations.Threshold; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Threshold</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.NonLinearActivations.impl.ThresholdImpl#getThreshold <em>Threshold</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.NonLinearActivations.impl.ThresholdImpl#getValue <em>Value</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ThresholdImpl extends Nonlinear_activations_weightedsumnonlinearity_1Impl implements Threshold { |
| /** |
| * The default value of the '{@link #getThreshold() <em>Threshold</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getThreshold() |
| * @generated |
| * @ordered |
| */ |
| protected static final double THRESHOLD_EDEFAULT = 0.0; |
| |
| /** |
| * The cached value of the '{@link #getThreshold() <em>Threshold</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getThreshold() |
| * @generated |
| * @ordered |
| */ |
| protected double threshold = THRESHOLD_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 int VALUE_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected int value = VALUE_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ThresholdImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return NonLinearActivationsPackage.Literals.THRESHOLD; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public double getThreshold() { |
| return threshold; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setThreshold(double newThreshold) { |
| double oldThreshold = threshold; |
| threshold = newThreshold; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NonLinearActivationsPackage.THRESHOLD__THRESHOLD, oldThreshold, threshold)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setValue(int newValue) { |
| int oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NonLinearActivationsPackage.THRESHOLD__VALUE, oldValue, value)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case NonLinearActivationsPackage.THRESHOLD__THRESHOLD: |
| return getThreshold(); |
| case NonLinearActivationsPackage.THRESHOLD__VALUE: |
| return getValue(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case NonLinearActivationsPackage.THRESHOLD__THRESHOLD: |
| setThreshold((Double)newValue); |
| return; |
| case NonLinearActivationsPackage.THRESHOLD__VALUE: |
| setValue((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case NonLinearActivationsPackage.THRESHOLD__THRESHOLD: |
| setThreshold(THRESHOLD_EDEFAULT); |
| return; |
| case NonLinearActivationsPackage.THRESHOLD__VALUE: |
| setValue(VALUE_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case NonLinearActivationsPackage.THRESHOLD__THRESHOLD: |
| return threshold != THRESHOLD_EDEFAULT; |
| case NonLinearActivationsPackage.THRESHOLD__VALUE: |
| return value != VALUE_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(" (threshold: "); //$NON-NLS-1$ |
| result.append(threshold); |
| result.append(", value: "); //$NON-NLS-1$ |
| result.append(value); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ThresholdImpl |