/// <summary> /// Method which handles re-filtering of hypotheses /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonSubmitFilter_Click(object sender, EventArgs e) { //antecedent Dictionary<string, LiteralFilter> antFilter = new Dictionary<string, LiteralFilter>(); foreach (object literalName in this.CheckedListBoxAntecedents.Items) { LiteralFilter filter = new LiteralFilter(); filter.Gace = GaceTypeEnum.Both; filter.LowLength = 0; filter.HighLength = 99; if (CheckedListBoxAntecedents.GetItemChecked(CheckedListBoxAntecedents.Items.IndexOf(literalName))) { filter.Selected = true; } else { filter.Selected = false; } antFilter.Add(literalName.ToString(), filter); } //succedent Dictionary<string, LiteralFilter> sucFilter = new Dictionary<string, LiteralFilter>(); foreach (object literalName in this.CheckedListBoxSuccedents.Items) { LiteralFilter filter = new LiteralFilter(); filter.Gace = GaceTypeEnum.Both; filter.LowLength = 0; filter.HighLength = 99; if (CheckedListBoxSuccedents.GetItemChecked(CheckedListBoxSuccedents.Items.IndexOf(literalName))) { filter.Selected = true; } else { filter.Selected = false; } sucFilter.Add(literalName.ToString(), filter); } //condition Dictionary<string, LiteralFilter> condFilter = new Dictionary<string, LiteralFilter>(); foreach (object literalName in this.CheckedListBoxConditions.Items) { LiteralFilter filter = new LiteralFilter(); filter.Gace = GaceTypeEnum.Both; filter.LowLength = 0; filter.HighLength = 99; if (CheckedListBoxConditions.GetItemChecked(CheckedListBoxConditions.Items.IndexOf(literalName))) { filter.Selected = true; } else { filter.Selected = false; } condFilter.Add(literalName.ToString(), filter); } this.resultBrowser.AntecedentFilter = antFilter; this.resultBrowser.SuccedentFilter = sucFilter; this.resultBrowser.ConditionFilter = condFilter; this.ReReadItems(); }
/// <summary> /// Method which initializes the filters /// </summary> private void InitFilters() { foreach (HypothesisStruct hypothese in Hypotheses) { foreach (BooleanLiteralStruct booleanLiteral in hypothese.booleanLiterals) { LiteralFilter temp = new LiteralFilter(); temp.Gace = GaceTypeEnum.Both; temp.LowLength = 0; temp.HighLength = 99; temp.Selected = true; switch (booleanLiteral.cedentType) { case CedentEnum.Antecedent: if (!this.antecedentFilter.ContainsKey(booleanLiteral.literalName)) { this.antecedentFilter.Add(booleanLiteral.literalName, temp); } break; case CedentEnum.Succedent: if (!this.succedentFilter.ContainsKey(booleanLiteral.literalName)) { this.succedentFilter.Add(booleanLiteral.literalName, temp); } break; case CedentEnum.Condition: if (!this.conditionFilter.ContainsKey(booleanLiteral.literalName)) { this.conditionFilter.Add(booleanLiteral.literalName, temp); } break; default: break; //throw new Exception("SwitchBranchNotImplemented"); } } foreach (LiteralStruct literal in hypothese.literals) { LiteralFilter temp = new LiteralFilter(); temp.Gace = GaceTypeEnum.Both; temp.LowLength = 0; temp.HighLength = 99; temp.Selected = true; switch (literal.cedentType) { case CedentEnum.Antecedent: if (!this.antecedentFilter.ContainsKey(literal.literalName)) { this.antecedentFilter.Add(literal.literalName, temp); } break; case CedentEnum.Succedent: if (!this.succedentFilter.ContainsKey(literal.literalName)) { this.succedentFilter.Add(literal.literalName, temp); } break; case CedentEnum.Condition: if (!this.conditionFilter.ContainsKey(literal.literalName)) { this.conditionFilter.Add(literal.literalName, temp); } break; default: //break; throw new Exception("SwitchBranchNotImplemented"); } } } }