Class PercentDifferenceCompareData
Last update: 09.03.2026Namespace: OpenTD.Results.Dataset
Assembly: OpenTD.Results.dll
This ICompareData implementation compares data of a single subtype (T, TL, etc.) for all applicable common entities (nodes or lumps or... etc.) between two datasets by examining the percent difference between pairs of values at each record for each common-named entity. For this comparison, Datasets must have the same number of records.
public class PercentDifferenceCompareData : CompareData, ICompareData
Inheritance
object ← CompareData ← PercentDifferenceCompareData
Implements
Inherited Members
CompareData.ComparerInput, CompareData.ComparerOutput, CompareData.Compare(string, DataSubtype, IEnumerable<string>, IEnumerable<long>, IEnumerable<long>, bool), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
PercentDifferenceCompareData(IComparerInput, IComparerOutput)
public PercentDifferenceCompareData(IComparerInput comparerInput, IComparerOutput comparerOutput)
Parameters
comparerInput IComparerInput
comparerOutput IComparerOutput
Properties
Floor
Comparison floor for comparing doubles. If the absolute value of a datapoint in dataset A is less than this value, the percent difference for that comparison is set to zero, resulting in that comparison being ignored. All comparisons are in SI units, so set the floor in SI units. Defaults to 0.
public double Floor { get; set; }
Property Value
PercentTol
Percent tolerance to use when comparing doubles. Defaults to 1.0.
public double PercentTol { get; set; }
Property Value
Methods
Compare(string, DataSubtype, IEnumerable<string>, IEnumerable<long>, IEnumerable<long>, bool)
This method implements the comparison algorithm.
public override void Compare(string name, DataSubtype subtype, IEnumerable<string> commonNames, IEnumerable<long> commonIndicesA, IEnumerable<long> commonIndicesB, bool msgOnSuccess = true)
Parameters
name string
This is a descriptive name for the data being compared. Use it in ComparerOutput messages.
subtype DataSubtype
This is the type of data (T, TL, etc.) to compare.
commonNames IEnumerable<string>
This is a list of Sinda names (MAIN.1, WALL.100, etc.) of entities that hold data of subtype and are common to both datasets. For example, if subtype is PL, then commonNames would be names of lumps that are common between the datasets. The comparison should be performed over all of the items in this list.
commonIndicesA IEnumerable<long>
These are the internal indices to the commonNames list for Dataset A.
commonIndicesB IEnumerable<long>
These are the internal indices to the commonNames list for Dataset B.
msgOnSuccess bool
If true, use ComparerOutput to write a message if this comparison is successful.