Struct LinksGroup<TLinkAddress>
Represents a group of links with hierarchical structure, where each group contains a primary link and optional nested groups. This structure supports the indentation-based syntax of the Lino protocol.
Implements
Inherited Members
Namespace: Platform.Protocols.Lino
Assembly: Platform.Protocols.Lino.dll
Syntax
public struct LinksGroup<TLinkAddress> : IEquatable<LinksGroup<TLinkAddress>>
Type Parameters
Name | Description |
---|---|
TLinkAddress | The type used for link addresses/identifiers. This can be any type that uniquely identifies a link, such as string, int, or Guid. |
Constructors
| Edit this page View SourceLinksGroup(Link<TLinkAddress>)
Initializes a new links group with the specified link and no nested groups.
Declaration
public LinksGroup(Link<TLinkAddress> link)
Parameters
Type | Name | Description |
---|---|---|
Link<TLinkAddress> | link | The primary link of this group. |
LinksGroup(Link<TLinkAddress>, IList<LinksGroup<TLinkAddress>>?)
Initializes a new links group with the specified link and nested groups.
Declaration
public LinksGroup(Link<TLinkAddress> link, IList<LinksGroup<TLinkAddress>>? groups)
Parameters
Type | Name | Description |
---|---|---|
Link<TLinkAddress> | link | The primary link of this group. |
IList<LinksGroup<TLinkAddress>> | groups | The nested groups within this group. |
Properties
| Edit this page View SourceGroups
Gets or sets the collection of nested groups within this group. Can be null if no nested groups exist.
Declaration
public IList<LinksGroup<TLinkAddress>>? Groups { readonly get; set; }
Property Value
Type | Description |
---|---|
IList<LinksGroup<TLinkAddress>> |
Link
Gets or sets the primary link of this group.
Declaration
public Link<TLinkAddress> Link { readonly get; set; }
Property Value
Type | Description |
---|---|
Link<TLinkAddress> |
Methods
| Edit this page View SourceAppendToLinksList(List<Link<TLinkAddress>>)
Appends this links group to the specified list as flattened links.
Declaration
public void AppendToLinksList(List<Link<TLinkAddress>> list)
Parameters
Type | Name | Description |
---|---|---|
List<Link<TLinkAddress>> | list | The list to append the links to. |
AppendToLinksList(List<Link<TLinkAddress>>, Link<TLinkAddress>, LinksGroup<TLinkAddress>)
Recursively appends a links group to a list, combining dependencies with nested groups to create a flattened structure.
Declaration
public static void AppendToLinksList(List<Link<TLinkAddress>> list, Link<TLinkAddress> dependency, LinksGroup<TLinkAddress> group)
Parameters
Type | Name | Description |
---|---|---|
List<Link<TLinkAddress>> | list | The list to append the links to. |
Link<TLinkAddress> | dependency | The dependency link to combine with nested groups. |
LinksGroup<TLinkAddress> | group | The links group to process. |
Equals(LinksGroup<TLinkAddress>)
Indicates whether the current links group is equal to another links group.
Declaration
public bool Equals(LinksGroup<TLinkAddress> other)
Parameters
Type | Name | Description |
---|---|---|
LinksGroup<TLinkAddress> | other | The links group to compare with this links group. |
Returns
Type | Description |
---|---|
bool | True if the current links group is equal to the other parameter; otherwise, false. |
Equals(object?)
Determines whether the specified object is equal to this links group.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with this links group. |
Returns
Type | Description |
---|---|
bool | True if the specified object is equal to this links group; otherwise, false. |
Overrides
| Edit this page View SourceGetHashCode()
Returns the hash code for this links group.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this links group. |
Overrides
| Edit this page View SourceToLinksList()
Converts this links group to a flat list of links, preserving the hierarchical relationships.
Declaration
public List<Link<TLinkAddress>> ToLinksList()
Returns
Type | Description |
---|---|
List<Link<TLinkAddress>> | A list of links representing the flattened structure of this group. |
Operators
| Edit this page View Sourceoperator ==(LinksGroup<TLinkAddress>, LinksGroup<TLinkAddress>)
Determines whether two links group instances are equal.
Declaration
public static bool operator ==(LinksGroup<TLinkAddress> left, LinksGroup<TLinkAddress> right)
Parameters
Type | Name | Description |
---|---|---|
LinksGroup<TLinkAddress> | left | The first links group to compare. |
LinksGroup<TLinkAddress> | right | The second links group to compare. |
Returns
Type | Description |
---|---|
bool | True if the links groups are equal; otherwise, false. |
implicit operator List<Link<TLinkAddress>>(LinksGroup<TLinkAddress>)
Implicitly converts a links group to a list of links by flattening the hierarchical structure.
Declaration
public static implicit operator List<Link<TLinkAddress>>(LinksGroup<TLinkAddress> value)
Parameters
Type | Name | Description |
---|---|---|
LinksGroup<TLinkAddress> | value | The links group to convert. |
Returns
Type | Description |
---|---|
List<Link<TLinkAddress>> |
operator !=(LinksGroup<TLinkAddress>, LinksGroup<TLinkAddress>)
Determines whether two links group instances are not equal.
Declaration
public static bool operator !=(LinksGroup<TLinkAddress> left, LinksGroup<TLinkAddress> right)
Parameters
Type | Name | Description |
---|---|---|
LinksGroup<TLinkAddress> | left | The first links group to compare. |
LinksGroup<TLinkAddress> | right | The second links group to compare. |
Returns
Type | Description |
---|---|
bool | True if the links groups are not equal; otherwise, false. |