blob: fc5461d82883ed99b9dd67935e24e497ae39f585 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2014 Xored Software Inc and others.
* 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 and/or initial documentation
*******************************************************************************/
package org.eclipse.rcptt.tesla.core.info.impl;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.rcptt.tesla.core.info.InfoNode;
import org.eclipse.rcptt.tesla.core.info.InfoPackage;
import org.eclipse.rcptt.tesla.core.info.NodeProperty;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>Node</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.core.info.impl.InfoNodeImpl#getChildren <em>Children</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.info.impl.InfoNodeImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.info.impl.InfoNodeImpl#getProperties <em>Properties</em>}</li>
* </ul>
*
* @generated
*/
public class InfoNodeImpl extends EObjectImpl implements InfoNode {
/**
* The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getChildren()
* @generated
* @ordered
*/
protected EList<InfoNode> children;
/**
* 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 cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getProperties()
* @generated
* @ordered
*/
protected EList<NodeProperty> properties;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected InfoNodeImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return InfoPackage.Literals.INFO_NODE;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public EList<InfoNode> getChildren() {
if (children == null) {
children = new EObjectContainmentEList<InfoNode>(InfoNode.class, this, InfoPackage.INFO_NODE__CHILDREN);
}
return children;
}
/**
* <!-- 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, InfoPackage.INFO_NODE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public EList<NodeProperty> getProperties() {
if (properties == null) {
properties = new EObjectContainmentEList<NodeProperty>(NodeProperty.class, this, InfoPackage.INFO_NODE__PROPERTIES);
}
return properties;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case InfoPackage.INFO_NODE__CHILDREN:
return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs);
case InfoPackage.INFO_NODE__PROPERTIES:
return ((InternalEList<?>)getProperties()).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 InfoPackage.INFO_NODE__CHILDREN:
return getChildren();
case InfoPackage.INFO_NODE__NAME:
return getName();
case InfoPackage.INFO_NODE__PROPERTIES:
return getProperties();
}
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 InfoPackage.INFO_NODE__CHILDREN:
getChildren().clear();
getChildren().addAll((Collection<? extends InfoNode>)newValue);
return;
case InfoPackage.INFO_NODE__NAME:
setName((String)newValue);
return;
case InfoPackage.INFO_NODE__PROPERTIES:
getProperties().clear();
getProperties().addAll((Collection<? extends NodeProperty>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case InfoPackage.INFO_NODE__CHILDREN:
getChildren().clear();
return;
case InfoPackage.INFO_NODE__NAME:
setName(NAME_EDEFAULT);
return;
case InfoPackage.INFO_NODE__PROPERTIES:
getProperties().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case InfoPackage.INFO_NODE__CHILDREN:
return children != null && !children.isEmpty();
case InfoPackage.INFO_NODE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case InfoPackage.INFO_NODE__PROPERTIES:
return properties != null && !properties.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(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} // InfoNodeImpl