Table of Contents

Class Constraint

Namespace
NMF.Interop.Legacy.Cmof
Assembly
NMF.UMLInterop.dll

Constraint contains a ValueSpecification that specifies additional semantics for one or more elements. Certain kinds of constraints (such as an association "xor" constraint) are predefined in UML, others may be user-defined. A user-defined Constraint is described using a specified language, whose syntax and interpretation is a tool responsibility. One predefined language for writing constraints is OCL. In some situations, a programming language such as Java may be appropriate for expressing a constraint. In other situations natural language may be used.

Constraint is a condition (a Boolean expression) that restricts the extension of the associated element beyond what is imposed by the other language constructs applied to the element. Constraint contains an optional name, although they are commonly unnamed.

[AlternativeNamespace("http://schema.omg.org/spec/mof/2.0/emof.xmi")]
[XmlNamespace("http://schema.omg.org/spec/MOF/2.0/cmof.xml")]
[XmlNamespacePrefix("cmof")]
[ModelRepresentationClass("http://schema.omg.org/spec/MOF/2.0/cmof.xml#//Constraint")]
public class Constraint : PackageableElement, IConstraint, IPackageableElement, INamedElement, IElement, IModelElement, INotifyPropertyChanged, INotifyPropertyChanging
Inheritance
Constraint
Implements
Inherited Members

Constructors

Constraint()

Creates a new instance

public Constraint()

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

ConstrainedElement

The ordered set of Elements referenced by this Constraint.

[XmlElementName("constrainedElement")]
[XmlAttribute(true)]
public IOrderedSetExpression<IElement> ConstrainedElement { get; }

Property Value

IOrderedSetExpression<IElement>

Namespace

The namespace property

[Browsable(false)]
[XmlElementName("namespace")]
[XmlAttribute(true)]
[XmlOpposite("ownedRule")]
public INamespace Namespace { get; set; }

Property Value

INamespace

ReferencedElements

Gets the referenced model elements of this model element

public override IEnumerableExpression<IModelElement> ReferencedElements { get; }

Property Value

IEnumerableExpression<IModelElement>

Specification

A condition that must be true when evaluated in order for the constraint to be satisfied. Subsets Element::ownedElement.

[Browsable(false)]
[XmlElementName("specification")]
[XmlAttribute(false)]
[Containment]
public IValueSpecification Specification { get; set; }

Property Value

IValueSpecification

Methods

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

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

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

Not_apply_to_self(object, object)

A constraint cannot be applied to itself. not constrainedElement->includes(self)

public bool Not_apply_to_self(object diagnostics, object context)

Parameters

diagnostics object
context object

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

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

Value_specification_boolean(object, object)

The value specification for a constraint must evaluate to a boolean value. self.specification().booleanValue().isOclKindOf(Boolean)

public bool Value_specification_boolean(object diagnostics, object context)

Parameters

diagnostics object
context object

Returns

bool