Table of Contents

Class Package

Namespace
NMF.Interop.Uml
Assembly
NMF.UMLInterop.dll

A package can have one or more profile applications to indicate which profiles have been applied. Because a profile is a package, it is possible to apply a profile not only to packages, but also to profiles. Package specializes TemplateableElement and PackageableElement specializes ParameterableElement to specify that a package can be used as a template and a PackageableElement as a template parameter. A package is used to group elements, and provides a namespace for the grouped elements. <p>From package UML::Packages.</p>

[XmlNamespace("http://www.eclipse.org/uml2/5.0.0/UML")]
[XmlNamespacePrefix("uml")]
[ModelRepresentationClass("http://www.eclipse.org/uml2/5.0.0/UML#//Package")]
public class Package : Namespace, IPackage, ITemplateableElement, IPackageableElement, IParameterableElement, INamespace, INamedElement, IElement, IEModelElement, IModelElement, INotifyPropertyChanged, INotifyPropertyChanging
Inheritance
Package
Implements
Derived
Inherited Members

Constructors

Package()

Creates a new instance

public Package()

Properties

Children

Gets the child model elements of this model element

public override IEnumerableExpression<IModelElement> Children { get; }

Property Value

IEnumerableExpression<IModelElement>

ClassInstance

Gets the Class model for this type

public static IClass ClassInstance { get; }

Property Value

IClass

NestedPackage

References the packaged elements that are Packages. <p>From package UML::Packages.</p>

[Browsable(false)]
[XmlElementName("nestedPackage")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("nestingPackage")]
public IOrderedSetExpression<IPackage> NestedPackage { get; }

Property Value

IOrderedSetExpression<IPackage>

NestingPackage

References the Package that owns this Package. <p>From package UML::Packages.</p>

[Browsable(false)]
[XmlElementName("nestingPackage")]
[XmlAttribute(true)]
[XmlOpposite("nestedPackage")]
public IPackage NestingPackage { get; set; }

Property Value

IPackage

OwnedStereotype

References the Stereotypes that are owned by the Package. <p>From package UML::Packages.</p>

[Browsable(false)]
[XmlElementName("ownedStereotype")]
[XmlAttribute(false)]
[Containment]
public IOrderedSetExpression<IStereotype> OwnedStereotype { get; }

Property Value

IOrderedSetExpression<IStereotype>

OwnedTemplateSignature

The optional TemplateSignature specifying the formal TemplateParameters for this TemplateableElement. If a TemplateableElement has a TemplateSignature, then it is a template. <p>From package UML::CommonStructure.</p>

[Browsable(false)]
[XmlElementName("ownedTemplateSignature")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("template")]
public ITemplateSignature OwnedTemplateSignature { get; set; }

Property Value

ITemplateSignature

OwnedType

References the packaged elements that are Types. <p>From package UML::Packages.</p>

[Browsable(false)]
[XmlElementName("ownedType")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("package")]
public IOrderedSetExpression<IType> OwnedType { get; }

Property Value

IOrderedSetExpression<IType>

OwningTemplateParameter

The formal TemplateParameter that owns this ParameterableElement. <p>From package UML::CommonStructure.</p>

[XmlElementName("owningTemplateParameter")]
[XmlAttribute(true)]
[XmlOpposite("ownedParameteredElement")]
public ITemplateParameter OwningTemplateParameter { get; set; }

Property Value

ITemplateParameter

PackageMerge

References the PackageMerges that are owned by this Package. <p>From package UML::Packages.</p>

[Browsable(false)]
[XmlElementName("packageMerge")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("receivingPackage")]
public IOrderedSetExpression<IPackageMerge> PackageMerge { get; }

Property Value

IOrderedSetExpression<IPackageMerge>

ProfileApplication

References the ProfileApplications that indicate which profiles have been applied to the Package. <p>From package UML::Packages.</p>

[Browsable(false)]
[XmlElementName("profileApplication")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("applyingPackage")]
public IOrderedSetExpression<IProfileApplication> ProfileApplication { get; }

Property Value

IOrderedSetExpression<IProfileApplication>

ReferencedElements

Gets the referenced model elements of this model element

public override IEnumerableExpression<IModelElement> ReferencedElements { get; }

Property Value

IEnumerableExpression<IModelElement>

TemplateBinding

The optional TemplateBindings from this TemplateableElement to one or more templates. <p>From package UML::CommonStructure.</p>

[Browsable(false)]
[XmlElementName("templateBinding")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("boundElement")]
public IOrderedSetExpression<ITemplateBinding> TemplateBinding { get; }

Property Value

IOrderedSetExpression<ITemplateBinding>

TemplateParameter

The TemplateParameter that exposes this ParameterableElement as a formal parameter. <p>From package UML::CommonStructure.</p>

[XmlElementName("templateParameter")]
[XmlAttribute(true)]
[XmlOpposite("parameteredElement")]
public ITemplateParameter TemplateParameter { get; set; }

Property Value

ITemplateParameter

URI

Provides an identifier for the package that can be used for many purposes. A URI is the universally unique identification of the package following the IETF URI specification, RFC 2396 http://www.ietf.org/rfc/rfc2396.txt and it must comply with those syntax rules. <p>From package UML::Packages.</p>

[XmlAttribute(true)]
public string URI { get; set; }

Property Value

string

Methods

AllApplicableStereotypes()

The query allApplicableStereotypes() returns all the directly or indirectly owned stereotypes, including stereotypes contained in sub-profiles. result = (let ownedPackages : Bag(Package) = ownedMember->select(oclIsKindOf(Package))->collect(oclAsType(Package)) in ownedStereotype->union(ownedPackages.allApplicableStereotypes())->flatten()->asSet() ) <p>From package UML::Packages.</p>

public ISetExpression<IStereotype> AllApplicableStereotypes()

Returns

ISetExpression<IStereotype>

ApplyProfile(IProfile)

Applies the current definition of the specified profile to this package and automatically applies required stereotypes in the profile to elements within this package's namespace hieararchy. If a different definition is already applied, automatically migrates any associated stereotype values on a "best effort" basis (matching classifiers and structural features by name).

public ISetExpression<IEObject> ApplyProfile(IProfile profile)

Parameters

profile IProfile

The profile to apply.

Returns

ISetExpression<IEObject>

ApplyProfiles(IEnumerable<IProfile>)

Applies the current definitions of the specified profiles to this package and automatically applies required stereotypes in the profiles to elements within this package's namespace hieararchy. If different definitions are already applied, automatically migrates any associated stereotype values on a "best effort" basis (matching classifiers and structural features by name).

public ISetExpression<IEObject> ApplyProfiles(IEnumerable<IProfile> profiles)

Parameters

profiles IEnumerable<IProfile>

The profiles to apply.

Returns

ISetExpression<IEObject>

ContainingProfile()

The query containingProfile() returns the closest profile directly or indirectly containing this package (or this package itself, if it is a profile). result = (if self.oclIsKindOf(Profile) then self.oclAsType(Profile) else self.namespace.oclAsType(Package).containingProfile() endif) <p>From package UML::Packages.</p>

public IProfile ContainingProfile()

Returns

IProfile

CreateOwnedClass(string, bool)

Creates a(n) (abstract) class with the specified name as an owned type of this package.

public IClass CreateOwnedClass(string name, bool isAbstract)

Parameters

name string

The name for the new class, or null.

isAbstract bool

Whether the new class should be abstract.

Returns

IClass

CreateOwnedEnumeration(string)

Creates a enumeration with the specified name as an owned type of this package.

public IEnumeration CreateOwnedEnumeration(string name)

Parameters

name string

The name for the new enumeration, or null.

Returns

IEnumeration

CreateOwnedInterface(string)

Creates an interface with the specified name as an owned type of this package.

public IInterface CreateOwnedInterface(string name)

Parameters

name string

The name for the new interface, or null.

Returns

IInterface

CreateOwnedPrimitiveType(string)

Creates a primitive type with the specified name as an owned type of this package.

public IPrimitiveType CreateOwnedPrimitiveType(string name)

Parameters

name string

The name for the new primitive type, or null.

Returns

IPrimitiveType

CreateOwnedStereotype(string, bool)

Creates a(n) (abstract) stereotype with the specified name as an owned stereotype of this profile.

public IStereotype CreateOwnedStereotype(string name, bool isAbstract)

Parameters

name string

The name for the new stereotype, or null.

isAbstract bool

Whether the new stereotype should be abstract.

Returns

IStereotype

Elements_public_or_private(object, object)

If an element that is owned by a package has visibility, it is public or private. packagedElement->forAll(e | e.visibility<> null implies e.visibility = VisibilityKind::public or e.visibility = VisibilityKind::private)

public bool Elements_public_or_private(object diagnostics, object context)

