public final class AadlUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canImplement(ComponentImplementation impl,
ComponentType type)
Check to see that a component type and a component implementation have
the same category
|
static boolean |
canImplement(FlowImplementation fi,
FlowSpecification fs)
Check whether the flow specification and flow implementation are both
flow paths, flow sources, or flow sinks
|
static boolean |
containedIn(InstanceObject element,
ComponentInstance parent) |
static <T extends org.eclipse.emf.ecore.EObject> |
copyList(java.util.List<? extends T> list)
Returns a list of the self-contained copies of each
EObject in
the given list. |
static int |
countElementsBySubclass(Element root,
java.lang.Class clazz)
For the subtree rooted at the given node, count the number of model
elements whose class extends from the given model element type.
|
static org.eclipse.emf.common.util.EList<AnnexSubclause> |
findAnnexSubclause(Classifier c,
java.lang.String annexName) |
static ConnectionInstance |
findConnectionInstance(InstanceObject src,
InstanceObject dst)
find the connection instance with src as its source and dst as its
destination
|
static org.eclipse.emf.common.util.EList<NamedElement> |
findDoubleNamedElementsInList(java.util.List<?> el)
Check to see if all NamedElements in the Elist have a unique name.
|
static Element |
findElement(Element modelelement,
int location)
Find the Element whose location reference is close to the line number.
|
static AadlPackage |
findImportedPackage(java.lang.String name,
Namespace context)
find package name in the with clause of the containing top level name space (PackageSection or Property set) of the context.
|
static PropertySet |
findImportedPropertySet(java.lang.String name,
org.eclipse.emf.ecore.EObject context)
find property set name in the with clause of the containing top level name space (PackageSection or Property set) of the context.
|
static org.eclipse.emf.ecore.EClass |
findMetaModelClass(java.lang.String classname)
find Meta model class object in meta model packages
|
static NamedElement |
findNamedElementInList(java.util.List<?> el,
java.lang.String name)
find (first) Named Element matching name in the Elist; any elements that
are not NamedElements are skipped.
|
static org.eclipse.emf.common.util.EList<NamedElement> |
findNamedElementsInList(java.util.List<?> el,
java.lang.String name)
find all Named Elements matching name in the Elist; any elements that are
not NamedElements are skipped.
|
static AnnexLibrary |
findPrivateAnnexLibrary(AadlPackage p,
java.lang.String annexName) |
static AnnexLibrary |
findPublicAnnexLibrary(AadlPackage p,
java.lang.String annexName) |
static org.eclipse.emf.common.util.EList<AnnexSubclause> |
getAllAnnexSubclauses(Classifier cl,
java.lang.String annexName) |
static org.eclipse.emf.common.util.EList<ComponentImplementation> |
getAllComponentImpl()
Get all component implementations; in all anon.
|
static org.eclipse.emf.common.util.EList<ComponentImplementation> |
getAllComponentImpl(AadlPackage o)
Get all component implementation; in anon.
|
static PropertyType |
getBasePropertyType(PropertyType pt) |
static java.lang.String |
getClassifierName(Classifier cl,
Element context) |
static java.lang.String |
getClassifierOrLocalName(NamedElement ne,
Element context) |
static java.lang.String |
getConnectionEndName(AbstractConnectionEnd end) |
static NamedElement |
getContainingAnnex(org.eclipse.emf.ecore.EObject obj) |
static Classifier |
getContainingClassifier(org.eclipse.emf.ecore.EObject element)
get containing Classifier.
|
static Feature |
getContainingFeature(org.eclipse.emf.ecore.EObject element) |
static FeatureGroup |
getContainingFeatureGroup(org.eclipse.emf.ecore.EObject element) |
static AadlPackage |
getContainingPackage(org.eclipse.emf.ecore.EObject element) |
static PackageSection |
getContainingPackageSection(org.eclipse.emf.ecore.EObject element) |
static PropertyAssociation |
getContainingPropertyAssociation(org.eclipse.emf.ecore.EObject element) |
static PropertySet |
getContainingPropertySet(org.eclipse.emf.ecore.EObject element) |
static Subcomponent |
getContainingSubcomponent(org.eclipse.emf.ecore.EObject element) |
static Classifier |
getContainingSubcomponentClassifier(org.eclipse.emf.ecore.EObject element) |
static SubprogramCall |
getContainingSubprogramCall(org.eclipse.emf.ecore.EObject element) |
static Namespace |
getContainingTopLevelNamespace(org.eclipse.emf.ecore.EObject element)
get containing property set or package section
if element is already top level name space return itself
|
static Element |
getElement(java.lang.Object object)
Try to retrieve an
Element from an object. |
static org.eclipse.emf.common.util.EList<FeatureGroupConnection> |
getFeatureGroupConnection(java.util.Collection<?> portconn)
extract the set of feature group connections from the list of connections
|
static java.lang.String |
getFeaturePrototypeName(FeaturePrototype ft,
Element context) |
static java.lang.String |
getFeatureTypeName(FeatureType st,
Element context) |
static java.lang.String |
getFlowEndName(FlowEnd end) |
static java.lang.String |
getFlowSegmentName(EndToEndFlowSegment end) |
static java.lang.String |
getFlowSegmentName(FlowSegment end) |
static org.eclipse.emf.common.util.EList<Connection> |
getIngoingConnections(ComponentImplementation cimpl,
Feature feature)
get ingoing connections to subcomponents from a specified feature of the
component impl
|
static Element |
getInstanceOrigin(InstanceObject io) |
static java.lang.String |
getModeTransitionTriggerName(ModeTransitionTrigger end) |
static org.eclipse.emf.common.util.EList<FeatureGroupConnection> |
getPortGroupConnection(java.util.Collection<? extends Connection> portconn)
extract the set of feature group connections from the list of connections
|
static java.util.Set<java.lang.String> |
getPredeclaredPropertySetNames() |
static java.lang.String |
getPropertySetElementName(NamedElement el)
get the qualified name of an element in the property set (property definition/type/constant
|
static java.lang.String |
getQualifiedClassName(java.lang.String classname)
find Meta model class in meta model packages
|
static java.lang.String |
getSubcomponentTypeName(SubcomponentType st,
Element context) |
static boolean |
hasOutgoingFeatureSubcomponents(org.eclipse.emf.common.util.EList<? extends ComponentInstance> subcompinstances)
determine whether a component instance has subcomponents that can have
outgoing connections
|
static boolean |
hasOutgoingPortSubcomponents(org.eclipse.emf.common.util.EList<? extends ComponentInstance> subcompinstances)
determine whether a component instance has subcomponents that can have
outgoing connections
|
static boolean |
hasPortComponents(ComponentImplementation compimpl)
determine whether a component instance has subcomponents with ports
|
static boolean |
isComplete(ConnectionInstance conni) |
static boolean |
isImportedPackage(AadlPackage pack,
Namespace context)
check whether package is in the with clause of the containing top level name space (PackageSection or Property set) of the context.
|
static boolean |
isImportedPropertySet(PropertySet ps,
org.eclipse.emf.ecore.EObject context)
check whether property set is in the with clause of the containing top level name space (PackageSection or Property set) of the context.
|
static boolean |
isOutgoingFeature(Feature f)
determine whether the feature is an outgoing port or feature group
|
static boolean |
isOutgoingPort(Feature f)
determine whether the feature is an outgoing port or feature group
|
static boolean |
isPredeclaredPropertySet(java.lang.String psname) |
static void |
makeSureFoldersExist(org.eclipse.core.runtime.IPath path)
make sure the parent folders exist.
|
static boolean |
matchingClassifier(Classifier source,
Classifier dest)
check to see that the source classifier matches that of the destination
implementations must be the same, types must be the same; if the source
is an implementation and the destination is a type their types must match
In case of the feature group the feature group types must match
|
static boolean |
oncePerMode(java.util.List<? extends ModalElement> list,
java.util.List<? extends Mode> allModes)
Check to ensure that there is at most one list element per mode
|
static boolean |
sameCategory(Subcomponent sub,
ComponentClassifier c)
Check to see if the category of the subcomponent and the classifier match
|
static boolean |
sameEClass(org.eclipse.emf.ecore.EObject c1,
org.eclipse.emf.ecore.EObject c2)
Compare the EClass of the two EObjects
|
public static java.util.Set<java.lang.String> getPredeclaredPropertySetNames()
public static boolean isPredeclaredPropertySet(java.lang.String psname)
public static NamedElement findNamedElementInList(java.util.List<?> el, java.lang.String name)
el
- Elist of NamedElementsname
- Stringpublic static org.eclipse.emf.common.util.EList<NamedElement> findNamedElementsInList(java.util.List<?> el, java.lang.String name)
el
- Elist of NamedElementsname
- Stringpublic static org.eclipse.emf.common.util.EList<NamedElement> findDoubleNamedElementsInList(java.util.List<?> el)
el
- EList or NamedElements or other objectspublic static boolean sameEClass(org.eclipse.emf.ecore.EObject c1, org.eclipse.emf.ecore.EObject c2)
c1
- EObjectc2
- EObjectpublic static boolean oncePerMode(java.util.List<? extends ModalElement> list, java.util.List<? extends Mode> allModes)
list
- list of ModeMemberspublic static boolean canImplement(FlowImplementation fi, FlowSpecification fs)
fi
- flow implementationfs
- flow specificationpublic static boolean canImplement(ComponentImplementation impl, ComponentType type)
impl
- ComponentImplementationtype
- ComponentTypepublic static boolean sameCategory(Subcomponent sub, ComponentClassifier c)
sub
- Subcomponentc
- ComponentClassifierpublic static boolean matchingClassifier(Classifier source, Classifier dest)
source
- Classifierdest
- Classifierpublic static org.eclipse.emf.common.util.EList<FeatureGroupConnection> getFeatureGroupConnection(java.util.Collection<?> portconn)
portconn
- list of port connectionspublic static <T extends org.eclipse.emf.ecore.EObject> java.util.List<T> copyList(java.util.List<? extends T> list)
EObject
in
the given list.list
- the list of objects to copy.EcoreUtil.copy(org.eclipse.emf.ecore.EObject)
public static Element getElement(java.lang.Object object)
Element
from an object.
This method is intended to be used with objects that obtained from a
selection event, i.e., from the
ISelectionChangedListener.selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
method.
If the object is an Element, it is returned. Otherwise, the method tries to adapt the object to an Element. The Object could be an Element, IAdaptable, an instance model resource, or a TreeSelection of a IFile in the Navigator
object
- The object to get an Element from.null
if no Element can be obtained
from the given object.public static java.lang.String getQualifiedClassName(java.lang.String classname)
classname
- the class name to be qualified with the package namepublic static org.eclipse.emf.ecore.EClass findMetaModelClass(java.lang.String classname)
classname
- the class name to be foundpublic static java.lang.String getFeaturePrototypeName(FeaturePrototype ft, Element context)
public static java.lang.String getClassifierOrLocalName(NamedElement ne, Element context)
public static java.lang.String getSubcomponentTypeName(SubcomponentType st, Element context)
public static java.lang.String getFeatureTypeName(FeatureType st, Element context)
public static java.lang.String getClassifierName(Classifier cl, Element context)
public static java.lang.String getPropertySetElementName(NamedElement el)
el
- public static Element findElement(Element modelelement, int location)
modelelement
- The model element used as root of the searchlocation
- line numberpublic static Element getInstanceOrigin(InstanceObject io)
public static int countElementsBySubclass(Element root, java.lang.Class clazz)
int numSubs = AadlUtil.countElementsBySubclass(root, Subcomponent.class);
root
- The root of the subtree.clazz
- The class to count instances of.public static boolean hasPortComponents(ComponentImplementation compimpl)
subcompinstances
- list of sub component instancespublic static void makeSureFoldersExist(org.eclipse.core.runtime.IPath path)
path
- public static boolean hasOutgoingPortSubcomponents(org.eclipse.emf.common.util.EList<? extends ComponentInstance> subcompinstances)
subcompinstances
- list of sub component instancespublic static org.eclipse.emf.common.util.EList<Connection> getIngoingConnections(ComponentImplementation cimpl, Feature feature)
feature
- component impl feature that is the source of a connectioncontext
- the outer feature (feature group) or nullpublic static boolean isOutgoingPort(Feature f)
f
- Featurepublic static boolean hasOutgoingFeatureSubcomponents(org.eclipse.emf.common.util.EList<? extends ComponentInstance> subcompinstances)
subcompinstances
- list of sub component instancespublic static boolean isOutgoingFeature(Feature f)
f
- Featurepublic static org.eclipse.emf.common.util.EList<FeatureGroupConnection> getPortGroupConnection(java.util.Collection<? extends Connection> portconn)
portconn
- list of port connectionspublic static ConnectionInstance findConnectionInstance(InstanceObject src, InstanceObject dst)
src
- InstanceObjectdst
- InstanceObjectpublic static org.eclipse.emf.common.util.EList<ComponentImplementation> getAllComponentImpl()
public static org.eclipse.emf.common.util.EList<ComponentImplementation> getAllComponentImpl(AadlPackage o)
o
- AadlPackagepublic static PropertyType getBasePropertyType(PropertyType pt)
public static java.lang.String getConnectionEndName(AbstractConnectionEnd end)
public static java.lang.String getFlowEndName(FlowEnd end)
public static java.lang.String getFlowSegmentName(FlowSegment end)
public static java.lang.String getFlowSegmentName(EndToEndFlowSegment end)
public static java.lang.String getModeTransitionTriggerName(ModeTransitionTrigger end)
public static NamedElement getContainingAnnex(org.eclipse.emf.ecore.EObject obj)
public static Classifier getContainingClassifier(org.eclipse.emf.ecore.EObject element)
element
- public static Classifier getContainingSubcomponentClassifier(org.eclipse.emf.ecore.EObject element)
public static FeatureGroup getContainingFeatureGroup(org.eclipse.emf.ecore.EObject element)
public static SubprogramCall getContainingSubprogramCall(org.eclipse.emf.ecore.EObject element)
public static Feature getContainingFeature(org.eclipse.emf.ecore.EObject element)
public static Subcomponent getContainingSubcomponent(org.eclipse.emf.ecore.EObject element)
public static PropertyAssociation getContainingPropertyAssociation(org.eclipse.emf.ecore.EObject element)
public static PackageSection getContainingPackageSection(org.eclipse.emf.ecore.EObject element)
public static AadlPackage getContainingPackage(org.eclipse.emf.ecore.EObject element)
public static PropertySet getContainingPropertySet(org.eclipse.emf.ecore.EObject element)
public static Namespace getContainingTopLevelNamespace(org.eclipse.emf.ecore.EObject element)
element
- a model elementpublic static AadlPackage findImportedPackage(java.lang.String name, Namespace context)
name
- Package namecontext
- location at which package reference is encounteredpublic static boolean isImportedPackage(AadlPackage pack, Namespace context)
pack
- Aadl Packagecontext
- location at which package reference is encounteredpublic static PropertySet findImportedPropertySet(java.lang.String name, org.eclipse.emf.ecore.EObject context)
name
- Property set namecontext
- location at which property set reference is encounteredpublic static boolean isImportedPropertySet(PropertySet ps, org.eclipse.emf.ecore.EObject context)
ps
- Property setcontext
- location at which property set reference is encounteredpublic static org.eclipse.emf.common.util.EList<AnnexSubclause> getAllAnnexSubclauses(Classifier cl, java.lang.String annexName)
public static org.eclipse.emf.common.util.EList<AnnexSubclause> findAnnexSubclause(Classifier c, java.lang.String annexName)
public static AnnexLibrary findPublicAnnexLibrary(AadlPackage p, java.lang.String annexName)
public static AnnexLibrary findPrivateAnnexLibrary(AadlPackage p, java.lang.String annexName)
public static boolean isComplete(ConnectionInstance conni)
public static boolean containedIn(InstanceObject element, ComponentInstance parent)