Table of Contents

Class SubgroupGenerator

Namespace
MonkeyLoader.Resonite.DataFeeds
Assembly
MonkeyLoader.Resonite.Integration.dll

Represents a helper to generate nested subgroups for subgrouped data feed items.

public sealed class SubgroupGenerator
Inheritance
SubgroupGenerator
Inherited Members

Remarks

The generator uses internal state to track which subgroups have already been created.
As such, it must be recreated for each enumeration of a data feed.

Elements.Core.LocaleString keys for the subgroups are generated by appending the subgroup's path up to that point to the BaseIdentifiable's FullId, all joined by periods (.).

Constructors

SubgroupGenerator(IIdentifiable, IReadOnlyList<string>, IReadOnlyList<string>)

Creates a new instance of this helper to generate nested subgroups for subgrouped data feed items.

public SubgroupGenerator(IIdentifiable baseIdentifiable, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys)

Parameters

baseIdentifiable IIdentifiable

The base identifiable that's used to generate the Elements.Core.LocaleStrings for the subgroups.

path IReadOnlyList<string>

The path of the items being enumerated.

groupKeys IReadOnlyList<string>

The group keys for the outer container that the nested subgroups should be placed in.

Remarks

The generator uses internal state to track which subgroups have already been created.
As such, it must be recreated for each enumeration of a data feed.

Elements.Core.LocaleString keys for the subgroups are generated by appending the subgroup's path up to that point to the BaseIdentifiable's FullId, all joined by periods (.).

Properties

BaseGroupKeys

Gets the group keys for the outer container that the nested subgroups should be placed in.

public IReadOnlyList<string> BaseGroupKeys { get; }

Property Value

IReadOnlyList<string>

BaseIdentifiable

Gets the base identifiable that's used to generate the Elements.Core.LocaleStrings for the subgroups.

public IIdentifiable BaseIdentifiable { get; }

Property Value

IIdentifiable

Remarks

Elements.Core.LocaleString keys for the subgroups are generated by appending the subgroup's path up to that point to the this identifiable's FullId, all joined by periods (.).

Path

Gets path of the items being enumerated.

public IReadOnlyList<string> Path { get; }

Property Value

IReadOnlyList<string>

Methods

EnumerateSubgroupsAsync(Sequence<string>, int)

Enumerates the missing nested subgroups for the given path.

public IAsyncEnumerable<DataFeedItem> EnumerateSubgroupsAsync(Sequence<string> subgroupPath, int priority = 0)

Parameters

subgroupPath Sequence<string>

The path of the required nested subgroups.

priority int

The optional priority to assign to the newly created subgroups. Higher comes first.

Returns

IAsyncEnumerable<DataFeedItem>

A sequence of the missing nested subgroups for the given path. Empty if all subgroups have already been generated.

Remarks

Prefer using any of the GetSubgroupEnumerator overloads, since they also return the required group keys to place items in the final subgroup.

GetSubgroupEnumerator(Sequence<string>, out IReadOnlyList<string>)

Gets an enumerator for the missing nested subgroups for the given path and returns the group keys necessary to place items in the final subgroup.

public IAsyncEnumerable<DataFeedItem> GetSubgroupEnumerator(Sequence<string> subgroupPath, out IReadOnlyList<string> groupKeys)

Parameters

subgroupPath Sequence<string>

The path of the required nested subgroups.

groupKeys IReadOnlyList<string>

The group keys necessary to place items in the final subgroup.

Returns

IAsyncEnumerable<DataFeedItem>

A sequence of the missing nested subgroups for the given path. Empty if all subgroups have already been generated.

GetSubgroupEnumerator(Sequence<string>, int, out IReadOnlyList<string>)

Gets an enumerator for the missing nested subgroups for the given path and returns the group keys necessary to place items in the final subgroup.

public IAsyncEnumerable<DataFeedItem> GetSubgroupEnumerator(Sequence<string> subgroupPath, int priority, out IReadOnlyList<string> groupKeys)

Parameters

subgroupPath Sequence<string>

The path of the required nested subgroups.

priority int

The optional priority to assign to the newly created subgroups. Higher comes first.

groupKeys IReadOnlyList<string>

The group keys necessary to place items in the final subgroup.

Returns

IAsyncEnumerable<DataFeedItem>

A sequence of the missing nested subgroups for the given path. Empty if all subgroups have already been generated.

GetSubgroupEnumerator(ISubgroupedDataFeedItem, out IReadOnlyList<string>)

Gets an enumerator for the missing nested subgroups for the subgrouped data feed item's path and returns the group keys necessary to place items in the final subgroup, using the item's priority too, if available.

public IAsyncEnumerable<DataFeedItem> GetSubgroupEnumerator(ISubgroupedDataFeedItem subgroupedItem, out IReadOnlyList<string> groupKeys)

Parameters

subgroupedItem ISubgroupedDataFeedItem

The subgrouped data feed item containing the path of the required nested subgroups.
If this is also IPrioritizable, that priority will be assigned to the newly generated subgroups; otherwise, zero. Higher comes first.

groupKeys IReadOnlyList<string>

The group keys necessary to place items in the final subgroup.

Returns

IAsyncEnumerable<DataFeedItem>

A sequence of the missing nested subgroups for the given path. Empty if all subgroups have already been generated.

GetSubgroupEnumerator(ISubgroupedDataFeedItem, int, out IReadOnlyList<string>)

Gets an enumerator for the missing nested subgroups for the subgrouped data feed item's path and returns the group keys necessary to place items in the final subgroup.

public IAsyncEnumerable<DataFeedItem> GetSubgroupEnumerator(ISubgroupedDataFeedItem subgroupedItem, int priority, out IReadOnlyList<string> groupKeys)

Parameters

subgroupedItem ISubgroupedDataFeedItem

The subgrouped data feed item containing the path of the required nested subgroups.

priority int

The optional priority to assign to the newly created subgroups. Higher comes first.

groupKeys IReadOnlyList<string>

The group keys necessary to place items in the final subgroup.

Returns

IAsyncEnumerable<DataFeedItem>

A sequence of the missing nested subgroups for the given path. Empty if all subgroups have already been generated.