Class Comparer
Last update: 09.03.2026Namespace: OpenTD.Results.Dataset
Assembly: OpenTD.Results.dll
Use to compare two Datasets.
public class Comparer : IComparerInput, IComparerOutput
Inheritance
Implements
IComparerInput, IComparerOutput
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Comparer(IDataset, IDataset)
Initializes a new instance of the
public Comparer(IDataset a, IDataset b)
Parameters
a IDataset
Dataset A
b IDataset
Dataset B
Properties
CompareConductorNames
Determines whether Run() will compare the ID's of conductors in common thermal submodels.
public bool CompareConductorNames { get; set; }
Property Value
CompareFTieNames
Determines whether Run() will compare the ID's of FTies in common fluid submodels.
public bool CompareFTieNames { get; set; }
Property Value
CompareFluidSubmodels
Determines whether Run() will compare the names of the fluid submodels.
public bool CompareFluidSubmodels { get; set; }
Property Value
CompareIFaceNames
Determines whether Run() will compare the ID's of IFaces in common fluid submodels.
public bool CompareIFaceNames { get; set; }
Property Value
CompareJustFinalRecord
Determines whether Run() will compare just the final data values in each dataset. If true, will also ignore differences in number of records and won't compare times. Defaults to false.
public bool CompareJustFinalRecord { get; set; }
Property Value
CompareLumpNames
Determines whether Run() will compare the ID's of lumps in common fluid submodels.
public bool CompareLumpNames { get; set; }
Property Value
CompareNodeNames
Determines whether Run() will compare the ID's of nodes in common thermal submodels.
public bool CompareNodeNames { get; set; }
Property Value
ComparePathNames
Determines whether Run() will compare the ID's of paths in common fluid submodels.
public bool ComparePathNames { get; set; }
Property Value
CompareRecords
Determines whether Run() will compare the number of records.
public bool CompareRecords { get; set; }
Property Value
CompareRegisterNames
Determines whether Run() will compare the names of registers.
public bool CompareRegisterNames { get; set; }
Property Value
CompareThermalSubmodels
Determines whether Run() will compare the names of the thermal submodels.
public bool CompareThermalSubmodels { get; set; }
Property Value
CompareTieNames
Determines whether Run() will compare the ID's of ties in common fluid submodels.
public bool CompareTieNames { get; set; }
Property Value
CompareTimes
Determines whether Run() will compare the max and min times.
public bool CompareTimes { get; set; }
Property Value
ComparisonMethods
This dispatch table determines what comparison methods will be used for each StandardDataSubtype (T, TL, etc.). All others not listed will use the DefaultComparisonMethod algorithm.
public Dictionary<StandardDataSubtypes, ICompareData> ComparisonMethods { get; set; }
Property Value
Dictionary<StandardDataSubtypes, ICompareData>
See Also
DataSubtype, Comparer.DefaultComparisonMethod, StandardDataSubtypes
DataToCompare
List of FullStandardDataSubtype (T, TL, PL, etc.) to compare for all common-name entities. For example, if TL is in the list, then Run() will find all the lump names that are common between the two Datasets and compare all values of TL for all of them.
public List<FullStandardDataSubtype> DataToCompare { get; set; }
Property Value
See Also
DatasetA
One of the datasets to compare.
public IDataset DatasetA { get; }
Property Value
DatasetB
One of the datasets to compare.
public IDataset DatasetB { get; }
Property Value
DefaultComparisonMethod
For StandardDataSubtypes (T, TL, etc.) not listed in the ComparisonMethods dispatch table, use this comparison algorithm.
public ICompareData DefaultComparisonMethod { get; set; }
Property Value
See Also
DataSubtype, Comparer.ComparisonMethods, StandardDataSubtypes
Exceedances
After calling Run(), contains information about data items that exceeded the allowable percent tolerance. Contains a dictionary with one entry for each FullStandardDataSubtype (T, TL, PL, etc.) tested. The entries are lists of all items that exceed the percent tolerance, in descending order by exceedance amount.
public Dictionary<DataSubtype, List<Exceedance>> Exceedances { get; }
Property Value
Dictionary<DataSubtype, List<Exceedance>>
See Also
FullStandardDataSubtype, Exceedance
Message
Run() outputs a report to this string.
public string Message { get; }
Property Value
RecNumsA
A list of the record numbers in DatasetA.
public List<long> RecNumsA { get; }
Property Value
RecNumsB
A list of the record numbers in DatasetB.
public List<long> RecNumsB { get; }
Property Value
RegisterDataToCompare
List of registers to compare, if common between datasets. If list is empty, will compare data for all common registers.
public List<string> RegisterDataToCompare { get; set; }
Property Value
TimePercentTol
Tolerance for comparison of time series.
public double TimePercentTol { get; set; }
Property Value
TimesA
A list of the times in DatasetA.
public List<double> TimesA { get; }
Property Value
TimesB
A list of the times in DatasetB.
public List<double> TimesB { get; }
Property Value
Methods
CloseDatasets()
public void CloseDatasets()
GetExceedancePlots(int, IEnumerable<DataSubtype>)
public List<ExceedancePlot> GetExceedancePlots(int maxPerSubtype = 1, IEnumerable<DataSubtype> subtypes = null)
Parameters
maxPerSubtype int
subtypes IEnumerable<DataSubtype>
Returns
PlotExceedances(int, IEnumerable<DataSubtype>)
public List<ExceedancePlot> PlotExceedances(int maxPerSubtype = 1, IEnumerable<DataSubtype> subtypes = null)
Parameters
maxPerSubtype int
subtypes IEnumerable<DataSubtype>
Returns
ReOpenDatasets()
public void ReOpenDatasets()
Run()
Compares the datasets. Writes a report to the string Message. Returns true if the Datasets are found to be equal for all of the tests performed.
public bool Run()
Returns
true if all tests performed indicate the Datasets are equal, false otherwise.
See Also
SaveExceedancePlots(string, out string, string, int, IEnumerable<DataSubtype>)
public bool SaveExceedancePlots(string directoryPath, out string resultMsg, string prefix = "", int maxPerSubtype = 1, IEnumerable<DataSubtype> subtypes = null)
Parameters
directoryPath string
resultMsg string
prefix string
maxPerSubtype int
subtypes IEnumerable<DataSubtype>
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
A string that represents the current object.
_markdiff(string)
Do not use.
public void _markdiff(string msg)
Parameters
msg string
_writeline(string)
Do not use.
public void _writeline(string msg)
Parameters
msg string
_writesuccess(string)
Do not use.
public void _writesuccess(string msg)
Parameters
msg string