Show / Hide Table of Contents

Class ModelElement

Defines the base class for a model element implementation

Inheritance
object
ModelElement
Configuration
MethodConfiguration
EGenericType
EModelElement
EObject
EStringToStringMapEntry
LayoutInformation
AnyType
ProcessingInstruction
XMLTypeDocumentRoot
ModelChange
ModelChangeSet
OperationArgument
DynamicModelElement
AnnotationEntry
AttributeConstraint
MetaElement
ReferenceConstraint
Model
ModelElementExtension
Implements
IModelElement
INotifyPropertyChanged
INotifyPropertyChanging
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: NMF.Models
Assembly: NMF.Models.dll
Syntax
[ModelRepresentationClass("http://nmf.codeplex.com/nmeta/#//ModelElement/")]
public abstract class ModelElement : IModelElement, INotifyPropertyChanged, INotifyPropertyChanging

Properties

| Edit this page View Source

AbsoluteUri

Gets the abolute Uri for the current model element

Declaration
public Uri AbsoluteUri { get; }
Property Value
Type Description
Uri
| Edit this page View Source

Children

Gets a collection with the children of the current model element

Declaration
[Browsable(false)]
public virtual IEnumerableExpression<IModelElement> Children { get; }
Property Value
Type Description
IEnumerableExpression<IModelElement>
| Edit this page View Source

ClassInstance

Gets the NMeta class object for this type

Declaration
public static IClass ClassInstance { get; }
Property Value
Type Description
IClass
| Edit this page View Source

EnforceModels

Gets or sets a value indicating whether a correct model containment should be enforced

Declaration
public static bool EnforceModels { get; set; }
Property Value
Type Description
bool
| Edit this page View Source

Extensions

Gets a collection of model element extensions that have been applied to this model element

Declaration
public ICollectionExpression<ModelElementExtension> Extensions { get; }
Property Value
Type Description
ICollectionExpression<ModelElementExtension>
| Edit this page View Source

IsFrozen

Gets a value indicating whether the model element is closed for any future modifications

Declaration
public bool IsFrozen { get; }
Property Value
Type Description
bool
| Edit this page View Source

IsIdentified

Gets a value indicating whether this item can be identified through its ToString value

Declaration
[Browsable(false)]
public virtual bool IsIdentified { get; }
Property Value
Type Description
bool
| Edit this page View Source

IsLocked

Gets a value indicating whether the model element is temporarily locked

Declaration
public bool IsLocked { get; }
Property Value
Type Description
bool
| Edit this page View Source

Model

Gets the model that contains the current model element

Declaration
[Browsable(false)]
public Model Model { get; }
Property Value
Type Description
Model
| Edit this page View Source

Parent

Gets or sets the parent element for the current model element

Declaration
[Browsable(false)]
public IModelElement Parent { get; set; }
Property Value
Type Description
IModelElement
| Edit this page View Source

PreferIdentifiers

Gets or sets whether identifiers should be preferred in the serialization

Declaration
public static bool PreferIdentifiers { get; set; }
Property Value
Type Description
bool
| Edit this page View Source

ReferencedElements

Gets a collection of model elements referenced from this element.

Declaration
[Browsable(false)]
public virtual IEnumerableExpression<IModelElement> ReferencedElements { get; }
Property Value
Type Description
IEnumerableExpression<IModelElement>
| Edit this page View Source

RelativeUri

Gets the relative Uri for the current model element

Declaration
public Uri RelativeUri { get; }
Property Value
Type Description
Uri

Methods

| Edit this page View Source

CallOperation(IOperation, object[])

Calls the given operation

Declaration
public virtual object CallOperation(IOperation operation, object[] arguments)
Parameters
Type Name Description
IOperation operation

The operation that should be called

object[] arguments

The arguments used to call the operation

Returns
Type Description
object

The operation result or null, if the operation does not return any value

| Edit this page View Source

CreateUriFromGlobalIdentifier(string, bool)

Creates a uri with the given fragment

Declaration
protected Uri CreateUriFromGlobalIdentifier(string fragment, bool absolute)
Parameters
Type Name Description
string fragment

The fragment

bool absolute

True when the Uri should be absolute, otherwise False

Returns
Type Description
Uri

A uri with the given fragment

| Edit this page View Source

CreateUriWithFragment(string, bool, IModelElement)

Creates the uri with the given fragment starting from the current model element

Declaration
protected virtual Uri CreateUriWithFragment(string fragment, bool absolute, IModelElement baseElement = null)
Parameters
Type Name Description
string fragment

The fragment starting from this element

bool absolute

True, if an absolute Uri is desired, otherwise false

IModelElement baseElement

The element from which the uri shall be created or null

Returns
Type Description
Uri

A uri (relative or absolute)

