Class ChangeSet
Represents a collection of state changes introduced by a mutation. This is a primary feature of a mutation and not an optional addition.
Inherited Members
Namespace: ModularityKit.Mutator.Abstractions.Changes
Assembly: ModularityKit.Mutator.dll
Syntax
public sealed class ChangeSet
Properties
| Edit this page View SourceChanges
Gets the list of all recorded state changes.
Declaration
public IReadOnlyList<StateChange> Changes { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<StateChange> |
Checksum
Optional checksum of the changeset for integrity verification.
Declaration
public string? Checksum { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
Count
Gets the total number of changes in the set.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Empty
Returns an empty changeset.
Declaration
public static ChangeSet Empty { get; }
Property Value
| Type | Description |
|---|---|
| ChangeSet |
HasChanges
Indicates whether there are any recorded changes.
Declaration
public bool HasChanges { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Timestamp
Timestamp of the changeset creation.
Declaration
public DateTimeOffset Timestamp { get; init; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset |
Methods
| Edit this page View SourceAdd(StateChange)
Adds a new state change to the changeset.
Declaration
public void Add(StateChange change)
Parameters
| Type | Name | Description |
|---|---|---|
| StateChange | change | The state change to add. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
FromChanges(params StateChange[])
Creates changeset from multiple state changes.
Declaration
public static ChangeSet FromChanges(params StateChange[] changes)
Parameters
| Type | Name | Description |
|---|---|---|
| StateChange[] | changes | Array of state changes to include. |
Returns
| Type | Description |
|---|---|
| ChangeSet | A ChangeSet containing all provided changes. |
GetChangedPaths()
Retrieves all unique paths that have undergone changes.
Declaration
public IEnumerable<string> GetChangedPaths()
Returns
| Type | Description |
|---|---|
| IEnumerable<string> | Enumerable of unique changed paths. |
GetChanges(string)
Retrieves all changes corresponding to a specific path.
Declaration
public IEnumerable<StateChange> GetChanges(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The path to filter changes. |
Returns
| Type | Description |
|---|---|
| IEnumerable<StateChange> | Enumerable of StateChange matching the path. |
IsChanged(string)
Determines whether a specific path has been changed.
Declaration
public bool IsChanged(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The path to check. |
Returns
| Type | Description |
|---|---|
| bool | True if the path has been changed; otherwise, false. |
Single(StateChange)
Creates changeset containing single state change.
Declaration
public static ChangeSet Single(StateChange change)
Parameters
| Type | Name | Description |
|---|---|---|
| StateChange | change | The state change to include. |
Returns
| Type | Description |
|---|---|
| ChangeSet | A ChangeSet containing the single change. |