org.eclipse.uml2
Interface Namespace

All Superinterfaces:
Element, EModelElement, EObject, NamedElement, Notifier, TemplateableElement
All Known Subinterfaces:
Activity, Actor, Artifact, Association, AssociationClass, Behavior, BehavioralFeature, BehavioredClassifier, Class, Classifier, Collaboration, CommunicationPath, Component, ConditionalNode, DataType, DeploymentSpecification, Device, EncapsulatedClassifier, Enumeration, ExecutionEnvironment, ExpansionRegion, Extension, FinalState, InformationItem, Interaction, InteractionOperand, Interface, LoopNode, Model, Node, Operation, Package, ParameterableClassifier, PrimitiveType, Profile, ProtocolStateMachine, Reception, Region, Signal, State, StateMachine, Stereotype, StructuredActivityNode, StructuredClassifier, TemplateableClassifier, UseCase

public interface Namespace
extends NamedElement

A representation of the model object 'Namespace'. A namespace is a named element that can own other named elements. Each named element may be owned by at most one namespace. A namespace provides a means for identifying named elements by name. Named elements can be identified by name in a namespace either by being directly owned by the namespace or by being introduced into the namespace by other means e.g. importing or inheriting. Namespace is an abstract metaclass. A namespace can own constraints. The constraint does not necessarily apply to the namespace itself, but may also apply to elements in the namespace. A namespace has the ability to import either individial members or all members of a package, thereby making it possible to refer to those named elements without qualification in the importing namespace. In the case of conflicts, it is necessary to use qualified names or aliases to disambiguate the referenced elements.

The following features are supported:

See Also:
UML2Package.getNamespace()

Field Summary
static String copyright
           
 
Fields inherited from interface org.eclipse.uml2.NamedElement
SEPARATOR
 
Method Summary
 ElementImport createElementImport(EClass eClass)
          Creates a ElementImport and appends it to the 'Element Import' containment reference list
 Constraint createOwnedRule(EClass eClass)
          Creates a Constraint and appends it to the 'Owned Rule' containment reference list
 PackageImport createPackageImport(EClass eClass)
          Creates a PackageImport and appends it to the 'Package Import' containment reference list
 Set excludeCollisions(Set imps)
           A query based on the following OCL expression: imps->reject(imp1 | imps.exists(imp2 | not imp1.isDistinguishableFrom(imp2, self)))
 EList getElementImports()
          Returns the value of the 'Element Import' containment reference list.
 PackageableElement getImportedMember(String unqualifiedName)
          Retrieves the PackageableElement with the specified name from the 'Imported Member' reference list
 EList getImportedMembers()
          Returns the value of the 'Imported Member' reference list.
 Set getImportedPackages()
          Retrieves the set of packages imported by this namespace.
 NamedElement getMember(String unqualifiedName)
          Retrieves the NamedElement with the specified name from the 'Member' reference list
 EList getMembers()
          Returns the value of the 'Member' reference list.
 Set getNamesOfMember(NamedElement element)
           A query based on the following OCL expression: 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
 EList getOwnedElements()
           
 EList getOwnedMembers()
           
 Constraint getOwnedRule(String unqualifiedName)
          Retrieves the Constraint with the specified name from the 'Owned Rule' containment reference list
 EList getOwnedRules()
          Returns the value of the 'Owned Rule' containment reference list.
 EList getPackageImports()
          Returns the value of the 'Package Import' containment reference list.
 Set importedMember()
           A query based on the following OCL expression: self.importedMembers(self.elementImport.importedElement.asSet()->union(self.packageImport.importedPackage->collect(p | p.visibleMembers())))
 void importElement(VisibilityKind visibility, PackageableElement element)
          Imports the specified element into this namespace with the specified visibility.
 Set importMembers(Set imps)
           A query based on the following OCL expression: self.excludeCollisions(imps)->select(imp | self.ownedMember->forAll(mem | mem.imp.isDistinguishableFrom(mem, self)))
 void importPackage(VisibilityKind visibility, Package package_)
          Imports the specified package into this namespace with the specified visibility.
 boolean membersAreDistinguishable()
           A query based on the following OCL expression: self.member->forAll( memb | self.member->excluding(memb)->forAll(other | memb.isDistinguishableFrom(other, self)))
 boolean validateImportedMemberDerived(DiagnosticChain diagnostics, Map context)
           An invariant constraint based on the following OCL expression: self.importedMember->includesAll(self.importedMembers(self.elementImport.importedElement.asSet()->union(self.packageImport.importedPackage->collect(p | p.visibleMembers()))))
 boolean validateMembersAreDistinguishable(DiagnosticChain diagnostics, Map context)
           An invariant constraint based on the following OCL expression: membersAreDistinguishable()
 
