Class LinksRestriction<T>
The parts of a link a LinksOperation<T>.Count or LinksOperation<T>.Each asks for; a null part matches any value.
public sealed record LinksRestriction<T> : IEquatable<LinksRestriction<T>> where T : struct, IBinaryInteger<T>, IUnsignedNumber<T>, IMinMaxValue<T>
Type Parameters
T
- Inheritance
-
LinksRestriction<T>
- Implements
- Inherited Members
Remarks
Matched like the raw links interface matches a query: no parts match every link, (index) one link,
(index value) links of that index whose source or target is value, and
(index source target) matches part by part. Every link is matched at most once, so a link that
uses value as both source and target is counted once, where UnitedMemoryLinks counts its
two usages.
Constructors
LinksRestriction(IReadOnlyList<T?>)
The parts of a link a LinksOperation<T>.Count or LinksOperation<T>.Each asks for; a null part matches any value.
public LinksRestriction(IReadOnlyList<T?> Parts)
Parameters
PartsIReadOnlyList<T?>
Remarks
Matched like the raw links interface matches a query: no parts match every link, (index) one link,
(index value) links of that index whose source or target is value, and
(index source target) matches part by part. Every link is matched at most once, so a link that
uses value as both source and target is counted once, where UnitedMemoryLinks counts its
two usages.
Fields
AnyPart
The wire spelling of a part that matches any value.
public const string AnyPart = "*"
Field Value
Properties
All
Matches every link.
public static LinksRestriction<T> All { get; }
Property Value
Parts
public IReadOnlyList<T?> Parts { get; init; }
Property Value
- IReadOnlyList<T?>
Methods
Equals(LinksRestriction<T>?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(LinksRestriction<T>? other)
Parameters
otherLinksRestriction<T>An object to compare with this object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Matches(Link<T>)
Whether link matches this restriction.
public bool Matches(Link<T> link)
Parameters
linkLink<T>
Returns
Of(params T?[])
A restriction of the given parts.
public static LinksRestriction<T> Of(params T?[] parts)
Parameters
partsT?[]
Returns
ToString()
The restriction as it is sent: (index source target) with * for any part.
public override string ToString()