org.andromda.metafacades.emf.uml22.GeneralizableElementFacadeLogicImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of andromda-metafacades-emf-uml22 Show documentation
Show all versions of andromda-metafacades-emf-uml22 Show documentation
The Eclipse EMF UML2 v2.X metafacades. This is the set of EMF UML2 2.X metafacades
implementations. These implement the common UML metafacades for .uml model files.
The newest version!
package org.andromda.metafacades.emf.uml22;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import org.andromda.metafacades.uml.GeneralizableElementFacade;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Generalization;
/**
* MetafacadeLogic implementation for
* org.andromda.metafacades.uml.GeneralizableElementFacade.
*
* @see org.andromda.metafacades.uml.GeneralizableElementFacade
*/
public class GeneralizableElementFacadeLogicImpl
extends GeneralizableElementFacadeLogic
{
private static final long serialVersionUID = 34L;
/**
* @param metaObject
* @param context
*/
public GeneralizableElementFacadeLogicImpl(
final Object metaObject,
final String context)
{
super(metaObject, context);
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getGeneralizationList()
*/
@Override
protected String handleGetGeneralizationList()
{
final StringBuilder list = new StringBuilder();
if (this.getGeneralizations() != null)
{
for (final Iterator iterator = this.getGeneralizations().iterator(); iterator.hasNext();)
{
final GeneralizableElementFacade element = iterator.next();
list.append(element.getFullyQualifiedName());
if (iterator.hasNext())
{
list.append(", ");
}
}
}
return list.toString();
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getGeneralization()
*/
@Override
protected Classifier handleGetGeneralization()
{
Classifier parent = null;
final Collection generalizations = ((Classifier)this.metaObject).getGeneralizations();
if (generalizations != null && !generalizations.isEmpty())
{
parent = generalizations.iterator().next().getGeneral();
}
return parent;
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getSpecializations()
*/
@Override
protected Collection handleGetSpecializations()
{
return UmlUtilities.getSpecializations((Classifier)this.metaObject);
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getGeneralizations()
*/
@Override
protected Collection handleGetGeneralizations()
{
final Collection parents = new LinkedHashSet();
final Collection generalizations = ((Classifier)this.metaObject).getGeneralizations();
if (generalizations != null && !generalizations.isEmpty())
{
for (Generalization general : generalizations)
{
parents.add(general.getGeneral());
}
}
return parents;
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getGeneralizationLinks()
*/
@Override
protected Collection handleGetGeneralizationLinks()
{
return ((Classifier)this.metaObject).getGeneralizations();
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getAllSpecializations()
*/
@Override
protected Set handleGetAllSpecializations()
{
final Set allSpecializations = new LinkedHashSet();
if (this.getSpecializations() != null)
{
allSpecializations.addAll(this.getSpecializations());
for (GeneralizableElementFacade element : this.getSpecializations())
{
allSpecializations.addAll(element.getAllSpecializations());
}
}
return allSpecializations;
}
/**
* @see org.andromda.metafacades.uml.GeneralizableElementFacade#getAllGeneralizations()
*/
@Override
protected Collection handleGetAllGeneralizations()
{
final Collection generalizations = new ArrayList();
for (GeneralizableElementFacade element : this.getGeneralizations())
{
generalizations.add(element);
generalizations.addAll(element.getAllGeneralizations());
}
return generalizations;
}
/**
* @see org.andromda.metafacades.emf.uml22.GeneralizableElementFacadeLogic#handleFindTaggedValue(String, boolean)
*/
@Override
protected Object handleFindTaggedValue(
final String tagName,
final boolean follow)
{
Object value = this.findTaggedValue(tagName);
if (value == null && follow)
{
for (GeneralizableElementFacade element = this.getGeneralization(); element != null;
element = element.getGeneralization())
{
value = element.findTaggedValue(
tagName,
follow);
if (value != null)
{
break;
}
}
}
return value;
}
/**
* @see org.andromda.metafacades.emf.uml22.GeneralizableElementFacadeLogic#handleGetGeneralizationRoot()
*/
@Override
protected GeneralizableElementFacade handleGetGeneralizationRoot()
{
GeneralizableElementFacade generalizableElement = (GeneralizableElementFacade)THIS();
while (generalizableElement.getGeneralization() != null)
{
generalizableElement = generalizableElement.getGeneralization();
}
return generalizableElement;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy