blob: a0b0590184e65d2d63a6567226ef7c9c3aba31de [file] [log] [blame]
/**
* Copyright (c) 2008-2011 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* 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:
*/
package org.eclipse.emf.emfstore.bowling.impl;
import java.math.BigInteger;
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.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.emfstore.bowling.BowlingPackage;
import org.eclipse.emf.emfstore.bowling.Game;
import org.eclipse.emf.emfstore.bowling.Matchup;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Matchup</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.emf.emfstore.bowling.impl.MatchupImpl#getGames <em>Games</em>}</li>
* <li>{@link org.eclipse.emf.emfstore.bowling.impl.MatchupImpl#getNrSpectators <em>Nr Spectators</em>}</li>
* </ul>
*
* @generated
*/
public class MatchupImpl extends EObjectImpl implements Matchup {
/**
* The cached value of the '{@link #getGames() <em>Games</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getGames()
* @generated
* @ordered
*/
protected EList<Game> games;
/**
* The default value of the '{@link #getNrSpectators() <em>Nr Spectators</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getNrSpectators()
* @generated
* @ordered
*/
protected static final BigInteger NR_SPECTATORS_EDEFAULT = null;
/**
* The cached value of the '{@link #getNrSpectators() <em>Nr Spectators</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getNrSpectators()
* @generated
* @ordered
*/
protected BigInteger nrSpectators = NR_SPECTATORS_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected MatchupImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return BowlingPackage.Literals.MATCHUP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public EList<Game> getGames() {
if (games == null) {
games = new EObjectContainmentWithInverseEList.Resolving<Game>(Game.class, this,
BowlingPackage.MATCHUP__GAMES, BowlingPackage.GAME__MATCHUP);
}
return games;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public BigInteger getNrSpectators() {
return nrSpectators;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setNrSpectators(BigInteger newNrSpectators) {
final BigInteger oldNrSpectators = nrSpectators;
nrSpectators = newNrSpectators;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, BowlingPackage.MATCHUP__NR_SPECTATORS,
oldNrSpectators, nrSpectators));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BowlingPackage.MATCHUP__GAMES:
return ((InternalEList<InternalEObject>) (InternalEList<?>) getGames()).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 BowlingPackage.MATCHUP__GAMES:
return ((InternalEList<?>) getGames()).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 BowlingPackage.MATCHUP__GAMES:
return getGames();
case BowlingPackage.MATCHUP__NR_SPECTATORS:
return getNrSpectators();
}
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 BowlingPackage.MATCHUP__GAMES:
getGames().clear();
getGames().addAll((Collection<? extends Game>) newValue);
return;
case BowlingPackage.MATCHUP__NR_SPECTATORS:
setNrSpectators((BigInteger) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BowlingPackage.MATCHUP__GAMES:
getGames().clear();
return;
case BowlingPackage.MATCHUP__NR_SPECTATORS:
setNrSpectators(NR_SPECTATORS_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BowlingPackage.MATCHUP__GAMES:
return games != null && !games.isEmpty();
case BowlingPackage.MATCHUP__NR_SPECTATORS:
return NR_SPECTATORS_EDEFAULT == null ? nrSpectators != null : !NR_SPECTATORS_EDEFAULT.equals(nrSpectators);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
final StringBuffer result = new StringBuffer(super.toString());
result.append(" (nrSpectators: "); //$NON-NLS-1$
result.append(nrSpectators);
result.append(')');
return result.toString();
}
} // MatchupImpl