blob: 3ccd325574707ca32d5396062e39e41750a24f0a [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.HockeyleaguePackage;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.League;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.Team;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>League</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.impl.LeagueImpl#getHeadoffice <em>Headoffice</em>}</li>
* <li>{@link org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.impl.LeagueImpl#getTeams <em>Teams</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LeagueImpl extends HockeyleagueObjectImpl implements League {
/**
* The default value of the '{@link #getHeadoffice() <em>Headoffice</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHeadoffice()
* @generated
* @ordered
*/
protected static final String HEADOFFICE_EDEFAULT = null;
/**
* The cached value of the '{@link #getHeadoffice() <em>Headoffice</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHeadoffice()
* @generated
* @ordered
*/
protected String headoffice = HEADOFFICE_EDEFAULT;
/**
* The cached value of the '{@link #getTeams() <em>Teams</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTeams()
* @generated
* @ordered
*/
protected EList teams = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LeagueImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return HockeyleaguePackage.Literals.LEAGUE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getHeadoffice() {
return headoffice;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHeadoffice(String newHeadoffice) {
String oldHeadoffice = headoffice;
headoffice = newHeadoffice;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, HockeyleaguePackage.LEAGUE__HEADOFFICE, oldHeadoffice, headoffice));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getTeams() {
if (teams == null) {
teams = new EObjectContainmentEList(Team.class, this, HockeyleaguePackage.LEAGUE__TEAMS);
}
return teams;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case HockeyleaguePackage.LEAGUE__TEAMS:
return ((InternalEList)getTeams()).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.LEAGUE__HEADOFFICE:
return getHeadoffice();
case HockeyleaguePackage.LEAGUE__TEAMS:
return getTeams();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case HockeyleaguePackage.LEAGUE__HEADOFFICE:
setHeadoffice((String)newValue);
return;
case HockeyleaguePackage.LEAGUE__TEAMS:
getTeams().clear();
getTeams().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case HockeyleaguePackage.LEAGUE__HEADOFFICE:
setHeadoffice(HEADOFFICE_EDEFAULT);
return;
case HockeyleaguePackage.LEAGUE__TEAMS:
getTeams().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case HockeyleaguePackage.LEAGUE__HEADOFFICE:
return HEADOFFICE_EDEFAULT == null ? headoffice != null : !HEADOFFICE_EDEFAULT.equals(headoffice);
case HockeyleaguePackage.LEAGUE__TEAMS:
return teams != null && !teams.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(" (headoffice: "); //$NON-NLS-1$
result.append(headoffice);
result.append(')');
return result.toString();
}
} //LeagueImpl