blob: 775806e861f52ab472dd93408a90ce24d18c1a51 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.ecview.core.common.model.core.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.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EcoreEMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
import org.eclipse.osbp.ecview.core.common.model.core.YCommand;
import org.eclipse.osbp.ecview.core.common.model.core.YCommandSet;
import org.eclipse.osbp.ecview.core.common.model.core.YView;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>YCommand Set</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YCommandSetImpl#getTags <em>Tags</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YCommandSetImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YCommandSetImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YCommandSetImpl#getProperties <em>Properties</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YCommandSetImpl#getCommands <em>Commands</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YCommandSetImpl#getTransientCommands <em>Transient Commands</em>}</li>
* </ul>
*
* @generated
*/
public class YCommandSetImpl extends MinimalEObjectImpl.Container implements
YCommandSet {
/**
* The cached value of the '{@link #getTags() <em>Tags</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTags()
* @generated
* @ordered
*/
protected EList<String> tags;
/**
* 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 #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>}' map.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProperties()
* @generated
* @ordered
*/
protected EMap<String, String> properties;
/**
* The cached value of the '{@link #getCommands() <em>Commands</em>}' containment reference list.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getCommands()
* @generated
* @ordered
*/
protected EList<YCommand> commands;
/**
* The cached value of the '{@link #getTransientCommands() <em>Transient Commands</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTransientCommands()
* @generated
* @ordered
*/
protected EList<YCommand> transientCommands;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected YCommandSetImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CoreModelPackage.Literals.YCOMMAND_SET;
}
/**
* <!-- 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, CoreModelPackage.YCOMMAND_SET__ID, oldId, id));
}
/**
* <!-- 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, CoreModelPackage.YCOMMAND_SET__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getTags() {
if (tags == null) {
tags = new EDataTypeUniqueEList<String>(String.class, this, CoreModelPackage.YCOMMAND_SET__TAGS);
}
return tags;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EMap<String, String> getProperties() {
if (properties == null) {
properties = new EcoreEMap<String,String>(CoreModelPackage.Literals.YSTRING_TO_STRING_MAP, YStringToStringMapImpl.class, this, CoreModelPackage.YCOMMAND_SET__PROPERTIES);
}
return properties;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public EList<YCommand> getCommands() {
if (commands == null) {
commands = new EObjectContainmentEList.Resolving<YCommand>(YCommand.class, this, CoreModelPackage.YCOMMAND_SET__COMMANDS);
}
return commands;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<YCommand> getTransientCommands() {
if (transientCommands == null) {
transientCommands = new EObjectResolvingEList<YCommand>(YCommand.class, this, CoreModelPackage.YCOMMAND_SET__TRANSIENT_COMMANDS);
}
return transientCommands;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public YView getView() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void addCommandGen(YCommand command) {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
public void addCommand(YCommand command) {
getCommands().add(command);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void removeCommandGen(YCommand command) {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
public void removeCommand(YCommand command) {
getCommands().remove(command);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case CoreModelPackage.YCOMMAND_SET__PROPERTIES:
return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
case CoreModelPackage.YCOMMAND_SET__COMMANDS:
return ((InternalEList<?>)getCommands()).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 CoreModelPackage.YCOMMAND_SET__TAGS:
return getTags();
case CoreModelPackage.YCOMMAND_SET__ID:
return getId();
case CoreModelPackage.YCOMMAND_SET__NAME:
return getName();
case CoreModelPackage.YCOMMAND_SET__PROPERTIES:
if (coreType) return getProperties();
else return getProperties().map();
case CoreModelPackage.YCOMMAND_SET__COMMANDS:
return getCommands();
case CoreModelPackage.YCOMMAND_SET__TRANSIENT_COMMANDS:
return getTransientCommands();
}
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 CoreModelPackage.YCOMMAND_SET__TAGS:
getTags().clear();
getTags().addAll((Collection<? extends String>)newValue);
return;
case CoreModelPackage.YCOMMAND_SET__ID:
setId((String)newValue);
return;
case CoreModelPackage.YCOMMAND_SET__NAME:
setName((String)newValue);
return;
case CoreModelPackage.YCOMMAND_SET__PROPERTIES:
((EStructuralFeature.Setting)getProperties()).set(newValue);
return;
case CoreModelPackage.YCOMMAND_SET__COMMANDS:
getCommands().clear();
getCommands().addAll((Collection<? extends YCommand>)newValue);
return;
case CoreModelPackage.YCOMMAND_SET__TRANSIENT_COMMANDS:
getTransientCommands().clear();
getTransientCommands().addAll((Collection<? extends YCommand>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CoreModelPackage.YCOMMAND_SET__TAGS:
getTags().clear();
return;
case CoreModelPackage.YCOMMAND_SET__ID:
setId(ID_EDEFAULT);
return;
case CoreModelPackage.YCOMMAND_SET__NAME:
setName(NAME_EDEFAULT);
return;
case CoreModelPackage.YCOMMAND_SET__PROPERTIES:
getProperties().clear();
return;
case CoreModelPackage.YCOMMAND_SET__COMMANDS:
getCommands().clear();
return;
case CoreModelPackage.YCOMMAND_SET__TRANSIENT_COMMANDS:
getTransientCommands().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CoreModelPackage.YCOMMAND_SET__TAGS:
return tags != null && !tags.isEmpty();
case CoreModelPackage.YCOMMAND_SET__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case CoreModelPackage.YCOMMAND_SET__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case CoreModelPackage.YCOMMAND_SET__PROPERTIES:
return properties != null && !properties.isEmpty();
case CoreModelPackage.YCOMMAND_SET__COMMANDS:
return commands != null && !commands.isEmpty();
case CoreModelPackage.YCOMMAND_SET__TRANSIENT_COMMANDS:
return transientCommands != null && !transientCommands.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(" (tags: ");
result.append(tags);
result.append(", id: ");
result.append(id);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} // YCommandSetImpl