/*
* StsObjectImpl.java
*
* This file is part of the STS-Tool project.
* Copyright (c) 2011-2012 "University of Trento - DISI" All rights reserved.
*
* Is strictly forbidden to remove this copyright notice from this source code.
*
* Disclaimer of Warranty:
* STS-Tool (this software) is provided "as-is" and without warranty of any kind,
* express, implied or otherwise, including without limitation, any warranty of
* merchantability or fitness for a particular purpose.
* In no event shall the copyright holder or contributors be liable for any direct,
* indirect, incidental, special, exemplary, or consequential damages
* including, but not limited to, procurement of substitute goods or services;
* loss of use, data, or profits; or business interruption) however caused and on
* any theory of liability, whether in contract, strict liability, or tort (including
* negligence or otherwise) arising in any way out of the use of this software, even
* if advised of the possibility of such damage.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3
* as published by the Free Software Foundation with the addition of the
* following permission added to Section 15 as permitted in Section 7(a):
* FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
* "University of Trento - DISI","University of Trento - DISI" DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses or write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA, 02110-1301 USA, or download the license from the following URL:
* http://www.sts-tool.eu/License.php
*
* For more information, please contact STS-Tool group at this
* address: ststool@disi.unitn.it
*
*/
/**
* DISI - University of Trento
*
* $Id$
*/
package eu.aniketos.wp1.ststool.impl;
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.EObjectImpl;
import eu.aniketos.wp1.ststool.StsObject;
import eu.aniketos.wp1.ststool.StstoolPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Sts Object</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link eu.aniketos.wp1.ststool.impl.StsObjectImpl#getStsUniqueID <em>Sts Unique ID</em>}</li>
* <li>{@link eu.aniketos.wp1.ststool.impl.StsObjectImpl#getDescription <em>Description</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class StsObjectImpl extends EObjectImpl implements StsObject {
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "DISI - University of Trento";
/**
* The default value of the '{@link #getStsUniqueID() <em>Sts Unique ID</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getStsUniqueID()
* @generated
* @ordered
*/
protected static final String STS_UNIQUE_ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getStsUniqueID() <em>Sts Unique ID</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getStsUniqueID()
* @generated
* @ordered
*/
protected String stsUniqueID = STS_UNIQUE_ID_EDEFAULT;
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
protected StsObjectImpl() {
super();
setStsUniqueID(generateUniqueID());
}
public String generateUniqueID(){
return "" + System.currentTimeMillis() + "_" + (Math.random());
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass(){
return StstoolPackage.Literals.STS_OBJECT;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public String getStsUniqueID(){
return stsUniqueID;
}
public String getID(){
return stsUniqueID;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setStsUniqueID(String newStsUniqueID){
String oldStsUniqueID = stsUniqueID;
stsUniqueID = newStsUniqueID;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StstoolPackage.STS_OBJECT__STS_UNIQUE_ID, oldStsUniqueID, stsUniqueID));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public String getDescription(){
return description;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setDescription(String newDescription){
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StstoolPackage.STS_OBJECT__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case StstoolPackage.STS_OBJECT__STS_UNIQUE_ID:
return getStsUniqueID();
case StstoolPackage.STS_OBJECT__DESCRIPTION:
return getDescription();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID,Object newValue){
switch (featureID) {
case StstoolPackage.STS_OBJECT__STS_UNIQUE_ID:
setStsUniqueID((String)newValue);
return;
case StstoolPackage.STS_OBJECT__DESCRIPTION:
setDescription((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID){
switch (featureID) {
case StstoolPackage.STS_OBJECT__STS_UNIQUE_ID:
setStsUniqueID(STS_UNIQUE_ID_EDEFAULT);
return;
case StstoolPackage.STS_OBJECT__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID){
switch (featureID) {
case StstoolPackage.STS_OBJECT__STS_UNIQUE_ID:
return STS_UNIQUE_ID_EDEFAULT == null ? stsUniqueID != null : !STS_UNIQUE_ID_EDEFAULT.equals(stsUniqueID);
case StstoolPackage.STS_OBJECT__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
}
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(" (stsUniqueID: ");
result.append(stsUniqueID);
result.append(", description: ");
result.append(description);
result.append(')');
return result.toString();
}
} //StsObjectImpl