Table of Contents

Class SetPattern<T>

Namespace
CilFi.Patterns
Assembly
CilFi.Core.dll

Defines the pattern that matches on (sub)-sets of elements.

public record SetPattern<T> : Pattern<IList<T>>, IEquatable<Pattern>, IEquatable<Pattern<IList<T>>>, IEquatable<SetPattern<T>> where T : notnull

Type Parameters

T
Inheritance
SetPattern<T>
Implements
Inherited Members

Constructors

SetPattern(SetPatternAttributes, ImmutableArray<Pattern<T>>)

Defines the pattern that matches on (sub)-sets of elements.

public SetPattern(SetPatternAttributes Attributes, ImmutableArray<Pattern<T>> Elements)

Parameters

Attributes SetPatternAttributes

The set matching rules.

Elements ImmutableArray<Pattern<T>>

The elements that should appear in the set.

SetPattern(SetPattern<T>)

protected SetPattern(SetPattern<T> original)

Parameters

original SetPattern<T>

Properties

Attributes

The set matching rules.

public SetPatternAttributes Attributes { get; init; }

Property Value

SetPatternAttributes

Elements

The elements that should appear in the set.

public ImmutableArray<Pattern<T>> Elements { get; init; }

Property Value

ImmutableArray<Pattern<T>>

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

FixedOrder

Gets a value indicating the elements should be matched in a specific order.

public bool FixedOrder { get; }

Property Value

bool

FullSet

Gets a value indicating the full set should be matched.

public bool FullSet { get; }

Property Value

bool

Methods

Deconstruct(out SetPatternAttributes, out ImmutableArray<Pattern<T>>)

public void Deconstruct(out SetPatternAttributes Attributes, out ImmutableArray<Pattern<T>> Elements)

Parameters

Attributes SetPatternAttributes
Elements ImmutableArray<Pattern<T>>

Equals(Pattern<IList<T>>?)

public override sealed bool Equals(Pattern<IList<T>>? other)

Parameters

other Pattern<IList<T>>

Returns

bool

Equals(SetPattern<T>?)

public virtual bool Equals(SetPattern<T>? other)

Parameters

other SetPattern<T>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Format(IndentedTextWriter)

Serializes the pattern to a readable string.

public override void Format(IndentedTextWriter writer)

Parameters

writer IndentedTextWriter

The output stream.

GetHashCode()

public override int GetHashCode()

Returns

int

Match(IList<T>, MatchingContext)

Attempts to match the provided input to the pattern.

public override IMatchNode<IList<T>>? Match(IList<T> input, MatchingContext context)

Parameters

input IList<T>

The input to match.

context MatchingContext

The context in which to match the pattern to.

Returns

IMatchNode<IList<T>>

When successful, returns the root node of the match tree, otherwise null.

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

Operators

operator ==(SetPattern<T>?, SetPattern<T>?)

public static bool operator ==(SetPattern<T>? left, SetPattern<T>? right)

Parameters

left SetPattern<T>
right SetPattern<T>

Returns

bool

operator !=(SetPattern<T>?, SetPattern<T>?)

public static bool operator !=(SetPattern<T>? left, SetPattern<T>? right)

Parameters

left SetPattern<T>
right SetPattern<T>

Returns

bool