Class Diff<T>
Represents a unique patch/diff of the state of a DiffAwareGridView<T>.
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public class Diff<T> : Object, IEnumerable<ValueChange<T>>, IEnumerable where T : struct, ValueType
Type Parameters
Name | Description |
---|---|
T | Type of value stored in the grid view. |
Constructors
Diff()
Creates a new empty diff.
Declaration
public Diff()
Diff(IEnumerable<ValueChange<T>>)
Creates a diff composed of the specified changes.
Declaration
public Diff(IEnumerable<ValueChange<T>> changes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ValueChange<T>> | changes | Changes to create a diff from. |
Properties
Changes
Read-only list of changes made in this time step.
Declaration
public IReadOnlyList<ValueChange<T>> Changes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ValueChange<T>> |
IsCompressed
Whether or not the diff is currently known to be at the minimal possible size.
Declaration
public bool IsCompressed { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsFinalized
Whether or not the list of changes in this diff has been finalized, eg allows more changes to be added.
Declaration
public bool IsFinalized { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Add(ValueChange<T>)
Adds a change to the diff.
Declaration
public void Add(ValueChange<T> change)
Parameters
Type | Name | Description |
---|---|---|
ValueChange<T> | change | Change to add. |
Compress()
Reduces the diff to the minimum possible changes to achieve the resulting values by removing duplicate positions from the change list.
Declaration
public void Compress()
FinalizeChanges()
Finalizes the current diff, such that no changes are allowed to be added to it. It can still be compressed.
Declaration
public void FinalizeChanges()
GetEnumerator()
Returns an enumerator of the changes in the diff.
Declaration
public IEnumerator<ValueChange<T>> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<ValueChange<T>> |