| /******************************************************************************* |
| * Copyright (c) 2014 Bosch Software Innovations GmbH and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * and Eclipse Distribution License v1.0 which accompany this distribution. |
| * |
| * The Eclipse Public License is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * The Eclipse Distribution License is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * Contributors: |
| * Bosch Software Innovations GmbH - Please refer to git log |
| * |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.vorto.functionblock.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.vorto.functionblock.Constraint; |
| import org.eclipse.vorto.functionblock.ConstraintIntervalType; |
| import org.eclipse.vorto.functionblock.FunctionblockPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Constraint</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.vorto.functionblock.impl.ConstraintImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.vorto.functionblock.impl.ConstraintImpl#getConstraintValues <em>Constraint Values</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ConstraintImpl extends MinimalEObjectImpl.Container implements Constraint { |
| /** |
| * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected static final ConstraintIntervalType TYPE_EDEFAULT = ConstraintIntervalType.MIN; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected ConstraintIntervalType type = TYPE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getConstraintValues() <em>Constraint Values</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getConstraintValues() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CONSTRAINT_VALUES_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getConstraintValues() <em>Constraint Values</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getConstraintValues() |
| * @generated |
| * @ordered |
| */ |
| protected String constraintValues = CONSTRAINT_VALUES_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ConstraintImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FunctionblockPackage.Literals.CONSTRAINT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ConstraintIntervalType getType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setType(ConstraintIntervalType newType) { |
| ConstraintIntervalType oldType = type; |
| type = newType == null ? TYPE_EDEFAULT : newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.CONSTRAINT__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getConstraintValues() { |
| return constraintValues; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setConstraintValues(String newConstraintValues) { |
| String oldConstraintValues = constraintValues; |
| constraintValues = newConstraintValues; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.CONSTRAINT__CONSTRAINT_VALUES, oldConstraintValues, constraintValues)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FunctionblockPackage.CONSTRAINT__TYPE: |
| return getType(); |
| case FunctionblockPackage.CONSTRAINT__CONSTRAINT_VALUES: |
| return getConstraintValues(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FunctionblockPackage.CONSTRAINT__TYPE: |
| setType((ConstraintIntervalType)newValue); |
| return; |
| case FunctionblockPackage.CONSTRAINT__CONSTRAINT_VALUES: |
| setConstraintValues((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FunctionblockPackage.CONSTRAINT__TYPE: |
| setType(TYPE_EDEFAULT); |
| return; |
| case FunctionblockPackage.CONSTRAINT__CONSTRAINT_VALUES: |
| setConstraintValues(CONSTRAINT_VALUES_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FunctionblockPackage.CONSTRAINT__TYPE: |
| return type != TYPE_EDEFAULT; |
| case FunctionblockPackage.CONSTRAINT__CONSTRAINT_VALUES: |
| return CONSTRAINT_VALUES_EDEFAULT == null ? constraintValues != null : !CONSTRAINT_VALUES_EDEFAULT.equals(constraintValues); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (type: "); |
| result.append(type); |
| result.append(", constraintValues: "); |
| result.append(constraintValues); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ConstraintImpl |