blob: f4798f5d3d5b375dfb82fe66e59ed04481c9b469 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2008 Hatha Systems.
* 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:
* Nikolai Mansourov (Hatha Systems) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.gmt.modisco.omg.kdm.data.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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.gmt.modisco.omg.kdm.action.ActionElement;
import org.eclipse.gmt.modisco.omg.kdm.core.impl.KDMEntityImpl;
import org.eclipse.gmt.modisco.omg.kdm.data.AbstractDataRelationship;
import org.eclipse.gmt.modisco.omg.kdm.data.ContentRestriction;
import org.eclipse.gmt.modisco.omg.kdm.data.DataPackage;
import org.eclipse.gmt.modisco.omg.kdm.source.SourceRef;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Content Restriction</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.ContentRestrictionImpl#getSource <em>Source</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.ContentRestrictionImpl#getDataRelation <em>Data Relation</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.ContentRestrictionImpl#getAbstraction <em>Abstraction</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.ContentRestrictionImpl#getKind <em>Kind</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.ContentRestrictionImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ContentRestrictionImpl extends KDMEntityImpl implements ContentRestriction {
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected EList<SourceRef> source;
/**
* The cached value of the '{@link #getDataRelation() <em>Data Relation</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDataRelation()
* @generated
* @ordered
*/
protected EList<AbstractDataRelationship> dataRelation;
/**
* The cached value of the '{@link #getAbstraction() <em>Abstraction</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAbstraction()
* @generated
* @ordered
*/
protected EList<ActionElement> abstraction;
/**
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected static final String KIND_EDEFAULT = null;
/**
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected String kind = KIND_EDEFAULT;
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ContentRestrictionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DataPackage.Literals.CONTENT_RESTRICTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<SourceRef> getSource() {
if (source == null) {
source = new EObjectContainmentEList<SourceRef>(SourceRef.class, this, DataPackage.CONTENT_RESTRICTION__SOURCE);
}
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<AbstractDataRelationship> getDataRelation() {
if (dataRelation == null) {
dataRelation = new EObjectContainmentEList<AbstractDataRelationship>(AbstractDataRelationship.class, this, DataPackage.CONTENT_RESTRICTION__DATA_RELATION);
}
return dataRelation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ActionElement> getAbstraction() {
if (abstraction == null) {
abstraction = new EObjectContainmentEList<ActionElement>(ActionElement.class, this, DataPackage.CONTENT_RESTRICTION__ABSTRACTION);
}
return abstraction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getKind() {
return kind;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setKind(String newKind) {
String oldKind = kind;
kind = newKind;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.CONTENT_RESTRICTION__KIND, oldKind, kind));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.CONTENT_RESTRICTION__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DataPackage.CONTENT_RESTRICTION__SOURCE:
return ((InternalEList<?>)getSource()).basicRemove(otherEnd, msgs);
case DataPackage.CONTENT_RESTRICTION__DATA_RELATION:
return ((InternalEList<?>)getDataRelation()).basicRemove(otherEnd, msgs);
case DataPackage.CONTENT_RESTRICTION__ABSTRACTION:
return ((InternalEList<?>)getAbstraction()).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 DataPackage.CONTENT_RESTRICTION__SOURCE:
return getSource();
case DataPackage.CONTENT_RESTRICTION__DATA_RELATION:
return getDataRelation();
case DataPackage.CONTENT_RESTRICTION__ABSTRACTION:
return getAbstraction();
case DataPackage.CONTENT_RESTRICTION__KIND:
return getKind();
case DataPackage.CONTENT_RESTRICTION__VALUE:
return getValue();
}
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 DataPackage.CONTENT_RESTRICTION__SOURCE:
getSource().clear();
getSource().addAll((Collection<? extends SourceRef>)newValue);
return;
case DataPackage.CONTENT_RESTRICTION__DATA_RELATION:
getDataRelation().clear();
getDataRelation().addAll((Collection<? extends AbstractDataRelationship>)newValue);
return;
case DataPackage.CONTENT_RESTRICTION__ABSTRACTION:
getAbstraction().clear();
getAbstraction().addAll((Collection<? extends ActionElement>)newValue);
return;
case DataPackage.CONTENT_RESTRICTION__KIND:
setKind((String)newValue);
return;
case DataPackage.CONTENT_RESTRICTION__VALUE:
setValue((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DataPackage.CONTENT_RESTRICTION__SOURCE:
getSource().clear();
return;
case DataPackage.CONTENT_RESTRICTION__DATA_RELATION:
getDataRelation().clear();
return;
case DataPackage.CONTENT_RESTRICTION__ABSTRACTION:
getAbstraction().clear();
return;
case DataPackage.CONTENT_RESTRICTION__KIND:
setKind(KIND_EDEFAULT);
return;
case DataPackage.CONTENT_RESTRICTION__VALUE:
setValue(VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DataPackage.CONTENT_RESTRICTION__SOURCE:
return source != null && !source.isEmpty();
case DataPackage.CONTENT_RESTRICTION__DATA_RELATION:
return dataRelation != null && !dataRelation.isEmpty();
case DataPackage.CONTENT_RESTRICTION__ABSTRACTION:
return abstraction != null && !abstraction.isEmpty();
case DataPackage.CONTENT_RESTRICTION__KIND:
return KIND_EDEFAULT == null ? kind != null : !KIND_EDEFAULT.equals(kind);
case DataPackage.CONTENT_RESTRICTION__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
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(" (kind: "); //$NON-NLS-1$
result.append(kind);
result.append(", value: "); //$NON-NLS-1$
result.append(value);
result.append(')');
return result.toString();
}
} //ContentRestrictionImpl