blob: eebb5064774aba5a6e9853098e3295aaedb1c6f2 [file] [log] [blame]
/**
* Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* EclipseSource Muenchen GmbH - initial API and implementation
*/
package org.eclipse.emfforms.datatemplate.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emfforms.datatemplate.DataTemplatePackage;
import org.eclipse.emfforms.datatemplate.Template;
import org.eclipse.emfforms.datatemplate.TemplateCollection;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Template Collection</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.emfforms.datatemplate.impl.TemplateCollectionImpl#getTemplates <em>Templates</em>}</li>
* </ul>
*
* @generated
*/
public class TemplateCollectionImpl extends MinimalEObjectImpl.Container implements TemplateCollection {
/**
* The cached value of the '{@link #getTemplates() <em>Templates</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getTemplates()
* @generated
* @ordered
*/
protected EList<Template> templates;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected TemplateCollectionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return DataTemplatePackage.Literals.TEMPLATE_COLLECTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EList<Template> getTemplates() {
if (templates == null) {
templates = new EObjectContainmentEList<Template>(Template.class, this,
DataTemplatePackage.TEMPLATE_COLLECTION__TEMPLATES);
}
return templates;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DataTemplatePackage.TEMPLATE_COLLECTION__TEMPLATES:
return ((InternalEList<?>) getTemplates()).basicRemove(otherEnd, 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 DataTemplatePackage.TEMPLATE_COLLECTION__TEMPLATES:
return getTemplates();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DataTemplatePackage.TEMPLATE_COLLECTION__TEMPLATES:
getTemplates().clear();
getTemplates().addAll((Collection<? extends Template>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DataTemplatePackage.TEMPLATE_COLLECTION__TEMPLATES:
getTemplates().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DataTemplatePackage.TEMPLATE_COLLECTION__TEMPLATES:
return templates != null && !templates.isEmpty();
}
return super.eIsSet(featureID);
}
} // TemplateCollectionImpl