Class Namespace
A namespace is an element in a model that contains a set of named elements that can be identified by name.
[XmlNamespace("http://www.omg.org/spec/MOF/20131001/cmof.xmi")]
[XmlNamespacePrefix("cmof")]
[ModelRepresentationClass("http://www.omg.org/spec/MOF/20131001/cmof.xmi#//Namespace")]
public abstract class Namespace : NamedElement, INamespace, INamedElement, IElement, IObject, IModelElement, INotifyPropertyChanged, INotifyPropertyChanging
- Inheritance
-
Namespace
- Implements
- Derived
- Inherited Members
Constructors
Namespace()
Creates a new instance
public Namespace()
Properties
Children
Gets the child model elements of this model element
public override IEnumerableExpression<IModelElement> Children { get; }
Property Value
ClassInstance
Gets the Class model for this type
public static IClass ClassInstance { get; }
Property Value
ElementImport
References the ElementImports owned by the Namespace.
[Browsable(false)]
[XmlElementName("elementImport")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("importingNamespace")]
public IOrderedSetExpression<IElementImport> ElementImport { get; }
Property Value
OwnedRule
Specifies a set of Constraints owned by this Namespace.
[Browsable(false)]
[XmlElementName("ownedRule")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("context")]
public IListExpression<IConstraint> OwnedRule { get; }
Property Value
PackageImport
References the PackageImports owned by the Namespace.
[Browsable(false)]
[XmlElementName("packageImport")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("importingNamespace")]
public IOrderedSetExpression<IPackageImport> PackageImport { get; }
Property Value
ReferencedElements
Gets the referenced model elements of this model element
public override IEnumerableExpression<IModelElement> ReferencedElements { get; }
Property Value
Methods
ExcludeCollisions(IEnumerable<IPackageableElement>)
The query excludeCollisions() excludes from a set of PackageableElements any that would not be distinguishable from each other in this namespace. result = imps->reject(imp1 | imps.exists(imp2 | not imp1.isDistinguishableFrom(imp2, self)))
public ISetExpression<IPackageableElement> ExcludeCollisions(IEnumerable<IPackageableElement> imps)
Parameters
Returns
GetClass()
Gets the Class for this model element
public override IClass GetClass()
Returns
GetCollectionForFeature(string)
Gets the Model element collection for the given feature
protected override IList GetCollectionForFeature(string feature)
Parameters
feature
stringThe requested feature
Returns
- IList
A non-generic list of elements
GetCompositionName(object)
Gets the property name for the given container
protected override string GetCompositionName(object container)
Parameters
container
objectThe container object
Returns
- string
The name of the respective container reference
GetModelElementForReference(string, int)
Resolves the given URI to a child model element
protected override IModelElement GetModelElementForReference(string reference, int index)
Parameters
Returns
- IModelElement
The model element or null if it could not be found
GetNamesOfMember(INamedElement)
The query getNamesOfMember() takes importing into account. It gives back the set of names that an element would have in an importing namespace, either because it is owned, or if not owned then imported individually, or if not individually then from a package. The query getNamesOfMember() gives a set of all of the names that a member would have in a Namespace. In general a member can have multiple names in a Namespace if it is imported more than once with different aliases. The query takes account of importing. It gives back the set of names that an element would have in an importing namespace, either because it is owned, or if not owned then imported individually, or if not individually then from a package. result = if self.ownedMember ->includes(element) then Set{}->include(element.name) else let elementImports: ElementImport = self.elementImport->select(ei | ei.importedElement = element) in if elementImports->notEmpty() then elementImports->collect(el | el.getName()) else self.packageImport->select(pi | pi.importedPackage.visibleMembers()->includes(element))-> collect(pi | pi.importedPackage.getNamesOfMember(element)) endif endif
public ISetExpression<string> GetNamesOfMember(INamedElement element)
Parameters
element
INamedElement
Returns
GetRelativePathForNonIdentifiedChild(IModelElement)
Gets the relative URI fragment for the given child model element
protected override string GetRelativePathForNonIdentifiedChild(IModelElement element)
Parameters
element
IModelElementThe element that should be looked for
Returns
- string
A fragment of the relative URI
ImportMembers(IEnumerable<IPackageableElement>)
The query importMembers() defines which of a set of PackageableElements are actually imported into the namespace. This excludes hidden ones, i.e., those which have names that conflict with names of owned members, and also excludes elements which would have the same name when imported. result = self.excludeCollisions(imps)->select(imp | self.ownedMember->forAll(mem | mem.imp.isDistinguishableFrom(mem, self)))
public ISetExpression<IPackageableElement> ImportMembers(IEnumerable<IPackageableElement> imps)
Parameters
Returns
MembersAreDistinguishable()
The Boolean query membersAreDistinguishable() determines whether all of the namespace's members are distinguishable within it. result = self.member->forAll( memb | self.member->excluding(memb)->forAll(other | memb.isDistinguishableFrom(other, self)))
public bool MembersAreDistinguishable()
Returns
Members_distinguishable(object, object)
All the members of a Namespace are distinguishable within it. membersAreDistinguishable()
public bool Members_distinguishable(object diagnostics, object context)
Parameters
diagnostics
objectThe chain of diagnostics to which problems are to be appended.
context
objectThe cache of context-specific information.