Table of Contents

Class ModelHelper

Namespace
NMF.Models
Assembly
NMF.Models.dll

Denotes helper methods for model elements

public static class ModelHelper
Inheritance
ModelHelper
Inherited Members

Methods

CanCreateInstance<T>()

True, if an instance of the element type can be created automatically, resolving DefaultImplementationType attributes

public static bool CanCreateInstance<T>()

Returns

bool

True, if an element of the given type can be instantiated, otherwise False

Type Parameters

T

The type of elements to create

CreateInstance<T>()

Creates an instance of the given element type

public static T CreateInstance<T>()

Returns

T

Type Parameters

T

CreatePath(string)

Creates a relative Uri for the given reference name

public static string CreatePath(string reference)

Parameters

reference string

The name of the reference

Returns

string

A relative Uri for the given reference

CreatePath(string, int)

Creates a Uri for an ordered reference where the child element has the given index

public static string CreatePath(string reference, int index)

Parameters

reference string

The reference of the child element

index int

The index inside the child element

Returns

string

A relative Uri for the reference with the given index

ImplementationType<T>()

Gets the type used to instantiate the given type

public static Type ImplementationType<T>()

Returns

Type

The type used for the implementation

Type Parameters

T

The interface type in question

IndexOfReference<T>(IList<T>, IModelElement)

Gets the index of the given element inside the given reference or -1 if the element is not contained in the reference

public static int IndexOfReference<T>(IList<T> reference, IModelElement element) where T : class, IModelElement

Parameters

reference IList<T>

The reference list

element IModelElement

The element that should be looked for

Returns

int

The index of the element or -1, if the reference does not contain the given element

Type Parameters

T

The element type for the reference

ParseIdentifierSegment(string, out string, out string, out string)

Parses the given relative Uri for a identifier reference

public static bool ParseIdentifierSegment(string segment, out string reference, out string identifierReference, out string identifier)

Parameters

segment string

The relative Uri

reference string

The reference that corresponds to the Uri. This is never null.

identifierReference string

The identifier reference. This is never null.

identifier string

The identifier. This is never null.

Returns

bool

True, if the segment was parsed successfully, otherwise false

ParseSegment(string, out string, out int)

Parses the given relative Uri

public static bool ParseSegment(string segment, out string reference, out int index)

Parameters

segment string

the relative Uri

reference string

The reference that corresponds to the Uri. This is never null.

index int

The element index of the Uri or 0 if no index is given

Returns

bool

True, if the segment was parsed successfully, otherwise false

Parse<T>(string)

Parses the given text into the given type

public static T Parse<T>(string text)

Parameters

text string

The text that should be parsed

Returns

T

An instance of the semantic type

Type Parameters

T

The type of element