Parameters

diagnostics object

The chain of diagnostics to which problems are to be appended.

context object

The cache of context-specific information.

Returns

bool

GetAllAppliedProfiles()

Retrieves all the profiles that are applied to this package, including profiles applied to its nesting package(s).

public ISetExpression<IProfile> GetAllAppliedProfiles()

Returns

ISetExpression<IProfile>

GetAllProfileApplications()

Retrieves all the profile applications for this package, including profile applications for its nesting package(s).

public ISetExpression<IProfileApplication> GetAllProfileApplications()

Returns

ISetExpression<IProfileApplication>

GetAppliedProfile(string)

Retrieves the profile with the specified qualified name that is applied to this package, or null if no such profile is applied.

public IProfile GetAppliedProfile(string qualifiedName)

Parameters

qualifiedName string

The qualified name of the applied profile to retrieve.

Returns

IProfile

GetAppliedProfile(string, bool)

Retrieves the profile with the specified qualified name that is applied to this package or any of its nesting packages (if indicated), or null if no such profile is applied.

public IProfile GetAppliedProfile(string qualifiedName, bool recurse)

Parameters

qualifiedName string

The qualified name of the applied profile to retrieve.

recurse bool

Whether to look in nesting packages.

Returns

IProfile

GetAppliedProfiles()

Retrieves the profiles that are applied to this package.

public ISetExpression<IProfile> GetAppliedProfiles()

Returns

ISetExpression<IProfile>

GetAttributeValue(string, int)

Resolves the given attribute name

protected override object GetAttributeValue(string attribute, int index)

Parameters

attribute string

The requested attribute name

index int

The index of this attribute

Returns

object

The attribute value or null if it could not be found

GetClass()

Gets the Class for this model element

public override IClass GetClass()

Returns

IClass

GetCollectionForFeature(string)

Gets the Model element collection for the given feature

protected override IList GetCollectionForFeature(string feature)

Parameters

feature string

The 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 object

The container object

Returns

string

The name of the respective container reference

GetExpressionForAttribute(string)

Gets the property expression for the given attribute

protected override INotifyExpression<object> GetExpressionForAttribute(string attribute)

Parameters

attribute string

The requested attribute in upper case

Returns

INotifyExpression<object>

An incremental property expression

GetExpressionForReference(string)

Gets the property expression for the given reference

protected override INotifyExpression<IModelElement> GetExpressionForReference(string reference)

Parameters

reference string

The requested reference in upper case

Returns

INotifyExpression<IModelElement>

An incremental property expression

GetModelElementForReference(string, int)

Resolves the given URI to a child model element

protected override IModelElement GetModelElementForReference(string reference, int index)

Parameters

reference string

The requested reference name

index int

The index of this reference

Returns

IModelElement

The model element or null if it could not be found

GetNestedPackages()

Derivation for Package::/nestedPackage result = (packagedElement->select(oclIsKindOf(Package))->collect(oclAsType(Package))->asSet()) <p>From package UML::Packages.</p>

public ISetExpression<IPackage> GetNestedPackages()

Returns

ISetExpression<IPackage>

GetOwnedStereotypes()

Derivation for Package::/ownedStereotype result = (packagedElement->select(oclIsKindOf(Stereotype))->collect(oclAsType(Stereotype))->asSet()) <p>From package UML::Packages.</p>

public ISetExpression<IStereotype> GetOwnedStereotypes()

Returns

ISetExpression<IStereotype>

GetOwnedTypes()

Derivation for Package::/ownedType result = (packagedElement->select(oclIsKindOf(Type))->collect(oclAsType(Type))->asSet()) <p>From package UML::Packages.</p>

public ISetExpression<IType> GetOwnedTypes()

Returns

ISetExpression<IType>

GetProfileApplication(IProfile)

Retrieves the application of the specified profile to this package, or null if no such profile is applied.

public IProfileApplication GetProfileApplication(IProfile profile)

Parameters

profile IProfile

The profile whose application to retrieve.

Returns

IProfileApplication

GetProfileApplication(IProfile, bool)

Retrieves the application of the specified profile to this package or any of its nesting packages (if indicated), or null if no such profile is applied.

public IProfileApplication GetProfileApplication(IProfile profile, bool recurse)

Parameters

profile IProfile

The profile whose application to retrieve.

recurse bool

Whether to look in nesting packages.

Returns

IProfileApplication

GetRelativePathForNonIdentifiedChild(IModelElement)

