Show / Hide Table of Contents

Class CoordinateTracker

Efficiently tracks a set of Coordinates.

Inheritance
object
CoordinateTracker
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SudokuSpice
Assembly: SudokuSpice.dll
Syntax
[SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional")]
public class CoordinateTracker
Remarks

This swaps coordinates within an internal array to provide O(1) tracking and untracking operations. It also provides immediate, copy-free access to tracked coordinates using a ReadOnlySpan.

Constructors

| Edit this page View Source

CoordinateTracker(CoordinateTracker)

Copy-constructor to provide a copy of the given CoordinateTracker.

Declaration
public CoordinateTracker(CoordinateTracker existing)
Parameters
Type Name Description
CoordinateTracker existing
| Edit this page View Source

CoordinateTracker(int)

Constructs a CoordinateTracker to track coordinates within a size-by-size square.

Declaration
public CoordinateTracker(int size)
Parameters
Type Name Description
int size

The side length of a square of valid coordinates.

Properties

| Edit this page View Source

NumTracked

The number of coordinates currently considered to be 'tracked'.

Declaration
public int NumTracked { get; }
Property Value
Type Description
int
| Edit this page View Source

Size

Declaration
public int Size { get; }
Property Value
Type Description
int
| Edit this page View Source

TrackedCoords

Provides readonly access to the currently tracked Coordinates.

Declaration
public ReadOnlySpan<Coordinate> TrackedCoords { get; }
Property Value
Type Description
ReadOnlySpan<Coordinate>

Methods

| Edit this page View Source

Add(in Coordinate)

Adds and tracks a previously unknown Coordinate. This must only be called once for any given Coordinate.

Declaration
public void Add(in Coordinate c)
Parameters
Type Name Description
Coordinate c

The Coordinate to add.

| Edit this page View Source

AddOrTrackIfUntracked(in Coordinate)

Ensures a given Coordinate is both added and tracked. Useful when callers are not certain of the status of the given Coordinate.

Declaration
public CoordinateTracker.AddOrTrackResult AddOrTrackIfUntracked(in Coordinate c)
Parameters
Type Name Description
Coordinate c

The Coordinate to track.

Returns
Type Description
CoordinateTracker.AddOrTrackResult

The action that was taken.

| Edit this page View Source

Track(in Coordinate)

Tracks a currently untracked Coordinate. The coordinate must not be tracked already.

Declaration
public void Track(in Coordinate c)
Parameters
Type Name Description
Coordinate c

The Coordinate to track.

| Edit this page View Source

Untrack(in Coordinate)

Untracks a given Coordinate. The Coordinate must be currently tracked.

Declaration
public void Untrack(in Coordinate c)
Parameters
Type Name Description
Coordinate c

The Coordinate to untrack.

| Edit this page View Source

UntrackAll()

Untracks all Coordinates.

Declaration
public void UntrackAll()
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX