| /** |
| * 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.Distance_functions.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.Distance_functions.CosineSimilarity; |
| import org.eclipse.papyrus.aiml.profile.AIML.Distance_functions.Distance_functionsPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Cosine Similarity</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aiml.profile.AIML.Distance_functions.impl.CosineSimilarityImpl#getDim <em>Dim</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CosineSimilarityImpl extends Distance_functionsImpl implements CosineSimilarity { |
| /** |
| * The default value of the '{@link #getDim() <em>Dim</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDim() |
| * @generated |
| * @ordered |
| */ |
| protected static final int DIM_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getDim() <em>Dim</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDim() |
| * @generated |
| * @ordered |
| */ |
| protected int dim = DIM_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CosineSimilarityImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return Distance_functionsPackage.Literals.COSINE_SIMILARITY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getDim() { |
| return dim; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDim(int newDim) { |
| int oldDim = dim; |
| dim = newDim; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, Distance_functionsPackage.COSINE_SIMILARITY__DIM, oldDim, dim)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case Distance_functionsPackage.COSINE_SIMILARITY__DIM: |
| return getDim(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case Distance_functionsPackage.COSINE_SIMILARITY__DIM: |
| setDim((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case Distance_functionsPackage.COSINE_SIMILARITY__DIM: |
| setDim(DIM_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case Distance_functionsPackage.COSINE_SIMILARITY__DIM: |
| return dim != DIM_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(" (dim: "); //$NON-NLS-1$ |
| result.append(dim); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //CosineSimilarityImpl |