Table of Contents

AhoCorasickMatch<TValue> Struct

Definition

Namespace
Bodu.Collections.Generic.Trees
Assembly
Bodu.Collections.dll
Package
Bodu.Collections 1.0.0
Source
AhoCorasickMatch{T}.cs

Represents a single pattern occurrence reported by EnumerateMatches(string), carrying the value associated with the matched pattern.

public readonly struct AhoCorasickMatch<TValue> : IEquatable<AhoCorasickMatch<TValue>>

Type Parameters

TValue

The type of the value associated with each pattern.

Implements
Inherited Members
Extension Methods

Remarks

Matches are value-equatable: two matches are equal when they report the same pattern, start index, and value.

Constructors

AhoCorasickMatch(string, int, TValue)

Represents a single pattern occurrence reported by EnumerateMatches(string), carrying the value associated with the matched pattern.

public AhoCorasickMatch(string Pattern, int Start, TValue Value)

Parameters

Pattern string

The pattern that matched.

Start int

The zero-based index in the text at which the occurrence begins.

Value TValue

The value associated with the matched pattern.

Remarks

Matches are value-equatable: two matches are equal when they report the same pattern, start index, and value.

Properties

End

Gets the exclusive zero-based end index of the occurrence.

public int End { get; }

Property Value

int

The index immediately after the last matched character, equal to Start plus the pattern length.

Pattern

The pattern that matched.

public string Pattern { get; init; }

Property Value

string

Start

The zero-based index in the text at which the occurrence begins.

public int Start { get; init; }

Property Value

int

Value

The value associated with the matched pattern.

public TValue Value { get; init; }

Property Value

TValue

Methods

Deconstruct(out string, out int, out TValue)

public void Deconstruct(out string Pattern, out int Start, out TValue Value)

Parameters

Pattern string
Start int
Value TValue

Equals(AhoCorasickMatch<TValue>)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(AhoCorasickMatch<TValue> other)

Parameters

other AhoCorasickMatch<TValue>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(AhoCorasickMatch<TValue>, AhoCorasickMatch<TValue>)

public static bool operator ==(AhoCorasickMatch<TValue> left, AhoCorasickMatch<TValue> right)

Parameters

left AhoCorasickMatch<TValue>
right AhoCorasickMatch<TValue>

Returns

bool

operator !=(AhoCorasickMatch<TValue>, AhoCorasickMatch<TValue>)

public static bool operator !=(AhoCorasickMatch<TValue> left, AhoCorasickMatch<TValue> right)

Parameters

left AhoCorasickMatch<TValue>
right AhoCorasickMatch<TValue>

Returns

bool

Applies to

ProductVersions
.NET8, 10