blob: 009e0282468b6e0668caa292ac5a55868a1388ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System;
using System.Collections.Generic;
namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
{
/// <summary>A collection watcher which never changes.</summary>
/// <typeparam name="TValue">The value type within the collection.</typeparam>
internal class ImmutableCollectionWatcher<TValue> : BaseDisposableWatcher, ICollectionWatcher<TValue>
{
/*********
** Accessors
*********/
/// <summary>A singleton collection watcher instance.</summary>
public static ImmutableCollectionWatcher<TValue> Instance { get; } = new ImmutableCollectionWatcher<TValue>();
/// <summary>Whether the collection changed since the last reset.</summary>
public bool IsChanged { get; } = false;
/// <summary>The values added since the last reset.</summary>
public IEnumerable<TValue> Added { get; } = Array.Empty<TValue>();
/// <summary>The values removed since the last reset.</summary>
public IEnumerable<TValue> Removed { get; } = Array.Empty<TValue>();
/*********
** Public methods
*********/
/// <summary>Update the current value if needed.</summary>
public void Update() { }
/// <summary>Set the current value as the baseline.</summary>
public void Reset() { }
/// <summary>Stop watching the field and release all references.</summary>
public override void Dispose() { }
}
}
|