Class ValueChange<T>
Records a value change in a diff as recorded by a DiffAwareGridView<T>.
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class ValueChange<T> : ValueType, IEquatable<ValueChange<T>>, IMatchable<ValueChange<T>> where T : struct, ValueType
Type Parameters
| Name | Description |
|---|---|
| T | Type of value being changed. |
Constructors
ValueChange(Point, T, T)
Creates a new value change record.
Declaration
public ValueChange(Point position, T oldValue, T newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | position | Position whose value was changed. |
| T | oldValue | Original value that was changed. |
| T | newValue | New value that was set. |
Fields
NewValue
New value that was set.
Declaration
public readonly T NewValue
Field Value
| Type | Description |
|---|---|
| T |
OldValue
Original value that was changed.
Declaration
public readonly T OldValue
Field Value
| Type | Description |
|---|---|
| T |
Position
Position whose value was changed.
Declaration
public readonly Point Position
Field Value
| Type | Description |
|---|---|
| Point |
Methods
Equals(ValueChange<T>)
Compares the two changes according to their positions and values.
Declaration
public bool Equals(ValueChange<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueChange<T> | other |
Returns
| Type | Description |
|---|---|
| Boolean | True if the two value changes represent the same change, false otherwise. |
Equals(Object)
Compares the two changes according to their types, positions and values.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj |
Returns
| Type | Description |
|---|---|
| Boolean | True if the two value changes represent the same object and change, false otherwise. |
GetHashCode()
Returns a hash value computed using the item's position, old value, and new value.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 |
Matches(ValueChange<T>)
Compares the two changes according to their positions and values.
Declaration
public bool Matches(ValueChange<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueChange<T> | other |
Returns
| Type | Description |
|---|---|
| Boolean | True if the two value changes represent the same change, false otherwise. |
ToString()
Returns a string representing the object, including its position, old value, and new value.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Operators
Equality(ValueChange<T>, ValueChange<T>)
Tests the two changes by their fields for equality.
Declaration
public static bool operator ==(ValueChange<T> left, ValueChange<T> right)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueChange<T> | left | |
| ValueChange<T> | right |
Returns
| Type | Description |
|---|---|
| Boolean | True if all the changes are equivalent; false otherwise. |
Inequality(ValueChange<T>, ValueChange<T>)
Tests the two changes by their fields for inequality.
Declaration
public static bool operator !=(ValueChange<T> left, ValueChange<T> right)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueChange<T> | left | |
| ValueChange<T> | right |
Returns
| Type | Description |
|---|---|
| Boolean | True if all the changes are equivalent; false otherwise. |