/******************************************************************************* * Copyright (c) 2004, 2005 IBM Corporation 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 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jem.internal.instantiation.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.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.jem.internal.instantiation.*; import org.eclipse.jem.internal.instantiation.PTArrayInitializer; import org.eclipse.jem.internal.instantiation.PTExpression; import org.eclipse.jem.internal.instantiation.InstantiationPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Array Initializer</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.jem.internal.instantiation.impl.PTArrayInitializerImpl#getExpressions <em>Expressions</em>}</li> * </ul> * </p> * * @generated */ public class PTArrayInitializerImpl extends PTExpressionImpl implements PTArrayInitializer { /** * The cached value of the '{@link #getExpressions() <em>Expressions</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExpressions() * @generated * @ordered */ protected EList expressions = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PTArrayInitializerImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return InstantiationPackage.eINSTANCE.getPTArrayInitializer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList getExpressions() { if (expressions == null) { expressions = new EObjectContainmentEList(PTExpression.class, this, InstantiationPackage.PT_ARRAY_INITIALIZER__EXPRESSIONS); } return expressions; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { if (featureID >= 0) { switch (eDerivedStructuralFeatureID(featureID, baseClass)) { case InstantiationPackage.PT_ARRAY_INITIALIZER__EXPRESSIONS: return ((InternalEList)getExpressions()).basicRemove(otherEnd, msgs); default: return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); } } return eBasicSetContainer(null, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(EStructuralFeature eFeature, boolean resolve) { switch (eDerivedStructuralFeatureID(eFeature)) { case InstantiationPackage.PT_ARRAY_INITIALIZER__EXPRESSIONS: return getExpressions(); } return eDynamicGet(eFeature, resolve); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(EStructuralFeature eFeature, Object newValue) { switch (eDerivedStructuralFeatureID(eFeature)) { case InstantiationPackage.PT_ARRAY_INITIALIZER__EXPRESSIONS: getExpressions().clear(); getExpressions().addAll((Collection)newValue); return; } eDynamicSet(eFeature, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case InstantiationPackage.PT_ARRAY_INITIALIZER__EXPRESSIONS: getExpressions().clear(); return; } eDynamicUnset(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case InstantiationPackage.PT_ARRAY_INITIALIZER__EXPRESSIONS: return expressions != null && !expressions.isEmpty(); } return eDynamicIsSet(eFeature); } /* * (non-Javadoc) * @see org.eclipse.jem.internal.instantiation.impl.ExpressionImpl#accept0(org.eclipse.jem.internal.instantiation.ParseVisitor) */ protected void accept0(ParseVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { acceptChildren(visitor, expressions); } visitor.endVisit(this); } } //ArrayInitializerImpl