blob: 6179adffc449557c32818897023e31cc429114a0 [file] [log] [blame]
/*
* Copyright (c) 2015 Eike Stepper (Loehne, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Eike Stepper - initial API and implementation
*/
package org.eclipse.oomph.setup.targlets.impl;
import org.eclipse.oomph.p2.P2Factory;
import org.eclipse.oomph.p2.P2Package;
import org.eclipse.oomph.setup.targlets.ImplicitDependency;
import org.eclipse.oomph.setup.targlets.SetupTargletsPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.equinox.p2.metadata.Version;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Implicit Dependency</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.oomph.setup.targlets.impl.ImplicitDependencyImpl#getID <em>ID</em>}</li>
* <li>{@link org.eclipse.oomph.setup.targlets.impl.ImplicitDependencyImpl#getVersion <em>Version</em>}</li>
* </ul>
*
* @generated
*/
public class ImplicitDependencyImpl extends MinimalEObjectImpl.Container implements ImplicitDependency
{
/**
* The default value of the '{@link #getID() <em>ID</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getID()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getID() <em>ID</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getID()
* @generated
* @ordered
*/
protected String iD = ID_EDEFAULT;
/**
* The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected static final Version VERSION_EDEFAULT = (Version)P2Factory.eINSTANCE.createFromString(P2Package.eINSTANCE.getVersion(), "0.0.0"); //$NON-NLS-1$
/**
* The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected Version version = VERSION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ImplicitDependencyImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SetupTargletsPackage.Literals.IMPLICIT_DEPENDENCY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getID()
{
return iD;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setID(String newID)
{
String oldID = iD;
iD = newID;
if (eNotificationRequired())
{
eNotify(new ENotificationImpl(this, Notification.SET, SetupTargletsPackage.IMPLICIT_DEPENDENCY__ID, oldID, iD));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Version getVersion()
{
return version;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVersion(Version newVersion)
{
Version oldVersion = version;
version = newVersion;
if (eNotificationRequired())
{
eNotify(new ENotificationImpl(this, Notification.SET, SetupTargletsPackage.IMPLICIT_DEPENDENCY__VERSION, oldVersion, version));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__ID:
return getID();
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__VERSION:
return getVersion();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__ID:
setID((String)newValue);
return;
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__VERSION:
setVersion((Version)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__ID:
setID(ID_EDEFAULT);
return;
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__VERSION:
setVersion(VERSION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__ID:
return ID_EDEFAULT == null ? iD != null : !ID_EDEFAULT.equals(iD);
case SetupTargletsPackage.IMPLICIT_DEPENDENCY__VERSION:
return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy())
{
return super.toString();
}
StringBuilder result = new StringBuilder(super.toString());
result.append(" (iD: "); //$NON-NLS-1$
result.append(iD);
result.append(", version: "); //$NON-NLS-1$
result.append(version);
result.append(')');
return result.toString();
}
} // ImplicitDependencyImpl