/// <summary> /// Gets the rules according to the specified filters. <see cref="spiderEvalRuleResultEnum.none"/> and <see cref="spiderEvalRuleRoleEnum.none"/> are wilcards /// </summary> /// <param name="mode">The mode.</param> /// <param name="role">The role.</param> /// <returns></returns> public List <IRuleBase> GetRules(spiderEvalRuleResultEnum mode, spiderEvalRuleRoleEnum role, spiderEvalRuleSubjectEnum subject) { List <IRuleBase> output = new List <IRuleBase>(); foreach (IRuleBase rule in this) { bool accept = true; if (mode != spiderEvalRuleResultEnum.none) { if (rule.mode != mode) { accept = false; continue; } } if (role != spiderEvalRuleRoleEnum.none) { if (accept) { if (rule.role != role) { accept = false; continue; } } } if (subject != spiderEvalRuleSubjectEnum.none) { if (accept) { if (rule.subject != subject) { accept = false; continue; } } } if (accept) { output.Add(rule); } } return(output); }
public spiderEvalRuleResult(IRuleBase __rule, spiderEvalRuleResultEnum mode) { rule = __rule; mode = mode; role = __rule.role; }
public int CountRules(spiderEvalRuleResultEnum mode = spiderEvalRuleResultEnum.none, spiderEvalRuleRoleEnum role = spiderEvalRuleRoleEnum.none, spiderEvalRuleSubjectEnum subject = spiderEvalRuleSubjectEnum.none) { var rls = rules.GetRules(mode, role, subject); return(rls.Count); }