Coverage

References
public readonly struct Coverage
A coverage specifies items, twigs or even entire trees using two integers. Coverages ignore actual paths, opting instead to identify elements using indices alone.

Properties

Access

#
Gets the scope of coverage.
public Access Access { get; }

ItemIndex

#
Gets the item index.
public int ItemIndex { get; }

TwigIndex

#
Gets the twig index.
public int TwigIndex { get; }

Methods

CreateFromAccess

#
Create the initial coverage implied by an access flag.
public static Coverage CreateFromAccess(
access
)

CreateItemCoverage

#
Create coverage for a specific item.
public static Coverage CreateItemCoverage(
twigIndex,
Index of twig within tree.
itemIndex
Index of item within twig.
)
Coverage.

CreateTreeCoverage

#
Create coverage for an entire tree.
public static Coverage CreateTreeCoverage()
Coverage.

CreateTwigCoverage

#
Create coverage for a specific twig.
public static Coverage CreateTwigCoverage(
twigIndex
Index of twig within tree.
)
Coverage.

IncrementItem

#
Move the coverage to the next item. This method can only be called if the coverage access is Access.Item.
public Coverage IncrementItem()
New coverage.

IncrementTwig

#
Move the coverage to the next twig. This method can only be called if the coverage access is not Access.Tree.
public Coverage IncrementTwig()
New coverage.

IsValidCoverage

#
Test whether a specific coverage validly applies to a tree.
public static bool IsValidCoverage(
coverage,
tree
)

IsValidCoverage

#
Test whether the given coverages correctly identify specific elements of a an array of trees.
public static bool IsValidCoverage(
coverages,
trees
)

Slice

#
Create a new tree based on this coverage of an existing tree.
public ITree Slice(
tree,
Tree to slice.
graftItem
If true, and the Access of this coverage is Access.Item, the item index will be appended to the returned tree.
)

ToString

#
Gets a description of this coverage.
public override string ToString()

TryIncrementItem

#
Try and increment a coverage to the next item index.
public bool TryIncrementItem(
tree,
Tree constraint.
incremented
Incremented or this coverage.
)

TryIncrementItems

#
Try and increment all coverages whose Access is set to Access.Item to the next item index.
public static bool TryIncrementItems(
coverages,
Coverages to increment.
trees,
Tree constraints.
bool[]
modified = null
Optional boolean array for individual coverage modifications. Must be of the same size as the coverages and trees array and should contain only false values.
)
True if at least one coverage in the array was successfully incremented.

TryIncrementTwig

#
Try and increment a coverage to the next twig index.
public bool TryIncrementTwig(
tree,
Tree constraint.
incremented
Incremented or this coverage.
)

TryIncrementTwigs

#
Try and increment all coverages whose Access is set to either Access.Item or Access.Twig to the next twig index.
public static bool TryIncrementTwigs(
coverages,
Coverages to increment.
trees,
Tree constraints.
bool[]
modified = null
Optional boolean array for individual coverage modifications. Must be of the same size as the coverages and trees array and should contain only false values.
)
True if at least one coverage in the array was successfully incremented.