private DifferenceWhenComparingCoordinateValues ShowDifferenceIfSignificant( string lineFromFileWithRegressionResults, string lineFromFileWithRegressionResults2, double deltaValueForDifferencesToIgnore, bool shouldAlsoDisplayDifferencesWhenValueIsMissing ) { TestResultItem t1 = new TestResultItem(lineFromFileWithRegressionResults); TestResultItem t2 = new TestResultItem(lineFromFileWithRegressionResults2); DifferenceWhenComparingCoordinateValues diff = t1.IsDeltaDifferenceSignificant(t2, deltaValueForDifferencesToIgnore); if ( (shouldAlsoDisplayDifferencesWhenValueIsMissing && ( diff == DifferenceWhenComparingCoordinateValues.SIGNIFICANT_VALUE_DIFFERENCE || diff == DifferenceWhenComparingCoordinateValues.EXISTING_VS_NOT_EXISTING ) ) || (!shouldAlsoDisplayDifferencesWhenValueIsMissing && ( diff == DifferenceWhenComparingCoordinateValues.SIGNIFICANT_VALUE_DIFFERENCE ) ) ) { Console.WriteLine("Diff lines with significant delta " + deltaValueForDifferencesToIgnore + " : "); Console.WriteLine(lineFromFileWithRegressionResults); Console.WriteLine(lineFromFileWithRegressionResults2); } return(diff); }
/** * @param that * @param deltaValueForDifferencesToIgnore * @return */ public DifferenceWhenComparingCoordinateValues IsDeltaDifferenceSignificant( TestResultItem that, double deltaValueForDifferencesToIgnore ) { bool thisXIsDouble = IsValueExistingAndDouble(this.wgs84targetX); bool thisYIsDouble = IsValueExistingAndDouble(this.wgs84targetY); bool thatXIsDouble = IsValueExistingAndDouble(that.wgs84targetX); bool thatYIsDouble = IsValueExistingAndDouble(that.wgs84targetY); if (thisXIsDouble != thatXIsDouble) { return(DifferenceWhenComparingCoordinateValues.EXISTING_VS_NOT_EXISTING); } if (thisYIsDouble != thatYIsDouble) { return(DifferenceWhenComparingCoordinateValues.EXISTING_VS_NOT_EXISTING); } if (thisYIsDouble && thisXIsDouble) // then the others are also double according to above { double thisLat = Double.Parse(this.wgs84targetY); double thisLon = Double.Parse(this.wgs84targetX); double thatLat = Double.Parse(that.wgs84targetY); double thatLon = Double.Parse(that.wgs84targetX); double diffLat = Math.Abs(thisLat - thatLat); double diffLon = Math.Abs(thisLon - thatLon); // Console.WriteLine("diffLat " + diffLat); // Console.WriteLine("diffLon " + diffLon); // Console.WriteLine("thisLon " + thisLon); // Console.WriteLine("thatLon " + thatLon); if (diffLon > deltaValueForDifferencesToIgnore || diffLat > deltaValueForDifferencesToIgnore) { return(DifferenceWhenComparingCoordinateValues.SIGNIFICANT_VALUE_DIFFERENCE); } } return(DifferenceWhenComparingCoordinateValues.NO); }
public ISet <int> GetIndexesForRowsWithSignificantDifference( FileWithRows that, double deltaValueForDifferencesToIgnore ) { ISet <int> indexes = new HashSet <int>(); for (int fileRowIndex = 0; fileRowIndex < rowsFromFile.Count; fileRowIndex++) { string thisRow = this.rowsFromFile[fileRowIndex]; string thatRow = that.rowsFromFile[fileRowIndex]; TestResultItem t1 = new TestResultItem(thisRow); TestResultItem t2 = new TestResultItem(thatRow); DifferenceWhenComparingCoordinateValues diff = t1.IsDeltaDifferenceSignificant(t2, deltaValueForDifferencesToIgnore); if (diff == DifferenceWhenComparingCoordinateValues.SIGNIFICANT_VALUE_DIFFERENCE) { indexes.Add(fileRowIndex); } } return(indexes); }