@joebigelow / wix-1 / commits / 2bcc21d5

Rename Symbol more correctly as TupleWithSection

Rob Mensching committed Jun 24, 2020 at 12:23 UTC 2bcc21d5c2d27e578f59f905f6acd0979b78aa9d
2 files changed +90 -90
src/WixToolset.Data/Symbol.cs deleted
-90
@@ -1,90 +0,0 @@
1 -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 -
3 -namespace WixToolset.Data
4 -{
5 - using System;
6 - using System.Collections.Generic;
7 - using System.Linq;
8 -
9 - /// <summary>
10 - /// Symbol representing a single row in a database.
11 - /// </summary>
12 - public sealed class Symbol
13 - {
14 - private HashSet<Symbol> possibleConflictSymbols;
15 - private HashSet<Symbol> redundantSymbols;
16 -
17 - /// <summary>
18 - /// Creates a symbol for a row.
19 - /// </summary>
20 - /// <param name="row">Row for the symbol</param>
21 - public Symbol(IntermediateSection section, IntermediateTuple tuple)
22 - {
23 - this.Row = tuple;
24 - this.Section = section;
25 - this.Name = String.Concat(this.Row.Definition.Name, ":", this.Row.Id.Id);
26 - }
27 -
28 - /// <summary>
29 - /// Gets the accessibility of the symbol which is a direct reflection of the accessibility of the row's accessibility.
30 - /// </summary>
31 - /// <value>Accessbility of the symbol.</value>
32 - public AccessModifier Access => this.Row.Id.Access;
33 -
34 - /// <summary>
35 - /// Gets the name of the symbol.
36 - /// </summary>
37 - /// <value>Name of the symbol.</value>
38 - public string Name { get; }
39 -
40 - /// <summary>
41 - /// Gets the row for this symbol.
42 - /// </summary>
43 - /// <value>Row for this symbol.</value>
44 - public IntermediateTuple Row { get; }
45 -
46 - /// <summary>
47 - /// Gets the section for the symbol.
48 - /// </summary>
49 - /// <value>Section for the symbol.</value>
50 - public IntermediateSection Section { get; }
51 -
52 - /// <summary>
53 - /// Gets any duplicates of this symbol that are possible conflicts.
54 - /// </summary>
55 - public IEnumerable<Symbol> PossiblyConflictingSymbols { get { return this.possibleConflictSymbols ?? Enumerable.Empty<Symbol>(); } }
56 -
57 - /// <summary>
58 - /// Gets any duplicates of this symbol that are redundant.
59 - /// </summary>
60 - public IEnumerable<Symbol> RedundantSymbols { get { return this.redundantSymbols ?? Enumerable.Empty<Symbol>(); } }
61 -
62 - /// <summary>
63 - /// Adds a duplicate symbol that is a possible conflict.
64 - /// </summary>
65 - /// <param name="symbol">Symbol that is a possible conflict of this symbol.</param>
66 - public void AddPossibleConflict(Symbol symbol)
67 - {
68 - if (null == this.possibleConflictSymbols)
69 - {
70 - this.possibleConflictSymbols = new HashSet<Symbol>();
71 - }
72 -
73 - this.possibleConflictSymbols.Add(symbol);
74 - }
75 -
76 - /// <summary>
77 - /// Adds a duplicate symbol that is redundant.
78 - /// </summary>
79 - /// <param name="symbol">Symbol that is redundant of this symbol.</param>
80 - public void AddRedundant(Symbol symbol)
81 - {
82 - if (null == this.redundantSymbols)
83 - {
84 - this.redundantSymbols = new HashSet<Symbol>();
85 - }
86 -
87 - this.redundantSymbols.Add(symbol);
88 - }
89 - }
90 -}
src/WixToolset.Data/TupleWithSection.cs new
+90
@@ -0,0 +1,90 @@
1 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 +
3 +namespace WixToolset.Data
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using System.Linq;
8 +
9 + /// <summary>
10 + /// Tuple with section representing a single unique tuple.
11 + /// </summary>
12 + public sealed class TupleWithSection
13 + {
14 + private HashSet<TupleWithSection> possibleConflicts;
15 + private HashSet<TupleWithSection> redundants;
16 +
17 + /// <summary>
18 + /// Creates a symbol for a tuple.
19 + /// </summary>
20 + /// <param name="tuple">Tuple for the symbol</param>
21 + public TupleWithSection(IntermediateSection section, IntermediateTuple tuple)
22 + {
23 + this.Tuple = tuple;
24 + this.Section = section;
25 + this.Name = String.Concat(this.Tuple.Definition.Name, ":", this.Tuple.Id.Id);
26 + }
27 +
28 + /// <summary>
29 + /// Gets the accessibility of the symbol which is a direct reflection of the accessibility of the row's accessibility.
30 + /// </summary>
31 + /// <value>Accessbility of the symbol.</value>
32 + public AccessModifier Access => this.Tuple.Id.Access;
33 +
34 + /// <summary>
35 + /// Gets the name of the symbol.
36 + /// </summary>
37 + /// <value>Name of the symbol.</value>
38 + public string Name { get; }
39 +
40 + /// <summary>
41 + /// Gets the tuple for this symbol.
42 + /// </summary>
43 + /// <value>Tuple for this symbol.</value>
44 + public IntermediateTuple Tuple { get; }
45 +
46 + /// <summary>
47 + /// Gets the section for the symbol.
48 + /// </summary>
49 + /// <value>Section for the symbol.</value>
50 + public IntermediateSection Section { get; }
51 +
52 + /// <summary>
53 + /// Gets any duplicates of this tuple with sections that are possible conflicts.
54 + /// </summary>
55 + public IEnumerable<TupleWithSection> PossiblyConflicts => this.possibleConflicts ?? Enumerable.Empty<TupleWithSection>();
56 +
57 + /// <summary>
58 + /// Gets any duplicates of this tuple with sections that are redundant.
59 + /// </summary>
60 + public IEnumerable<TupleWithSection> Redundants => this.redundants ?? Enumerable.Empty<TupleWithSection>();
61 +
62 + /// <summary>
63 + /// Adds a duplicate tuple with sections that is a possible conflict.
64 + /// </summary>
65 + /// <param name="tupleWithSection">Tuple with section that is a possible conflict of this symbol.</param>
66 + public void AddPossibleConflict(TupleWithSection tupleWithSection)
67 + {
68 + if (null == this.possibleConflicts)
69 + {
70 + this.possibleConflicts = new HashSet<TupleWithSection>();
71 + }
72 +
73 + this.possibleConflicts.Add(tupleWithSection);
74 + }
75 +
76 + /// <summary>
77 + /// Adds a duplicate tuple that is redundant.
78 + /// </summary>
79 + /// <param name="tupleWithSection">Tuple with section that is redundant of this tuple.</param>
80 + public void AddRedundant(TupleWithSection tupleWithSection)
81 + {
82 + if (null == this.redundants)
83 + {
84 + this.redundants = new HashSet<TupleWithSection>();
85 + }
86 +
87 + this.redundants.Add(tupleWithSection);
88 + }
89 + }
90 +}