blob: 322601d02601b9ab549ce2a56e593b8b882f35bb [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2016 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.esflocalanalysis.impl;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreEList.UnmodifiableEList;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.polarsys.esf.esfcore.impl.GenericAbstractSElement;
import org.polarsys.esf.esflocalanalysis.IMSFearedEventsLibrary;
import org.polarsys.esf.esflocalanalysis.ISFearedEvent;
import org.polarsys.esf.esflocalanalysis.ISFearedEventsFamily;
import org.polarsys.esf.esflocalanalysis.ISLocalAnalysis;
/**
* This class can override the generated class {@link SFearedEventsLibrary} and will be
* used by the custom factory.
*
* @author $Author: ymunoz $
* @version $Revision: 168 $
*/
public class MSFearedEventsLibrary
extends SFearedEventsLibrary
implements IMSFearedEventsLibrary {
/**
* Default constructor.
*/
public MSFearedEventsLibrary() {
super();
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return GenericAbstractSElement.getName(getBase_Package());
}
/**
* {@inheritDoc}
*/
@Override
public String getUUID() {
return GenericAbstractSElement.getUUID(getBase_Package());
}
/**
* {@inheritDoc}
*/
@Override
public EList<ISFearedEventsFamily> getSFearedEventsFamiliesList() {
EList<ISFearedEventsFamily> vSFearedEventsFamiliesList = new BasicEList<ISFearedEventsFamily>();
Package vBase = getBase_Package();
if (vBase != null) {
for (Element vElement : vBase.getOwnedElements()) {
EObject vStereotypeApplication = UMLUtil.getStereotypeApplication(vElement, ISFearedEventsFamily.class);
if (vStereotypeApplication != null) {
vSFearedEventsFamiliesList.add((ISFearedEventsFamily) vStereotypeApplication);
}
}
}
UnmodifiableEList<ISFearedEventsFamily> vUSFearedEventsFamiliesList =
new UnmodifiableEList<ISFearedEventsFamily>(
this,
ESFLocalAnalysisPackage.eINSTANCE.getSFearedEventsLibrary_SFearedEventsFamiliesList(),
vSFearedEventsFamiliesList.size(),
vSFearedEventsFamiliesList.toArray());
return vUSFearedEventsFamiliesList;
}
/**
* {@inheritDoc}
*/
@Override
public EList<ISFearedEvent> getSFearedEventsList() {
EList<ISFearedEvent> vSFearedEventsList = new BasicEList<ISFearedEvent>();
Package vBase = getBase_Package();
if (vBase != null) {
for (Element vElement : vBase.getOwnedElements()) {
EObject vStereotypeApplication = UMLUtil.getStereotypeApplication(vElement, ISFearedEvent.class);
if (vStereotypeApplication != null) {
vSFearedEventsList.add((ISFearedEvent) vStereotypeApplication);
}
}
}
UnmodifiableEList<ISFearedEvent> vUSFearedEventsList =
new UnmodifiableEList<ISFearedEvent>(
this,
ESFLocalAnalysisPackage.eINSTANCE.getSFearedEventsLibrary_SFearedEventsList(),
vSFearedEventsList.size(),
vSFearedEventsList.toArray());
return vUSFearedEventsList;
}
/**
* {@inheritDoc}
*/
@Override
public ISLocalAnalysis basicGetSLocalAnalysis() {
Package vBase = getBase_Package();
ISLocalAnalysis vLocalAnalysis = null;
if (vBase != null) {
Element vOwner = vBase.getOwner();
EObject vStereotypeApplication = UMLUtil.getStereotypeApplication(vOwner, ISLocalAnalysis.class);
if (vStereotypeApplication != null) {
vLocalAnalysis = (ISLocalAnalysis) vStereotypeApplication;
}
}
return vLocalAnalysis;
}
}