blob: 6e70813b266e87eea8bd7c6f14e20980a1592a11 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006 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.ui.examples.views.properties.tabbed.hockeyleague.impl;
import java.util.Collection;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.Forward;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ForwardPositionKind;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.HockeyleaguePackage;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.PlayerStats;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Forward</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.impl.ForwardImpl#getPosition <em>Position</em>}</li>
* <li>{@link org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.impl.ForwardImpl#getPlayerStats <em>Player Stats</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ForwardImpl extends PlayerImpl implements Forward {
/**
* The default value of the '{@link #getPosition() <em>Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPosition()
* @generated
* @ordered
*/
protected static final ForwardPositionKind POSITION_EDEFAULT = ForwardPositionKind.LEFT_WING_LITERAL;
/**
* The cached value of the '{@link #getPosition() <em>Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPosition()
* @generated
* @ordered
*/
protected ForwardPositionKind position = POSITION_EDEFAULT;
/**
* The cached value of the '{@link #getPlayerStats() <em>Player Stats</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPlayerStats()
* @generated
* @ordered
*/
protected EList playerStats = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ForwardImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return HockeyleaguePackage.Literals.FORWARD;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ForwardPositionKind getPosition() {
return position;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPosition(ForwardPositionKind newPosition) {
ForwardPositionKind oldPosition = position;
position = newPosition == null ? POSITION_EDEFAULT : newPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, HockeyleaguePackage.FORWARD__POSITION, oldPosition, position));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getPlayerStats() {
if (playerStats == null) {
playerStats = new EObjectContainmentEList(PlayerStats.class, this, HockeyleaguePackage.FORWARD__PLAYER_STATS);
}
return playerStats;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case HockeyleaguePackage.FORWARD__PLAYER_STATS:
return ((InternalEList)getPlayerStats()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case HockeyleaguePackage.FORWARD__POSITION:
return getPosition();
case HockeyleaguePackage.FORWARD__PLAYER_STATS:
return getPlayerStats();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case HockeyleaguePackage.FORWARD__POSITION:
setPosition((ForwardPositionKind)newValue);
return;
case HockeyleaguePackage.FORWARD__PLAYER_STATS:
getPlayerStats().clear();
getPlayerStats().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case HockeyleaguePackage.FORWARD__POSITION:
setPosition(POSITION_EDEFAULT);
return;
case HockeyleaguePackage.FORWARD__PLAYER_STATS:
getPlayerStats().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case HockeyleaguePackage.FORWARD__POSITION:
return position != POSITION_EDEFAULT;
case HockeyleaguePackage.FORWARD__PLAYER_STATS:
return playerStats != null && !playerStats.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (position: "); //$NON-NLS-1$
result.append(position);
result.append(')');
return result.toString();
}
} //ForwardImpl