summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-27 18:09:04 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-27 18:09:04 -0400
commit0209e70695b6d12692d4de554ce1fc9d65ca4715 (patch)
tree011867d845ee3cf2a88f306504a4bdd6fe414ed6 /src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs
parent2ab2182645179129997eac3fccb63f6f0683dbe1 (diff)
parente4cd7c8eb09fa50802ce4eb9dbe4683ce61f7a5d (diff)
downloadSMAPI-0209e70695b6d12692d4de554ce1fc9d65ca4715.tar.gz
SMAPI-0209e70695b6d12692d4de554ce1fc9d65ca4715.tar.bz2
SMAPI-0209e70695b6d12692d4de554ce1fc9d65ca4715.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs')
-rw-r--r--src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs
index 5f76fe0a..e2f6c7fd 100644
--- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs
+++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs
@@ -20,13 +20,16 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/*********
** Accessors
*********/
- /// <summary>The field value at the last reset.</summary>
+ /// <inheritdoc />
+ public string Name { get; }
+
+ /// <inheritdoc />
public TValue PreviousValue { get; private set; }
- /// <summary>The latest value.</summary>
+ /// <inheritdoc />
public TValue CurrentValue { get; private set; }
- /// <summary>Whether the value changed since the last reset.</summary>
+ /// <inheritdoc />
public bool IsChanged { get; private set; }
@@ -34,31 +37,33 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
** Public methods
*********/
/// <summary>Construct an instance.</summary>
+ /// <param name="name">A name which identifies what the watcher is watching, used for troubleshooting.</param>
/// <param name="getValue">Get the current value.</param>
/// <param name="comparer">The equality comparer which indicates whether two values are the same.</param>
- public ComparableWatcher(Func<TValue> getValue, IEqualityComparer<TValue> comparer)
+ public ComparableWatcher(string name, Func<TValue> getValue, IEqualityComparer<TValue> comparer)
{
+ this.Name = name;
this.GetValue = getValue;
this.Comparer = comparer;
this.CurrentValue = getValue();
this.PreviousValue = this.CurrentValue;
}
- /// <summary>Update the current value if needed.</summary>
+ /// <inheritdoc />
public void Update()
{
this.CurrentValue = this.GetValue();
this.IsChanged = !this.Comparer.Equals(this.PreviousValue, this.CurrentValue);
}
- /// <summary>Set the current value as the baseline.</summary>
+ /// <inheritdoc />
public void Reset()
{
this.PreviousValue = this.CurrentValue;
this.IsChanged = false;
}
- /// <summary>Release any references if needed when the field is no longer needed.</summary>
+ /// <inheritdoc />
public void Dispose() { }
}
}