/// <summary> /// Calculates the total <c>Item1</c> and average score <c>Item2</c>. /// </summary> /// <returns>Tuple where <c>Item1</c> is total score and <c>Item2</c> average</returns> /// <exception cref="aceGeneralException">Active links shouldn't have members with score at BANSCORE level - null - spiderActiveLinks.calculateTotalAndAvgScore()</exception> public static Tuple <int, float> calculateTotalAndAvgScore(this IList items) { int tc_score = 0; float avg_score = 0.0F; for (int i = 0; i < items.Count; i++) { spiderWebElementBase ln = items[i] as spiderWebElementBase; int sc = ln.marks.calculate(); if (sc == spiderEvalRuleResultSet.BANSCORE) { throw new aceGeneralException("Active links shouldn't have members with score at BANSCORE level", null, items, "spiderWebStructureTools.calculateTotalAndAvgScore()"); } else { tc_score += sc; } } if (items.Count == 0) { return(new Tuple <int, float>(0, 0)); } if (tc_score == 0) { return(new Tuple <int, float>(0, 0)); } avg_score = tc_score / items.Count; Tuple <int, float> output = new Tuple <int, float>(tc_score, avg_score); return(output); }
public relationShipCounter(spiderLink __linkToPage) { basePage = __linkToPage; signature = __linkToPage.targetHash; }
public spiderObjectiveSolution(spiderWebElementBase target, spiderObjectiveStatus __status) { elements.Add(target); status = __status; }