private int LogFolderRelevance(PlottingStatisticsID other) { if (string.Equals(this.LogFolder, other.LogFolder)) { return(1); } return(0); }
private int PlotSizeRelevance(PlottingStatisticsID other) { if (this.PlotSize == other.PlotSize) { return(1); } return(0); }
private int UsedPlotterRelevance(PlottingStatisticsID other) { if (this.UsedPlotter == other.UsedPlotter) { return(1); } return(0); }
public int CalcRelevance(PlottingStatisticsID other, PlottingStatisticsIdRelevanceWeights weights) { var relevance = 0; relevance += PlotSizeRelevance(other) * weights.PlotSize; relevance += LogFolderRelevance(other) * weights.LogFolder; relevance += TmpDirRelevance(other) * weights.TmpDir; relevance += ComputeConfiguration(other) * weights.ComputeConfiguration; return(relevance); }
private int TmpDirRelevance(PlottingStatisticsID other) { bool tmp1Equal = string.Equals(this.Tmp1Drive, other.Tmp1Drive); bool tmp2Equal = string.Equals(this.Tmp2Drive, other.Tmp2Drive); if (tmp1Equal && tmp2Equal) { return(2); } if (!tmp1Equal && !tmp2Equal) { return(0); } return(1); }
private int ComputeConfiguration(PlottingStatisticsID other) { int relevance = 0; if (this.Threads == other.Threads) { relevance++; } if (this.Buckets == other.Buckets) { relevance++; } if (this.Buffer == other.Buffer) { relevance++; } return(relevance); }
public PlottingStatistics GetMostRelevantStatistics(PlotLog plotLog) { PlottingStatisticsID id = new PlottingStatisticsID(plotLog); Dictionary <int, List <PlotLog> > byRelevance = new Dictionary <int, List <PlotLog> >(); foreach (var fromAll in AllPlotLogs) { int relevance = id.CalcRelevance(new PlottingStatisticsID(fromAll), weights); // Debug.WriteLine(relevance); if (!byRelevance.ContainsKey(relevance)) { byRelevance.Add(relevance, new List <PlotLog>()); } byRelevance[relevance].Add(fromAll); } int highestRelevance = -1; foreach (var relevance in byRelevance.Keys) { if (relevance > highestRelevance) { highestRelevance = relevance; } } if (highestRelevance > -1) { List <PlotLog> plotLogs = byRelevance[highestRelevance]; return(new PlottingStatistics(plotLogs.ToList())); } if (AllPlotLogs.Count > 0) { return(new PlottingStatistics(AllPlotLogs.ToList())); } else { return(MagicNumbers()); } }