/**
* Copyright (c) 2010 xored software, Inc.
*
* 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:
* xored software, Inc. - initial API and Implementation (Alex Panchenko)
*
* $Id: InterpreterInfoImpl.java,v 1.1 2010/05/23 14:20:39 apanchenk Exp $
*/
package org.eclipse.dltk.launching.model.impl;
import java.util.Collection;
import org.eclipse.dltk.launching.model.InterpreterInfo;
import org.eclipse.dltk.launching.model.LaunchingModelPackage;
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.EObject;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc --> An implementation of the model object
* '<em><b>Interpreter Info</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.dltk.launching.model.impl.InterpreterInfoImpl#getEnvironment
* <em>Environment</em>}</li>
* <li>{@link org.eclipse.dltk.launching.model.impl.InterpreterInfoImpl#getLocation
* <em>Location</em>}</li>
* <li>{@link org.eclipse.dltk.launching.model.impl.InterpreterInfoImpl#getContents
* <em>Contents</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class InterpreterInfoImpl extends EObjectImpl
implements InterpreterInfo {
/**
* The default value of the '{@link #getEnvironment() <em>Environment</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getEnvironment()
* @generated
* @ordered
*/
protected static final String ENVIRONMENT_EDEFAULT = null;
/**
* The cached value of the '{@link #getEnvironment() <em>Environment</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getEnvironment()
* @generated
* @ordered
*/
protected String environment = ENVIRONMENT_EDEFAULT;
/**
* The default value of the '{@link #getLocation() <em>Location</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getLocation()
* @generated
* @ordered
*/
protected static final String LOCATION_EDEFAULT = null;
/**
* The cached value of the '{@link #getLocation() <em>Location</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getLocation()
* @generated
* @ordered
*/
protected String location = LOCATION_EDEFAULT;
/**
* The cached value of the '{@link #getContents() <em>Contents</em>}'
* containment reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getContents()
* @generated
* @ordered
*/
protected EList<EObject> contents;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected InterpreterInfoImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LaunchingModelPackage.Literals.INTERPRETER_INFO;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getEnvironment() {
return environment;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setEnvironment(String newEnvironment) {
String oldEnvironment = environment;
environment = newEnvironment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
LaunchingModelPackage.INTERPRETER_INFO__ENVIRONMENT,
oldEnvironment, environment));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getLocation() {
return location;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setLocation(String newLocation) {
String oldLocation = location;
location = newLocation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
LaunchingModelPackage.INTERPRETER_INFO__LOCATION,
oldLocation, location));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EList<EObject> getContents() {
if (contents == null) {
contents = new EObjectContainmentEList<>(EObject.class, this,
LaunchingModelPackage.INTERPRETER_INFO__CONTENTS);
}
return contents;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case LaunchingModelPackage.INTERPRETER_INFO__CONTENTS:
return ((InternalEList<?>) getContents()).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 LaunchingModelPackage.INTERPRETER_INFO__ENVIRONMENT:
return getEnvironment();
case LaunchingModelPackage.INTERPRETER_INFO__LOCATION:
return getLocation();
case LaunchingModelPackage.INTERPRETER_INFO__CONTENTS:
return getContents();
}
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 LaunchingModelPackage.INTERPRETER_INFO__ENVIRONMENT:
setEnvironment((String) newValue);
return;
case LaunchingModelPackage.INTERPRETER_INFO__LOCATION:
setLocation((String) newValue);
return;
case LaunchingModelPackage.INTERPRETER_INFO__CONTENTS:
getContents().clear();
getContents().addAll((Collection<? extends EObject>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LaunchingModelPackage.INTERPRETER_INFO__ENVIRONMENT:
setEnvironment(ENVIRONMENT_EDEFAULT);
return;
case LaunchingModelPackage.INTERPRETER_INFO__LOCATION:
setLocation(LOCATION_EDEFAULT);
return;
case LaunchingModelPackage.INTERPRETER_INFO__CONTENTS:
getContents().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LaunchingModelPackage.INTERPRETER_INFO__ENVIRONMENT:
return ENVIRONMENT_EDEFAULT == null ? environment != null
: !ENVIRONMENT_EDEFAULT.equals(environment);
case LaunchingModelPackage.INTERPRETER_INFO__LOCATION:
return LOCATION_EDEFAULT == null ? location != null
: !LOCATION_EDEFAULT.equals(location);
case LaunchingModelPackage.INTERPRETER_INFO__CONTENTS:
return contents != null && !contents.isEmpty();
}
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(" (environment: "); //$NON-NLS-1$
result.append(environment);
result.append(", location: "); //$NON-NLS-1$
result.append(location);
result.append(')');
return result.toString();
}
} // InterpreterInfoImpl