Class MarkupDataContainer
Initializes a new instance of the MarkupDataContainer class. Represents an abstract container for MarkupData elements, providing thread-safe management of child items, hierarchical traversal, and collection manipulation methods. Enforces constraints such as unique child IDs among siblings and ancestors, and prevents nesting of certain container types. Supports depth-first traversal, addition, insertion, removal, and movement of child elements.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemoryApi.LiteBCM
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public abstract class MarkupDataContainer : MarkupData
Constructors
MarkupDataContainer()
Initializes a new instance of the MarkupDataContainer class.
Declaration
protected MarkupDataContainer()
MarkupDataContainer(String)
Initializes a new instance of the MarkupDataContainer class.
Declaration
protected MarkupDataContainer(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| String | id | The identifier. |
Properties
AllSubItems
All the MarkupData items in the subtree, in depth-first order.
Declaration
public IEnumerable<MarkupData> AllSubItems { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<MarkupData> |
Children
The container's direct children. Can not be null. Null items can not be added. Items with duplicate Id values are not allowed between siblings or in the ancestors. RevisionContainer and FeedbackContainer items are not allowed to be nested.
Declaration
public IReadOnlyCollection<MarkupData> Children { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<MarkupData> |
Count
Gets the number of children of this container.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | The number of children of this container. |
Item[Int32]
Gets or sets the MarkupData at the specified index.
Declaration
public MarkupData this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The index. |
Property Value
| Type | Description |
|---|---|
| MarkupData | The MarkupData. |
Methods
Add(MarkupData)
Adds a new MarkupData to the container.
Declaration
public MarkupDataContainer Add(MarkupData markupData)
Parameters
| Type | Name | Description |
|---|---|---|
| MarkupData | markupData | The item to be added. |
Returns
| Type | Description |
|---|---|
| MarkupDataContainer | The container after the change. |
Add(IEnumerable<MarkupData>)
Adds a new MarkupData to the container.
Declaration
public MarkupDataContainer Add(IEnumerable<MarkupData> range)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<MarkupData> | range | The range of MarkupData items to be added. |
Returns
| Type | Description |
|---|---|
| MarkupDataContainer | The container after the change. |
Clear()
Removes all the items from this container. Sets the previous children Parent property to null.
Declaration
public void Clear()
GetAllChildren(Func<MarkupData, Boolean>)
Finds all the MarkupData items in the subtree which satisfy a specific condition, in depth-first order.
Declaration
public IEnumerable<MarkupData> GetAllChildren(Func<MarkupData, bool> condition)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<MarkupData, Boolean> | condition |
Returns
| Type | Description |
|---|---|
| IEnumerable<MarkupData> |
GetAllChildren<T>(Func<T, Boolean>)
Finds all the MarkupData items in the subtree which satisfy a specific condition, in depth-first order.
Declaration
public IEnumerable<T> GetAllChildren<T>(Func<T, bool> condition)
where T : MarkupData
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, Boolean> | condition |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
GetEnumerator()
Gets an System.Collections.Generic.IEnumerator<T> for the container's children.
Declaration
public IEnumerator<MarkupData> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<MarkupData> | An System.Collections.Generic.IEnumerator<T> instance enumerating the container's children. |
IndexOf(MarkupData)
Gets the index of a given item.
Declaration
public int IndexOf(MarkupData markupData)
Parameters
| Type | Name | Description |
|---|---|---|
| MarkupData | markupData | Item to retrieve index for. |
Returns
| Type | Description |
|---|---|
| Int32 | Index of the given item in the collection. -1 if not found. |
Insert(Int32, MarkupData)
Inserts a new MarkupData into the container.
Declaration
public MarkupDataContainer Insert(int index, MarkupData markupData)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The position where the item should be inserted. |
| MarkupData | markupData | The item to be inserted. |
Returns
| Type | Description |
|---|---|
| MarkupDataContainer | The container after the change. |
MoveToContainer(MarkupDataContainer, Int32, Int32, Int32)
Moves the children of this container to another MarkupDataContainer instance.
Declaration
public void MoveToContainer(MarkupDataContainer target, int sourceIndex, int targetIndex, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| MarkupDataContainer | target | The target MarkupDataContainer. |
| Int32 | sourceIndex | Index in the source container, from where to start moving elements. |
| Int32 | targetIndex | Index in the target container, where the elements should be inserted. |
| Int32 | count | Number of elements to be moved. |
Remove(MarkupData)
Removes a MarkupData item from the container.
Declaration
public MarkupDataContainer Remove(MarkupData markupData)
Parameters
| Type | Name | Description |
|---|---|---|
| MarkupData | markupData | The item to be removed. |
Returns
| Type | Description |
|---|---|
| MarkupDataContainer | The container after the changes. |
ToString()
Converts to string.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | A System.String that represents this instance. |