public (SResult[] sResult, StatContent[] statContent) Matches(string[][] surahs, string[][] roots, string[][] tran, int smin, int smax) { List <SResult> sr = new List <SResult>(); StatContent[] sc = new StatContent[terms.Length]; for (int i = 0; i < sc.Length; i++) { sc[i] = new StatContent(terms[i].statType); sc[i].term = terms[i].ToString(); } for (int s = smin; s <= smax; s++) { bool[] surahfound = new bool[terms.Length]; for (int i = 0; i < surahfound.Length; i++) { surahfound[i] = false; } for (int v = 0; v < surahs[s].Length - 1; v++) { bool match = false; string matching = ""; for (int t = 0; t < terms.Length; t++) { Term term = terms[t]; var result = term.Match(surahs[s][v], roots[s][v], tran[s][v]); if (result.isMatch) { match = true; matching += " ; " + result.actual; surahfound[t] = true; sc[t] += result.stats; } } if (match) { sr.Add(new SResult(s, v, matching.Substring(3))); } } for (int i = 0; i < surahfound.Length; i++) { if (surahfound[i]) { sc[i].surahs++; } } } return(sr.ToArray(), sc); }
public (bool isMatch, string actual, StatContent stats) Match(string verse, string roots, string tran) { bool match = true; string matching = ""; StatContent sc = new StatContent(statType); foreach (Phrase phrase in phrases) { var result = phrase.Match(verse, roots, tran); if (result.isMatch) { matching += " & " + result.actual; if (statType > StatType.Verse) { sc += result.stats; } } else { match = false; } } if (!match) { matching = ""; } else if (!include) { matching = ""; } if (matching != "") { matching = matching.Substring(3); } if (match == include) { sc.verses += 1; } // Match No Match //Include True False //No Include False True return(match == include, matching, sc); }