Methods inherited from interface org.eclipse.uml2.NamedElement
allNamespaces, createNameExpression, getClientDependencies, getClientDependency, getName, getNameExpression, getNamespace, getOwner, getQualifiedName, getVisibility, isDistinguishableFrom, qualifiedName, separator, setName, setNameExpression, setVisibility, validateNoName, validateQualifiedName, validateVisibilityNeedsOwnership
 
Methods inherited from interface org.eclipse.uml2.TemplateableElement
createOwnedTemplateSignature, createTemplateBinding, getOwnedTemplateSignature, getTemplateBindings, parameterableElements, setOwnedTemplateSignature
 
Methods inherited from interface org.eclipse.uml2.Element
addKeyword, allOwnedElements, apply, createEAnnotation, createOwnedComment, destroy, getApplicableStereotype, getApplicableStereotypes, getAppliedStereotype, getAppliedStereotypes, getAppliedVersion, getKeywords, getModel, getNearestPackage, getOwnedComments, getValue, hasKeyword, isApplied, isRequired, mustBeOwned, removeKeyword, setValue, unapply, validateHasOwner, validateNotOwnSelf
 
Methods inherited from interface org.eclipse.emf.ecore.EModelElement
getEAnnotation, getEAnnotations
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 

Field Detail

copyright

public static final String copyright

See Also:
Constant Field Values
Method Detail

getMembers

public EList getMembers()
Returns the value of the 'Member' reference list. The list contents are of type NamedElement.

If the meaning of the 'Member' reference list isn't clear, there really should be more of a description here...

A collection of NamedElements identifiable within the Namespace, either by being owned or by being introduced by importing or inheritance. This is a derived union.

Returns:
the value of the 'Member' reference list.
See Also:
UML2Package.getNamespace_Member()

getMember

public NamedElement getMember(String unqualifiedName)
Retrieves the NamedElement with the specified name from the 'Member' reference list.

Parameters:
unqualifiedName - The unqualified name of the NamedElement to retrieve.
Returns:
The NamedElement with the specified name, or null.
See Also:
getMembers()

getOwnedRules

public EList getOwnedRules()
Returns the value of the 'Owned Rule' containment reference list. The list contents are of type Constraint. It is bidirectional and its opposite is 'Namespace'.

If the meaning of the 'Owned Rule' containment reference list isn't clear, there really should be more of a description here...

Specifies a set of Constraints owned by this Namespace. Subsets Namespace::ownedMember.

Returns:
the value of the 'Owned Rule' containment reference list.
See Also:
UML2Package.getNamespace_OwnedRule(), Constraint.getNamespace()

getOwnedRule

public Constraint getOwnedRule(String unqualifiedName)
Retrieves the Constraint with the specified name from the 'Owned Rule' containment reference list.

Parameters:
unqualifiedName - The unqualified name of the Constraint to retrieve.
Returns:
The Constraint with the specified name, or null.
See Also:
getOwnedRules()

createOwnedRule

public Constraint createOwnedRule(EClass eClass)
Creates a Constraint and appends it to the 'Owned Rule' containment reference list.

Parameters:
eClass - The Ecore class of the Constraint to create.
Returns:
The new Constraint.
See Also:
getOwnedRules()

getImportedMembers

public EList getImportedMembers()
Returns the value of the 'Imported Member' reference list. The list contents are of type PackageableElement.

If the meaning of the 'Imported Member' reference list isn't clear, there really should be more of a description here...

References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. Subsets Namespace::member.

Returns:
the value of the 'Imported Member' reference list.
See Also:
UML2Package.getNamespace_ImportedMember()

getImportedMember

public PackageableElement getImportedMember(String unqualifiedName)
Retrieves the PackageableElement with the specified name from the 'Imported Member' reference list.

