| /******************************************************************************* |
| * Copyright (c) 2015 ALL4TEC & CEA LIST. |
| * 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: |
| * ALL4TEC & CEA LIST - initial API and implementation |
| ******************************************************************************/ |
| package org.polarsys.esf.esfarchitectureconcepts.impl; |
| |
| import org.eclipse.emf.common.util.BasicEList; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.util.EcoreEList.UnmodifiableEList; |
| import org.eclipse.uml2.uml.Connector; |
| import org.eclipse.uml2.uml.Element; |
| import org.eclipse.uml2.uml.util.UMLUtil; |
| import org.polarsys.esf.esfarchitectureconcepts.IAbstractSConnectableElement; |
| import org.polarsys.esf.esfarchitectureconcepts.IESFArchitectureConceptsFactory; |
| import org.polarsys.esf.esfarchitectureconcepts.IMSConnector; |
| import org.polarsys.esf.esfarchitectureconcepts.ISBlock; |
| import org.polarsys.esf.esfcore.impl.GenericAbstractSElement; |
| |
| /** |
| * This class can override the generated class {@link SConnector} |
| * and will be used by the custom factory. |
| * |
| * @author $Author: ymunoz $ |
| * @version $Revision: 168 $ |
| */ |
| public class MSConnector |
| extends SConnector |
| implements IMSConnector { |
| |
| /** |
| * Default constructor. |
| */ |
| public MSConnector() { |
| super(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| */ |
| @Override |
| public String getName() { |
| return GenericAbstractSElement.getName(getBase_Connector()); |
| } |
| |
| /** |
| * {@inheritDoc} |
| */ |
| @Override |
| public String getUUID() { |
| return GenericAbstractSElement.getUUID(getBase_Connector()); |
| } |
| |
| /** |
| * {@inheritDoc} |
| */ |
| @Override |
| public EList<IAbstractSConnectableElement> getEndsList() { |
| EList<IAbstractSConnectableElement> vSConnectableElementsList = new BasicEList<IAbstractSConnectableElement>(); |
| |
| // TODO: Retrieve all Ends of SConnector |
| |
| UnmodifiableEList<IAbstractSConnectableElement> vUSConnectableElementsList = |
| new UnmodifiableEList<IAbstractSConnectableElement>( |
| this, |
| ESFArchitectureConceptsPackage.eINSTANCE.getSConnector_EndsList(), |
| vSConnectableElementsList.size(), |
| vSConnectableElementsList.toArray()); |
| return vUSConnectableElementsList; |
| } |
| |
| /** |
| * {@inheritDoc} |
| */ |
| @Override |
| public ISBlock basicGetOwner() { |
| Connector vBase = getBase_Connector(); |
| ISBlock vSBlock = IESFArchitectureConceptsFactory.eINSTANCE.createSBlock(); |
| |
| if (vBase != null) { |
| Element vOwner = vBase.getOwner(); |
| if ((vOwner != null) && (UMLUtil.getStereotypeApplication(vOwner, SBlock.class) != null)) { |
| vSBlock = (SBlock) UMLUtil.getStereotypeApplication(vOwner, SBlock.class); |
| } |
| } |
| return vSBlock; |
| } |
| } |