| /** |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.entitymock.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.osbp.xtext.entitymock.Date; |
| import org.eclipse.osbp.xtext.entitymock.DateIterate; |
| import org.eclipse.osbp.xtext.entitymock.EDateStepType; |
| import org.eclipse.osbp.xtext.entitymock.EntityMockDSLPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Date Iterate</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.DateIterateImpl#getFrom <em>From</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.DateIterateImpl#getUntil <em>Until</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.DateIterateImpl#getStepCount <em>Step Count</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.DateIterateImpl#getStepType <em>Step Type</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class DateIterateImpl extends IIterateImpl implements DateIterate { |
| /** |
| * The cached value of the '{@link #getFrom() <em>From</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFrom() |
| * @generated |
| * @ordered |
| */ |
| protected Date from; |
| |
| /** |
| * The cached value of the '{@link #getUntil() <em>Until</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUntil() |
| * @generated |
| * @ordered |
| */ |
| protected Date until; |
| |
| /** |
| * The default value of the '{@link #getStepCount() <em>Step Count</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStepCount() |
| * @generated |
| * @ordered |
| */ |
| protected static final int STEP_COUNT_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getStepCount() <em>Step Count</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStepCount() |
| * @generated |
| * @ordered |
| */ |
| protected int stepCount = STEP_COUNT_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getStepType() <em>Step Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStepType() |
| * @generated |
| * @ordered |
| */ |
| protected static final EDateStepType STEP_TYPE_EDEFAULT = EDateStepType.DAYS; |
| |
| /** |
| * The cached value of the '{@link #getStepType() <em>Step Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStepType() |
| * @generated |
| * @ordered |
| */ |
| protected EDateStepType stepType = STEP_TYPE_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected DateIterateImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EntityMockDSLPackage.Literals.DATE_ITERATE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Date getFrom() { |
| return from; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetFrom(Date newFrom, NotificationChain msgs) { |
| Date oldFrom = from; |
| from = newFrom; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.DATE_ITERATE__FROM, oldFrom, newFrom); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFrom(Date newFrom) { |
| if (newFrom != from) { |
| NotificationChain msgs = null; |
| if (from != null) |
| msgs = ((InternalEObject)from).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.DATE_ITERATE__FROM, null, msgs); |
| if (newFrom != null) |
| msgs = ((InternalEObject)newFrom).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.DATE_ITERATE__FROM, null, msgs); |
| msgs = basicSetFrom(newFrom, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.DATE_ITERATE__FROM, newFrom, newFrom)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Date getUntil() { |
| return until; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetUntil(Date newUntil, NotificationChain msgs) { |
| Date oldUntil = until; |
| until = newUntil; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.DATE_ITERATE__UNTIL, oldUntil, newUntil); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setUntil(Date newUntil) { |
| if (newUntil != until) { |
| NotificationChain msgs = null; |
| if (until != null) |
| msgs = ((InternalEObject)until).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.DATE_ITERATE__UNTIL, null, msgs); |
| if (newUntil != null) |
| msgs = ((InternalEObject)newUntil).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.DATE_ITERATE__UNTIL, null, msgs); |
| msgs = basicSetUntil(newUntil, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.DATE_ITERATE__UNTIL, newUntil, newUntil)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getStepCount() { |
| return stepCount; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setStepCount(int newStepCount) { |
| int oldStepCount = stepCount; |
| stepCount = newStepCount; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.DATE_ITERATE__STEP_COUNT, oldStepCount, stepCount)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EDateStepType getStepType() { |
| return stepType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setStepType(EDateStepType newStepType) { |
| EDateStepType oldStepType = stepType; |
| stepType = newStepType == null ? STEP_TYPE_EDEFAULT : newStepType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.DATE_ITERATE__STEP_TYPE, oldStepType, stepType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EntityMockDSLPackage.DATE_ITERATE__FROM: |
| return basicSetFrom(null, msgs); |
| case EntityMockDSLPackage.DATE_ITERATE__UNTIL: |
| return basicSetUntil(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case EntityMockDSLPackage.DATE_ITERATE__FROM: |
| return getFrom(); |
| case EntityMockDSLPackage.DATE_ITERATE__UNTIL: |
| return getUntil(); |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_COUNT: |
| return getStepCount(); |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_TYPE: |
| return getStepType(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case EntityMockDSLPackage.DATE_ITERATE__FROM: |
| setFrom((Date)newValue); |
| return; |
| case EntityMockDSLPackage.DATE_ITERATE__UNTIL: |
| setUntil((Date)newValue); |
| return; |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_COUNT: |
| setStepCount((Integer)newValue); |
| return; |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_TYPE: |
| setStepType((EDateStepType)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EntityMockDSLPackage.DATE_ITERATE__FROM: |
| setFrom((Date)null); |
| return; |
| case EntityMockDSLPackage.DATE_ITERATE__UNTIL: |
| setUntil((Date)null); |
| return; |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_COUNT: |
| setStepCount(STEP_COUNT_EDEFAULT); |
| return; |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_TYPE: |
| setStepType(STEP_TYPE_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EntityMockDSLPackage.DATE_ITERATE__FROM: |
| return from != null; |
| case EntityMockDSLPackage.DATE_ITERATE__UNTIL: |
| return until != null; |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_COUNT: |
| return stepCount != STEP_COUNT_EDEFAULT; |
| case EntityMockDSLPackage.DATE_ITERATE__STEP_TYPE: |
| return stepType != STEP_TYPE_EDEFAULT; |
| } |
| 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(" (stepCount: "); |
| result.append(stepCount); |
| result.append(", stepType: "); |
| result.append(stepType); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //DateIterateImpl |