From 2bcc21d5c2d27e578f59f905f6acd0979b78aa9d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Jun 2020 12:23:42 -0700 Subject: Rename Symbol more correctly as TupleWithSection --- src/WixToolset.Data/Symbol.cs | 90 --------------------------------- src/WixToolset.Data/TupleWithSection.cs | 90 +++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 src/WixToolset.Data/Symbol.cs create mode 100644 src/WixToolset.Data/TupleWithSection.cs (limited to 'src') diff --git a/src/WixToolset.Data/Symbol.cs b/src/WixToolset.Data/Symbol.cs deleted file mode 100644 index 8bcdd4f0..00000000 --- a/src/WixToolset.Data/Symbol.cs +++ /dev/null @@ -1,90 +0,0 @@ -// 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. - -namespace WixToolset.Data -{ - using System; - using System.Collections.Generic; - using System.Linq; - - /// - /// Symbol representing a single row in a database. - /// - public sealed class Symbol - { - private HashSet possibleConflictSymbols; - private HashSet redundantSymbols; - - /// - /// Creates a symbol for a row. - /// - /// Row for the symbol - public Symbol(IntermediateSection section, IntermediateTuple tuple) - { - this.Row = tuple; - this.Section = section; - this.Name = String.Concat(this.Row.Definition.Name, ":", this.Row.Id.Id); - } - - /// - /// Gets the accessibility of the symbol which is a direct reflection of the accessibility of the row's accessibility. - /// - /// Accessbility of the symbol. - public AccessModifier Access => this.Row.Id.Access; - - /// - /// Gets the name of the symbol. - /// - /// Name of the symbol. - public string Name { get; } - - /// - /// Gets the row for this symbol. - /// - /// Row for this symbol. - public IntermediateTuple Row { get; } - - /// - /// Gets the section for the symbol. - /// - /// Section for the symbol. - public IntermediateSection Section { get; } - - /// - /// Gets any duplicates of this symbol that are possible conflicts. - /// - public IEnumerable PossiblyConflictingSymbols { get { return this.possibleConflictSymbols ?? Enumerable.Empty(); } } - - /// - /// Gets any duplicates of this symbol that are redundant. - /// - public IEnumerable RedundantSymbols { get { return this.redundantSymbols ?? Enumerable.Empty(); } } - - /// - /// Adds a duplicate symbol that is a possible conflict. - /// - /// Symbol that is a possible conflict of this symbol. - public void AddPossibleConflict(Symbol symbol) - { - if (null == this.possibleConflictSymbols) - { - this.possibleConflictSymbols = new HashSet(); - } - - this.possibleConflictSymbols.Add(symbol); - } - - /// - /// Adds a duplicate symbol that is redundant. - /// - /// Symbol that is redundant of this symbol. - public void AddRedundant(Symbol symbol) - { - if (null == this.redundantSymbols) - { - this.redundantSymbols = new HashSet(); - } - - this.redundantSymbols.Add(symbol); - } - } -} diff --git a/src/WixToolset.Data/TupleWithSection.cs b/src/WixToolset.Data/TupleWithSection.cs new file mode 100644 index 00000000..a8b88814 --- /dev/null +++ b/src/WixToolset.Data/TupleWithSection.cs @@ -0,0 +1,90 @@ +// 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. + +namespace WixToolset.Data +{ + using System; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tuple with section representing a single unique tuple. + /// + public sealed class TupleWithSection + { + private HashSet possibleConflicts; + private HashSet redundants; + + /// + /// Creates a symbol for a tuple. + /// + /// Tuple for the symbol + public TupleWithSection(IntermediateSection section, IntermediateTuple tuple) + { + this.Tuple = tuple; + this.Section = section; + this.Name = String.Concat(this.Tuple.Definition.Name, ":", this.Tuple.Id.Id); + } + + /// + /// Gets the accessibility of the symbol which is a direct reflection of the accessibility of the row's accessibility. + /// + /// Accessbility of the symbol. + public AccessModifier Access => this.Tuple.Id.Access; + + /// + /// Gets the name of the symbol. + /// + /// Name of the symbol. + public string Name { get; } + + /// + /// Gets the tuple for this symbol. + /// + /// Tuple for this symbol. + public IntermediateTuple Tuple { get; } + + /// + /// Gets the section for the symbol. + /// + /// Section for the symbol. + public IntermediateSection Section { get; } + + /// + /// Gets any duplicates of this tuple with sections that are possible conflicts. + /// + public IEnumerable PossiblyConflicts => this.possibleConflicts ?? Enumerable.Empty(); + + /// + /// Gets any duplicates of this tuple with sections that are redundant. + /// + public IEnumerable Redundants => this.redundants ?? Enumerable.Empty(); + + /// + /// Adds a duplicate tuple with sections that is a possible conflict. + /// + /// Tuple with section that is a possible conflict of this symbol. + public void AddPossibleConflict(TupleWithSection tupleWithSection) + { + if (null == this.possibleConflicts) + { + this.possibleConflicts = new HashSet(); + } + + this.possibleConflicts.Add(tupleWithSection); + } + + /// + /// Adds a duplicate tuple that is redundant. + /// + /// Tuple with section that is redundant of this tuple. + public void AddRedundant(TupleWithSection tupleWithSection) + { + if (null == this.redundants) + { + this.redundants = new HashSet(); + } + + this.redundants.Add(tupleWithSection); + } + } +} -- cgit v1.2.3-55-g6feb