/*******************************************************************************
* Copyright (c) 2010 Michal Antkiewicz.
* 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:
* Michal Antkiewicz - initial API and implementation
******************************************************************************/
/**
*
*
*
* $Id: ForwardDeclImpl.java,v 1.6 2007/12/06 03:28:18 Michal Antkiewicz <mantkiew@gsd.uwaterloo.ca> $
*/
package ca.uwaterloo.gsd.struts.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import ca.uwaterloo.gsd.fsml.fsml.impl.ConceptImpl;
import ca.uwaterloo.gsd.struts.ActionDecl;
import ca.uwaterloo.gsd.struts.ForwardDecl;
import ca.uwaterloo.gsd.struts.StrutsPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Forward Decl</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link ca.uwaterloo.gsd.struts.impl.ForwardDeclImpl#getName <em>Name</em>}</li>
* <li>{@link ca.uwaterloo.gsd.struts.impl.ForwardDeclImpl#getPath <em>Path</em>}</li>
* <li>{@link ca.uwaterloo.gsd.struts.impl.ForwardDeclImpl#getTarget <em>Target</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ForwardDeclImpl extends ConceptImpl implements ForwardDecl {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPath()
* @generated
* @ordered
*/
protected static final String PATH_EDEFAULT = null;
/**
* The cached value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPath()
* @generated
* @ordered
*/
protected String path = PATH_EDEFAULT;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected ActionDecl target;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ForwardDeclImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StrutsPackage.Literals.FORWARD_DECL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StrutsPackage.FORWARD_DECL__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPath() {
return path;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPath(String newPath) {
String oldPath = path;
path = newPath;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StrutsPackage.FORWARD_DECL__PATH, oldPath, path));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ActionDecl getTarget() {
if (target != null && target.eIsProxy()) {
InternalEObject oldTarget = (InternalEObject)target;
target = (ActionDecl)eResolveProxy(oldTarget);
if (target != oldTarget) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StrutsPackage.FORWARD_DECL__TARGET, oldTarget, target));
}
}
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ActionDecl basicGetTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(ActionDecl newTarget) {
ActionDecl oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StrutsPackage.FORWARD_DECL__TARGET, oldTarget, target));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case StrutsPackage.FORWARD_DECL__NAME:
return getName();
case StrutsPackage.FORWARD_DECL__PATH:
return getPath();
case StrutsPackage.FORWARD_DECL__TARGET:
if (resolve) return getTarget();
return basicGetTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StrutsPackage.FORWARD_DECL__NAME:
setName((String)newValue);
return;
case StrutsPackage.FORWARD_DECL__PATH:
setPath((String)newValue);
return;
case StrutsPackage.FORWARD_DECL__TARGET:
setTarget((ActionDecl)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StrutsPackage.FORWARD_DECL__NAME:
setName(NAME_EDEFAULT);
return;
case StrutsPackage.FORWARD_DECL__PATH:
setPath(PATH_EDEFAULT);
return;
case StrutsPackage.FORWARD_DECL__TARGET:
setTarget((ActionDecl)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StrutsPackage.FORWARD_DECL__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case StrutsPackage.FORWARD_DECL__PATH:
return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
case StrutsPackage.FORWARD_DECL__TARGET:
return target != null;
}
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(" (name: ");
result.append(name);
result.append(", path: ");
result.append(path);
result.append(')');
return result.toString();
}
} //ForwardDeclImpl