/**
*/
package edu.ufc.femtost.disc.sysml4modelica.profile.components.impl;
import edu.ufc.femtost.disc.sysml4modelica.profile.components.ComponentsPackage;
import edu.ufc.femtost.disc.sysml4modelica.profile.components.ModelicaPort;
import edu.ufc.femtost.disc.sysml4modelica.profile.types.ModelicaCausalityKind;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
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.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.uml2.uml.Port;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Modelica Port</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#isReplaceable <em>Is Replaceable</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#getConditionalExpression <em>Conditional Expression</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#getModification <em>Modification</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#getArraySize <em>Array Size</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#getCausality <em>Causality</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#isFinal <em>Is Final</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.components.impl.ModelicaPortImpl#getBase_Port <em>Base Port</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ModelicaPortImpl extends MinimalEObjectImpl.Container implements ModelicaPort {
/**
* The default value of the '{@link #isReplaceable() <em>Is Replaceable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isReplaceable()
* @generated
* @ordered
*/
protected static final boolean IS_REPLACEABLE_EDEFAULT = false;
/**
* The cached value of the '{@link #isReplaceable() <em>Is Replaceable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isReplaceable()
* @generated
* @ordered
*/
protected boolean isReplaceable = IS_REPLACEABLE_EDEFAULT;
/**
* The default value of the '{@link #getConditionalExpression() <em>Conditional Expression</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConditionalExpression()
* @generated
* @ordered
*/
protected static final String CONDITIONAL_EXPRESSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getConditionalExpression() <em>Conditional Expression</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConditionalExpression()
* @generated
* @ordered
*/
protected String conditionalExpression = CONDITIONAL_EXPRESSION_EDEFAULT;
/**
* The cached value of the '{@link #getModification() <em>Modification</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModification()
* @generated
* @ordered
*/
protected EList<String> modification;
/**
* The cached value of the '{@link #getArraySize() <em>Array Size</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArraySize()
* @generated
* @ordered
*/
protected EList<String> arraySize;
/**
* The default value of the '{@link #getCausality() <em>Causality</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCausality()
* @generated
* @ordered
*/
protected static final ModelicaCausalityKind CAUSALITY_EDEFAULT = ModelicaCausalityKind.NONE;
/**
* The cached value of the '{@link #getCausality() <em>Causality</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCausality()
* @generated
* @ordered
*/
protected ModelicaCausalityKind causality = CAUSALITY_EDEFAULT;
/**
* The default value of the '{@link #isFinal() <em>Is Final</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isFinal()
* @generated
* @ordered
*/
protected static final boolean IS_FINAL_EDEFAULT = false;
/**
* The cached value of the '{@link #getBase_Port() <em>Base Port</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_Port()
* @generated
* @ordered
*/
protected Port base_Port;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ModelicaPortImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ComponentsPackage.Literals.MODELICA_PORT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isReplaceable() {
return isReplaceable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsReplaceable(boolean newIsReplaceable) {
boolean oldIsReplaceable = isReplaceable;
isReplaceable = newIsReplaceable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.MODELICA_PORT__IS_REPLACEABLE, oldIsReplaceable, isReplaceable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getConditionalExpression() {
return conditionalExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConditionalExpression(String newConditionalExpression) {
String oldConditionalExpression = conditionalExpression;
conditionalExpression = newConditionalExpression;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.MODELICA_PORT__CONDITIONAL_EXPRESSION, oldConditionalExpression, conditionalExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getModification() {
if (modification == null) {
modification = new EDataTypeUniqueEList<String>(String.class, this, ComponentsPackage.MODELICA_PORT__MODIFICATION);
}
return modification;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getArraySize() {
if (arraySize == null) {
arraySize = new EDataTypeUniqueEList<String>(String.class, this, ComponentsPackage.MODELICA_PORT__ARRAY_SIZE);
}
return arraySize;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelicaCausalityKind getCausality() {
return causality;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCausality(ModelicaCausalityKind newCausality) {
ModelicaCausalityKind oldCausality = causality;
causality = newCausality == null ? CAUSALITY_EDEFAULT : newCausality;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.MODELICA_PORT__CAUSALITY, oldCausality, causality));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isFinal() {
return this.base_Port.isLeaf();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void setIsFinal(boolean newIsFinal) {
this.base_Port.setIsLeaf(newIsFinal);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Port getBase_Port() {
if (base_Port != null && base_Port.eIsProxy()) {
InternalEObject oldBase_Port = (InternalEObject)base_Port;
base_Port = (Port)eResolveProxy(oldBase_Port);
if (base_Port != oldBase_Port) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentsPackage.MODELICA_PORT__BASE_PORT, oldBase_Port, base_Port));
}
}
return base_Port;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Port basicGetBase_Port() {
return base_Port;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_Port(Port newBase_Port) {
Port oldBase_Port = base_Port;
base_Port = newBase_Port;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.MODELICA_PORT__BASE_PORT, oldBase_Port, base_Port));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ComponentsPackage.MODELICA_PORT__IS_REPLACEABLE:
return isReplaceable();
case ComponentsPackage.MODELICA_PORT__CONDITIONAL_EXPRESSION:
return getConditionalExpression();
case ComponentsPackage.MODELICA_PORT__MODIFICATION:
return getModification();
case ComponentsPackage.MODELICA_PORT__ARRAY_SIZE:
return getArraySize();
case ComponentsPackage.MODELICA_PORT__CAUSALITY:
return getCausality();
case ComponentsPackage.MODELICA_PORT__IS_FINAL:
return isFinal();
case ComponentsPackage.MODELICA_PORT__BASE_PORT:
if (resolve) return getBase_Port();
return basicGetBase_Port();
}
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 ComponentsPackage.MODELICA_PORT__IS_REPLACEABLE:
setIsReplaceable((Boolean)newValue);
return;
case ComponentsPackage.MODELICA_PORT__CONDITIONAL_EXPRESSION:
setConditionalExpression((String)newValue);
return;
case ComponentsPackage.MODELICA_PORT__MODIFICATION:
getModification().clear();
getModification().addAll((Collection<? extends String>)newValue);
return;
case ComponentsPackage.MODELICA_PORT__ARRAY_SIZE:
getArraySize().clear();
getArraySize().addAll((Collection<? extends String>)newValue);
return;
case ComponentsPackage.MODELICA_PORT__CAUSALITY:
setCausality((ModelicaCausalityKind)newValue);
return;
case ComponentsPackage.MODELICA_PORT__IS_FINAL:
setIsFinal((Boolean)newValue);
return;
case ComponentsPackage.MODELICA_PORT__BASE_PORT:
setBase_Port((Port)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ComponentsPackage.MODELICA_PORT__IS_REPLACEABLE:
setIsReplaceable(IS_REPLACEABLE_EDEFAULT);
return;
case ComponentsPackage.MODELICA_PORT__CONDITIONAL_EXPRESSION:
setConditionalExpression(CONDITIONAL_EXPRESSION_EDEFAULT);
return;
case ComponentsPackage.MODELICA_PORT__MODIFICATION:
getModification().clear();
return;
case ComponentsPackage.MODELICA_PORT__ARRAY_SIZE:
getArraySize().clear();
return;
case ComponentsPackage.MODELICA_PORT__CAUSALITY:
setCausality(CAUSALITY_EDEFAULT);
return;
case ComponentsPackage.MODELICA_PORT__IS_FINAL:
setIsFinal(IS_FINAL_EDEFAULT);
return;
case ComponentsPackage.MODELICA_PORT__BASE_PORT:
setBase_Port((Port)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ComponentsPackage.MODELICA_PORT__IS_REPLACEABLE:
return isReplaceable != IS_REPLACEABLE_EDEFAULT;
case ComponentsPackage.MODELICA_PORT__CONDITIONAL_EXPRESSION:
return CONDITIONAL_EXPRESSION_EDEFAULT == null ? conditionalExpression != null : !CONDITIONAL_EXPRESSION_EDEFAULT.equals(conditionalExpression);
case ComponentsPackage.MODELICA_PORT__MODIFICATION:
return modification != null && !modification.isEmpty();
case ComponentsPackage.MODELICA_PORT__ARRAY_SIZE:
return arraySize != null && !arraySize.isEmpty();
case ComponentsPackage.MODELICA_PORT__CAUSALITY:
return causality != CAUSALITY_EDEFAULT;
case ComponentsPackage.MODELICA_PORT__IS_FINAL:
return isFinal() != IS_FINAL_EDEFAULT;
case ComponentsPackage.MODELICA_PORT__BASE_PORT:
return base_Port != 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(" (isReplaceable: ");
result.append(isReplaceable);
result.append(", conditionalExpression: ");
result.append(conditionalExpression);
result.append(", modification: ");
result.append(modification);
result.append(", arraySize: ");
result.append(arraySize);
result.append(", causality: ");
result.append(causality);
result.append(')');
return result.toString();
}
} //ModelicaPortImpl