2using System.Collections.Immutable;
15 internal readonly
struct ModuleOpens : IComparable<ModuleOpens>
18 readonly ModuleOpensFlag _modifiers;
19 readonly
string _source;
20 readonly ImmutableHashSet<string> _targets;
28 public ModuleOpens(ModuleOpensFlag modifiers,
string source, ImmutableHashSet<string> targets)
30 _modifiers = modifiers;
31 _source = source ??
throw new ArgumentNullException(nameof(source));
32 _targets = targets ??
throw new ArgumentNullException(nameof(targets));
38 public ModuleOpensFlag Modifiers => _modifiers;
43 public string Source => _source;
49 public ImmutableHashSet<string> Targets => _targets;
52 public int CompareTo(ModuleOpens other)
54 int c = _source.CompareTo(other._source);
59 c = _modifiers.CompareTo(other.Modifiers);
64 var t1 = _targets.ToArray();
65 var t2 = other._targets.ToArray();
72 public override bool Equals(
object? obj)
74 return obj is ModuleOpens other && Equals(other);
78 public bool Equals(ModuleOpens other)
80 return _modifiers == other._modifiers && _source == other._source && _targets.SetEquals(other._targets);
84 public override int GetHashCode()
86 var hc =
new HashCode();
90 foreach (var t
in _targets)
93 return hc.ToHashCode();
Implements an IComparer<T> which lexicographically compares a two lists.
override int Compare(TList? x, TList? y)
static new readonly LexicographicListComparer< T > Default
Returns a default LexicographicListComparer<T> instance.