Parameters:
unqualifiedName - The unqualified name of the PackageableElement to retrieve.
Returns:
The PackageableElement with the specified name, or null.
See Also:
getImportedMembers()

getElementImports

public EList getElementImports()
Returns the value of the 'Element Import' containment reference list. The list contents are of type ElementImport. It is bidirectional and its opposite is 'Importing Namespace'.

If the meaning of the 'Element Import' containment reference list isn't clear, there really should be more of a description here...

References the ElementImports owned by the Namespace. Subsets Element::ownedElement.

Returns:
the value of the 'Element Import' containment reference list.
See Also:
UML2Package.getNamespace_ElementImport(), ElementImport.getImportingNamespace()

createElementImport

public ElementImport createElementImport(EClass eClass)
Creates a ElementImport and appends it to the 'Element Import' containment reference list.

Parameters:
eClass - The Ecore class of the ElementImport to create.
Returns:
The new ElementImport.
See Also:
getElementImports()

getPackageImports

public EList getPackageImports()
Returns the value of the 'Package Import' containment reference list. The list contents are of type PackageImport. It is bidirectional and its opposite is 'Importing Namespace'.

If the meaning of the 'Package Import' containment reference list isn't clear, there really should be more of a description here...

References the PackageImports owned by the Namespace. Subsets Element::ownedElement.

Returns:
the value of the 'Package Import' containment reference list.
See Also:
UML2Package.getNamespace_PackageImport(), PackageImport.getImportingNamespace()

createPackageImport

public PackageImport createPackageImport(EClass eClass)
Creates a PackageImport and appends it to the 'Package Import' containment reference list.

Parameters:
eClass - The Ecore class of the PackageImport to create.
Returns:
The new PackageImport.
See Also:
getPackageImports()

validateMembersAreDistinguishable

public boolean validateMembersAreDistinguishable(DiagnosticChain diagnostics,
                                                 Map context)
An invariant constraint based on the following OCL expression: membersAreDistinguishable()


getNamesOfMember

public Set getNamesOfMember(NamedElement element)
A query based on the following OCL expression: 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


membersAreDistinguishable

public boolean membersAreDistinguishable()
A query based on the following OCL expression: self.member->forAll( memb | self.member->excluding(memb)->forAll(other | memb.isDistinguishableFrom(other, self)))


validateImportedMemberDerived

public boolean validateImportedMemberDerived(DiagnosticChain diagnostics,
                                             Map context)
An invariant constraint based on the following OCL expression: self.importedMember->includesAll(self.importedMembers(self.elementImport.importedElement.asSet()->union(self.packageImport.importedPackage->collect(p | p.visibleMembers()))))


importedMember

public Set importedMember()
A query based on the following OCL expression: self.importedMembers(self.elementImport.importedElement.asSet()->union(self.packageImport.importedPackage->collect(p | p.visibleMembers())))


importMembers

public Set importMembers(Set imps)
A query based on the following OCL expression: self.excludeCollisions(imps)->select(imp | self.ownedMember->forAll(mem | mem.imp.isDistinguishableFrom(mem, self)))


excludeCollisions

public Set excludeCollisions(Set imps)
A query based on the following OCL expression: imps->reject(imp1 | imps.exists(imp2 | not imp1.isDistinguishableFrom(imp2, self)))


getOwnedMembers

public EList getOwnedMembers()


getOwnedElements

public EList getOwnedElements()

Specified by:
getOwnedElements in interface NamedElement

importElement

public void importElement(VisibilityKind visibility,
                          PackageableElement element)
Imports the specified element into this namespace with the specified visibility.

Parameters:
visibility - The visbility with which to import the element.
element - The element to import.
Throws:
IllegalArgumentException - If this namespace already imports the element.

getImportedPackages

public Set getImportedPackages()
Retrieves the set of packages imported by this namespace.

Returns:
The packages imported by this namespace.

importPackage

public void importPackage(VisibilityKind visibility,
                          Package package_)
Imports the specified package into this namespace with the specified visibility.

Parameters:
visibility - The visbility with which to import the package.
package_ - The package to import.
Throws:
IllegalArgumentException - If this namespace already imports the package.

Copyright 2003, 2004 IBM Corporation and others.
All Rights Reserved.