| Edit this page View Source

Delete()

Deletes the current model element

Declaration
public virtual void Delete()
| Edit this page View Source

Freeze()

Freezes this model element such that it becomes immutable.

Declaration
public void Freeze()
| Edit this page View Source

GetAttributeValue(IAttribute, int)

Gets the value of the current model element under the given attribute

Declaration
[ObservableProxy(typeof(ModelElement.ModelElementProxy), "GetAttributeValue", false)]
public object GetAttributeValue(IAttribute attribute, int index = 0)
Parameters
Type Name Description
IAttribute attribute

The attribute

int index

The index of the desired value, if multi-valued attribute

Returns
Type Description
object

The attributes value

| Edit this page View Source

GetAttributeValue(string, int)

Gets the attribute value for the given attribute

Declaration
protected virtual object GetAttributeValue(string attribute, int index)
Parameters
Type Name Description
string attribute

The attributes name in upper case

int index

The attributes index

Returns
Type Description
object

The attribute value

| Edit this page View Source

GetAttributeValues(IAttribute)

Gets the values for the given attribute

Declaration
public IList GetAttributeValues(IAttribute attribute)
Parameters
Type Name Description
IAttribute attribute

The attribute whose value is queried

Returns
Type Description
IList

The attribute value collection

| Edit this page View Source

GetClass()

Gets the class of the current model element

Declaration
public abstract IClass GetClass()
Returns
Type Description
IClass

The class of the current model element

| Edit this page View Source

GetCollectionForFeature(string)

Gets the Model element collection for the given feature

Declaration
protected virtual IList GetCollectionForFeature(string feature)
Parameters
Type Name Description
string feature

The features name in upper case

Returns
Type Description
IList

A non-generic list of elements

| Edit this page View Source

GetCompositionName(object)

Gets the property name for the given container

Declaration
protected virtual string GetCompositionName(object container)
Parameters
Type Name Description
object container

The container object

Returns
Type Description
string

The name of the respective container reference

| Edit this page View Source

GetContainerReference(IModelElement, out int)

Gets the container reference for the given child element

Declaration
public virtual IReference GetContainerReference(IModelElement child, out int index)
Parameters
Type Name Description
IModelElement child

The child element

int index

The index of the child in the returned reference

Returns
Type Description
IReference

A composition reference or null, if the child is not contained in the model element

| Edit this page View Source

GetExpressionForAttribute(string)

Gets a property expression for the given attribute

Declaration
protected virtual INotifyExpression<object> GetExpressionForAttribute(string attribute)
Parameters
Type Name Description
string attribute

The requested attribute in upper case

Returns
Type Description
INotifyExpression<object>

A property expression

| Edit this page View Source

GetExpressionForReference(string)

Gets a property expression for the given reference

Declaration
protected virtual INotifyExpression<IModelElement> GetExpressionForReference(string reference)
Parameters
Type Name Description
string reference

The name of the requested reference in upper case

Returns
Type Description
INotifyExpression<IModelElement>

A property expression

| Edit this page View Source

GetExtension<T>()

Gets the extension with the given extension type

Declaration
public T GetExtension<T>() where T : ModelElementExtension
Returns
Type Description
T

The extension of the given extension type or null, if no such exists

Type Parameters
Name Description
T

The model element extension type

| Edit this page View Source

GetModelElementForPathSegment(string)

Gets the model element for the given relative Uri

Declaration
protected IModelElement GetModelElementForPathSegment(string segment)
Parameters
Type Name Description
string segment

The relative Uri

Returns
Type Description
IModelElement

The model element that corresponds to the given Uri

| Edit this page View Source

GetModelElementForReference(string, int)

Gets the Model element for the given reference and index

Declaration
protected virtual IModelElement GetModelElementForReference(string reference, int index)
Parameters
Type Name Description
string reference

The reference name in upper case

int index

The index of the element within the reference

Returns
Type Description
IModelElement

The model element at the given reference

| Edit this page View Source

GetReferencedElement(IReference, int)

Gets the referenced element of the current model element for the given reference

Declaration
[ObservableProxy(typeof(ModelElement.ModelElementProxy), "GetReferencedElement", false)]
public IModelElement GetReferencedElement(IReference reference, int index = 0)
Parameters
Type Name Description
IReference reference

The reference

int index

The index of the desired model element, if multi-valued reference

Returns
Type Description
IModelElement

The referenced element for the given reference

| Edit this page View Source

GetReferencedElements(IReference)

Gets the referenced elements of the current model element for the given reference

Declaration
public IList GetReferencedElements(IReference reference)
Parameters
Type Name Description
IReference reference

The reference

Returns
Type Description
IList

A collection of referenced elements

| Edit this page View Source

GetRelativePathForChild(IModelElement)