Gets the relative URI fragment for the given child model element

protected override string GetRelativePathForNonIdentifiedChild(IModelElement element)

Parameters

element IModelElement

The element that should be looked for

Returns

string

A fragment of the relative URI

IsCompatibleWith(IParameterableElement)

The query isCompatibleWith() determines if this ParameterableElement is compatible with the specified ParameterableElement. By default, this ParameterableElement is compatible with another ParameterableElement p if the kind of this ParameterableElement is the same as or a subtype of the kind of p. Subclasses of ParameterableElement should override this operation to specify different compatibility constraints. result = (self.oclIsKindOf(p.oclType())) <p>From package UML::CommonStructure.</p>

public bool IsCompatibleWith(IParameterableElement p)

Parameters

p IParameterableElement

Returns

bool

IsModelLibrary()

Determines whether this package is a model library.

public bool IsModelLibrary()

Returns

bool

IsProfileApplied(IProfile)

Determines whether the specified profile is applied to this package.

public bool IsProfileApplied(IProfile profile)

Parameters

profile IProfile

The profile in question.

Returns

bool

IsTemplate()

The query isTemplate() returns whether this TemplateableElement is actually a template. result = (ownedTemplateSignature <> null) <p>From package UML::CommonStructure.</p>

public bool IsTemplate()

Returns

bool

IsTemplateParameter()

The query isTemplateParameter() determines if this ParameterableElement is exposed as a formal TemplateParameter. result = (templateParameter->notEmpty()) <p>From package UML::CommonStructure.</p>

public bool IsTemplateParameter()

Returns

bool

MakesVisible(INamedElement)

The query makesVisible() defines whether a Package makes an element visible outside itself. Elements with no visibility and elements with public visibility are made visible. member->includes(el) result = (ownedMember->includes(el) or (elementImport->select(ei|ei.importedElement = VisibilityKind::public)->collect(importedElement.oclAsType(NamedElement))->includes(el)) or (packageImport->select(visibility = VisibilityKind::public)->collect(importedPackage.member->includes(el))->notEmpty())) <p>From package UML::Packages.</p>

public bool MakesVisible(INamedElement el)

Parameters

el INamedElement

Returns

bool

Namespace_needs_visibility(object, object)

A PackageableElement owned by a Namespace must have a visibility. visibility = null implies namespace = null

public bool Namespace_needs_visibility(object diagnostics, object context)

Parameters

diagnostics object

The chain of diagnostics to which problems are to be appended.

context object

The cache of context-specific information.

Returns

bool

OnParentChanged(IModelElement, IModelElement)

Gets called when the parent model element of the current model element changes

protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent)

Parameters

newParent IModelElement

The new parent model element

oldParent IModelElement

The old parent model element

OnParentChanging(IModelElement, IModelElement)

Gets called when the parent model element of the current model element is about to change

protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent)

Parameters

newParent IModelElement

The new parent model element

oldParent IModelElement

The old parent model element

ParameterableElements()

The query parameterableElements() returns the set of ParameterableElements that may be used as the parameteredElements for a TemplateParameter of this TemplateableElement. By default, this set includes all the ownedElements. Subclasses may override this operation if they choose to restrict the set of ParameterableElements. result = (self.allOwnedElements()->select(oclIsKindOf(ParameterableElement)).oclAsType(ParameterableElement)->asSet()) <p>From package UML::CommonStructure.</p>

public ISetExpression<IParameterableElement> ParameterableElements()

Returns

ISetExpression<IParameterableElement>

SetFeature(string, object)

Sets a value to the given feature

protected override void SetFeature(string feature, object value)

Parameters

feature string

The requested feature

value object

The value that should be set to that feature

UnapplyProfile(IProfile)

Unapplies the specified profile from this package and automatically unapplies stereotypes in the profile from elements within this package's namespace hieararchy.

public ISetExpression<IEObject> UnapplyProfile(IProfile profile)

Parameters

profile IProfile

The profile to unapply.

Returns

ISetExpression<IEObject>

VisibleMembers()

The query visibleMembers() defines which members of a Package can be accessed outside it. result = (member->select( m | m.oclIsKindOf(PackageableElement) and self.makesVisible(m))->collect(oclAsType(PackageableElement))->asSet()) <p>From package UML::Packages.</p>

public ISetExpression<IPackageableElement> VisibleMembers()

Returns

ISetExpression<IPackageableElement>