/** * Copyright (c) 2001-2011 Mad Cow Entertainment and Corporation * 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: �bel Heged�s - initial API and implementation */ package madcow.magic.database.set.impl; import java.util.Collection; import madcow.magic.database.core.impl.MagicDBElementImpl; import madcow.magic.database.set.Block; import madcow.magic.database.set.BlockType; import madcow.magic.database.set.Set; import madcow.magic.database.set.SetPackage; import org.eclipse.emf.common.notify.Notification; 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.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Block</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link madcow.magic.database.set.impl.BlockImpl#getSets <em>Sets</em>}</li> * <li>{@link madcow.magic.database.set.impl.BlockImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class BlockImpl extends MagicDBElementImpl implements Block { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2001-2011 Mad Cow Entertainment and Corporation\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0 \r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html \r\n\r\nContributors: �bel Heged�s - initial API and implementation"; /** * The cached value of the '{@link #getSets() <em>Sets</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSets() * @generated * @ordered */ protected EList<Set> sets; /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final BlockType TYPE_EDEFAULT = BlockType.CORE; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected BlockType type = TYPE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BlockImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SetPackage.Literals.BLOCK; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Set> getSets() { if (sets == null) { sets = new EObjectContainmentWithInverseEList<Set>(Set.class, this, SetPackage.BLOCK__SETS, SetPackage.SET__BLOCK); } return sets; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BlockType getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(BlockType newType) { BlockType oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SetPackage.BLOCK__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SetPackage.BLOCK__SETS: return ((InternalEList<InternalEObject>)(InternalEList<?>)getSets()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SetPackage.BLOCK__SETS: return ((InternalEList<?>)getSets()).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 SetPackage.BLOCK__SETS: return getSets(); case SetPackage.BLOCK__TYPE: return getType(); } 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 SetPackage.BLOCK__SETS: getSets().clear(); getSets().addAll((Collection<? extends Set>)newValue); return; case SetPackage.BLOCK__TYPE: setType((BlockType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SetPackage.BLOCK__SETS: getSets().clear(); return; case SetPackage.BLOCK__TYPE: setType(TYPE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SetPackage.BLOCK__SETS: return sets != null && !sets.isEmpty(); case SetPackage.BLOCK__TYPE: return type != 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(" (type: "); result.append(type); result.append(')'); return result.toString(); } } //BlockImpl