Gets the relative Uri for the given child element

Declaration
protected virtual string GetRelativePathForChild(IModelElement child)
Parameters
Type Name Description
IModelElement child

The child element

Returns
Type Description
string

A relative Uri to resolve the child element

| Edit this page View Source

GetRelativePathForNonIdentifiedChild(IModelElement)

Gets the relative Uri for the given child element that is not identified

Declaration
protected virtual string GetRelativePathForNonIdentifiedChild(IModelElement child)
Parameters
Type Name Description
IModelElement child

The child element

Returns
Type Description
string

A relative Uri to resolve the child element

| Edit this page View Source

Lock()

Locks this model element against any changes (can be undone)

Declaration
public void Lock()
| Edit this page View Source

OnBubbledChange(BubbledChangeEventArgs)

Fires the BubbledChange event

Declaration
protected virtual void OnBubbledChange(BubbledChangeEventArgs e)
Parameters
Type Name Description
BubbledChangeEventArgs e

The event data

| Edit this page View Source

OnChildCreated(IModelElement)

Gets called when a new model element is added as a child of the current model element

Declaration
protected virtual void OnChildCreated(IModelElement child)
Parameters
Type Name Description
IModelElement child

The child element

Remarks

This method is not called if an existing model element is moved in the composition hierarchy

| Edit this page View Source

OnCollectionChanged(string, NotifyCollectionChangedEventArgs, Lazy<ITypedElement>)

Raises the Bubbled Change event for the given collection change

Declaration
protected void OnCollectionChanged(string propertyName, NotifyCollectionChangedEventArgs e, Lazy<ITypedElement> feature = null)
Parameters
Type Name Description
string propertyName

The name of the property that has changed

NotifyCollectionChangedEventArgs e

The event data

Lazy<ITypedElement> feature

The feature that is changing

| Edit this page View Source

OnCollectionChanging(string, NotifyCollectionChangedEventArgs, Lazy<ITypedElement>)

Raises the Bubbled Change event for the given upcoming collection change

Declaration
protected void OnCollectionChanging(string propertyName, NotifyCollectionChangedEventArgs e, Lazy<ITypedElement> feature = null)
Parameters
Type Name Description
string propertyName

The name of the property that has changed

NotifyCollectionChangedEventArgs e

The event data

Lazy<ITypedElement> feature

The feature that is changing

| Edit this page View Source

OnDeleted(UriChangedEventArgs)

Gets called when the model element gets deleted

Declaration
protected virtual void OnDeleted(UriChangedEventArgs e)
Parameters
Type Name Description
UriChangedEventArgs e

The event data

| Edit this page View Source

OnDeleting(UriChangedEventArgs)

Gets called before the model element gets deleted

Declaration
protected virtual void OnDeleting(UriChangedEventArgs e)
Parameters
Type Name Description
UriChangedEventArgs e
| Edit this page View Source

OnKeyChanged(EventArgs)

Fires the KeyChanged event

Declaration
protected virtual void OnKeyChanged(EventArgs e)
Parameters
Type Name Description
EventArgs e

The event data

| Edit this page View Source

OnParentChanged(IModelElement, IModelElement)

Gets called when the parent element of the current element changes

Declaration
protected virtual void OnParentChanged(IModelElement newParent, IModelElement oldParent)
Parameters
Type Name Description
IModelElement newParent

The new parent element

IModelElement oldParent

The old parent element

| Edit this page View Source

OnParentChanging(IModelElement, IModelElement)

Gets called when the parent element of the current element changes

Declaration
protected virtual void OnParentChanging(IModelElement newParent, IModelElement oldParent)
Parameters
Type Name Description
IModelElement newParent

The new parent element

IModelElement oldParent

The old parent element

| Edit this page View Source

OnPropertyChanged(string, ValueChangedEventArgs, Lazy<ITypedElement>)

Gets called when the PropertyChanged event is fired

Declaration
protected virtual void OnPropertyChanged(string propertyName, ValueChangedEventArgs valueChangedEvent, Lazy<ITypedElement> feature = null)
Parameters
Type Name Description
string propertyName

The name of the changed property

ValueChangedEventArgs valueChangedEvent

The original event data

Lazy<ITypedElement> feature

The feature

| Edit this page View Source

OnPropertyChanging(string, ValueChangedEventArgs, Lazy<ITypedElement>)

Gets called when the PropertyChanging event is fired

Declaration
protected virtual void OnPropertyChanging(string propertyName, ValueChangedEventArgs e = null, Lazy<ITypedElement> feature = null)
Parameters
Type Name Description
string propertyName

The name of the changed property

ValueChangedEventArgs e

The event data

Lazy<ITypedElement> feature

The feature

| Edit this page View Source

PropagateNewId(ValueChangedEventArgs)

