org.eclipse.xtext.xbase.impl.XCollectionLiteralImpl Maven / Gradle / Ivy
/**
* Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
* 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
*/
package org.eclipse.xtext.xbase.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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.xtext.xbase.XCollectionLiteral;
import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.XbasePackage;
/**
*
* An implementation of the model object 'XCollection Literal'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.xtext.xbase.impl.XCollectionLiteralImpl#getElements Elements}
*
*
* @generated
*/
public abstract class XCollectionLiteralImpl extends XExpressionImpl implements XCollectionLiteral
{
/**
* The cached value of the '{@link #getElements() Elements}' containment reference list.
*
*
* @see #getElements()
* @generated
* @ordered
*/
protected EList elements;
/**
*
*
* @generated
*/
protected XCollectionLiteralImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XbasePackage.Literals.XCOLLECTION_LITERAL;
}
/**
*
*
* @generated
*/
public EList getElements()
{
if (elements == null)
{
elements = new EObjectContainmentEList(XExpression.class, this, XbasePackage.XCOLLECTION_LITERAL__ELEMENTS);
}
return elements;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XbasePackage.XCOLLECTION_LITERAL__ELEMENTS:
return ((InternalEList>)getElements()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XbasePackage.XCOLLECTION_LITERAL__ELEMENTS:
return getElements();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XbasePackage.XCOLLECTION_LITERAL__ELEMENTS:
getElements().clear();
getElements().addAll((Collection extends XExpression>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XbasePackage.XCOLLECTION_LITERAL__ELEMENTS:
getElements().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XbasePackage.XCOLLECTION_LITERAL__ELEMENTS:
return elements != null && !elements.isEmpty();
}
return super.eIsSet(featureID);
}
} //XCollectionLiteralImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy