/**
* Copyright (c) 2010 Martin Schnabel <mb0@mb0.org> 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.axdt.as3.model.impl;
import org.axdt.as3.As3EPackage;
import org.axdt.as3.model.As3ArrayInitializer;
import org.axdt.as3.model.As3NewVectorExpression;
import org.axdt.as3.util.As3TypeAccessUtil;
import org.axdt.avm.model.AvmType;
import org.axdt.avm.util.AvmTypeAccess;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>As3 New Vector Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.axdt.as3.model.impl.As3NewVectorExpressionImpl#getParameter <em>Parameter</em>}</li>
* <li>{@link org.axdt.as3.model.impl.As3NewVectorExpressionImpl#getData <em>Data</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class As3NewVectorExpressionImpl extends IExpressionImpl implements As3NewVectorExpression {
/**
* The cached value of the '{@link #getParameter() <em>Parameter</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParameter()
* @generated
* @ordered
*/
protected AvmType parameter;
/**
* The cached value of the '{@link #getData() <em>Data</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getData()
* @generated
* @ordered
*/
protected As3ArrayInitializer data;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected As3NewVectorExpressionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return As3EPackage.Literals.AS3_NEW_VECTOR_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AvmType getParameter() {
if (parameter != null && parameter.eIsProxy()) {
InternalEObject oldParameter = (InternalEObject)parameter;
parameter = (AvmType)eResolveProxy(oldParameter);
if (parameter != oldParameter) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, As3EPackage.AS3_NEW_VECTOR_EXPRESSION__PARAMETER, oldParameter, parameter));
}
}
return parameter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AvmType basicGetParameter() {
return parameter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setParameter(AvmType newParameter) {
AvmType oldParameter = parameter;
parameter = newParameter;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_NEW_VECTOR_EXPRESSION__PARAMETER, oldParameter, parameter));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public As3ArrayInitializer getData() {
return data;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetData(As3ArrayInitializer newData, NotificationChain msgs) {
As3ArrayInitializer oldData = data;
data = newData;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA, oldData, newData);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setData(As3ArrayInitializer newData) {
if (newData != data) {
NotificationChain msgs = null;
if (data != null)
msgs = ((InternalEObject)data).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA, null, msgs);
if (newData != null)
msgs = ((InternalEObject)newData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA, null, msgs);
msgs = basicSetData(newData, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA, newData, newData));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA:
return basicSetData(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 As3EPackage.AS3_NEW_VECTOR_EXPRESSION__PARAMETER:
if (resolve) return getParameter();
return basicGetParameter();
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA:
return getData();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__PARAMETER:
setParameter((AvmType)newValue);
return;
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA:
setData((As3ArrayInitializer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__PARAMETER:
setParameter((AvmType)null);
return;
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA:
setData((As3ArrayInitializer)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__PARAMETER:
return parameter != null;
case As3EPackage.AS3_NEW_VECTOR_EXPRESSION__DATA:
return data != null;
}
return super.eIsSet(featureID);
}
@Override
public AvmTypeAccess resolveType() {
return As3TypeAccessUtil.global("Vector");
}
} //As3NewVectorExpressionImpl