Informs the model that the current model element has a new id

Declaration
protected void PropagateNewId(ValueChangedEventArgs e)
Parameters
Type Name Description
ValueChangedEventArgs e

The event data for the value change of the identifier

| Edit this page View Source

PropagateNewModel(Model, Model, IModelElement)

Propagates through the composition hierarchy that an entire subtree has been added to a new model

Declaration
protected virtual void PropagateNewModel(Model newModel, Model oldModel, IModelElement subtreeRoot)
Parameters
Type Name Description
Model newModel

The new model that will host the subtree

Model oldModel

The old model of the subtree

IModelElement subtreeRoot

The root element of the inserted subtree

| Edit this page View Source

Resolve(string)

Resolves the given path starting from the current element

Declaration
public virtual IModelElement Resolve(string relativeUri)
Parameters
Type Name Description
string relativeUri

The path

Returns
Type Description
IModelElement

The element corresponding to the given path or null, if no such element could be found

| Edit this page View Source

Resolve(Uri)

Resolves the given relative Uri from the current model element

Declaration
public IModelElement Resolve(Uri relativeUri)
Parameters
Type Name Description
Uri relativeUri

A relative uri describing the path to the desired child element

Returns
Type Description
IModelElement

The corresponding child element or null, if no such was found

| Edit this page View Source

SetAttributeValue(IAttribute, object)

Sets the value of the current model element for the given attribute

Declaration
public void SetAttributeValue(IAttribute attribute, object value)
Parameters
Type Name Description
IAttribute attribute

The attribute

object value

The value that should be set

| Edit this page View Source

SetFeature(string, object)

Sets the given feature to the given value

Declaration
protected virtual void SetFeature(string feature, object value)
Parameters
Type Name Description
string feature

The name of the feature that should be set

object value

The value that should be set

| Edit this page View Source

SetReferencedElement(IReference, IModelElement)

Sets the referenced element of the current model element for the given reference

Declaration
public void SetReferencedElement(IReference reference, IModelElement element)
Parameters
Type Name Description
IReference reference

The reference

IModelElement element

The element that should be set

| Edit this page View Source

ToIdentifierString()

Gets the identifier for this model element

Declaration
public virtual string ToIdentifierString()
Returns
Type Description
string
| Edit this page View Source

ToString()

Gets a string representation of the current model element

Declaration
public override string ToString()
Returns
Type Description
string

A string representation of the current model element

Overrides
object.ToString()
| Edit this page View Source

TryUnlock()

Tries to unlock the current model element in order to make changes possible

Declaration
public bool TryUnlock()
Returns
Type Description
bool

True, if unlocking the model element succeeds, otherwise False

| Edit this page View Source

Unlock()

Unlocks this model element.

Declaration
public void Unlock()
Exceptions
Type Condition
LockedException

thrown if the model element could not be unlocked

Events

| Edit this page View Source

BubbledChange

Is fired when an element in the below containment hierarchy has changed

Declaration
public event EventHandler<BubbledChangeEventArgs> BubbledChange
Event Type
Type Description
EventHandler<BubbledChangeEventArgs>
| Edit this page View Source

Deleted

Gets fired after the model element has been deleted

Declaration
public event EventHandler<UriChangedEventArgs> Deleted
Event Type
Type Description
EventHandler<UriChangedEventArgs>
| Edit this page View Source

Deleting

Gets fired before the model element gets deleted

Declaration
public event EventHandler<UriChangedEventArgs> Deleting
Event Type
Type Description
EventHandler<UriChangedEventArgs>
| Edit this page View Source

KeyChanged

Gets fired when the identifier of the current model element changes

Declaration
public event EventHandler KeyChanged
Event Type
Type Description
EventHandler
| Edit this page View Source

ParentChanged

Gets fired when the container of the current model element has changed

Declaration
public event EventHandler<ValueChangedEventArgs> ParentChanged
Event Type
Type Description
EventHandler<ValueChangedEventArgs>
| Edit this page View Source

PropertyChanged

Gets fired when a property value changes

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type Description
PropertyChangedEventHandler
| Edit this page View Source

PropertyChanging

Gets fired before a property value changes

Declaration
public event PropertyChangingEventHandler PropertyChanging
Event Type
Type Description
PropertyChangingEventHandler
| Edit this page View Source

UriChanged

Gets fired when the Uri of this element changes

Declaration
public event EventHandler<UriChangedEventArgs> UriChanged
Event Type
Type Description
EventHandler<UriChangedEventArgs>

Implements

IModelElement
INotifyPropertyChanged
INotifyPropertyChanging

Extension Methods

ModelExtensions.AncestorTree(IModelElement)
ModelExtensions.Ancestors(IModelElement)
ModelExtensions.Descendants(IModelElement)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX