/// <summary> /// Removes the first occurrence of a specific object from the PropertySpecCollection. /// </summary> /// <param name="obj">The PropertySpec to remove from the PropertySpecCollection.</param> public void Remove(PropertySpec obj) { innerArray.Remove(obj); }
public PropertySpecDescriptor(PropertySpec item, PropertyBag bag, string name, Attribute[] attrs) : base(name, attrs) { this.bag = bag; this.item = item; }
/// <summary> /// Searches for the specified PropertySpec and returns the zero-based categoriesIndex of the first /// occurrence within the entire PropertySpecCollection. /// </summary> /// <param name="value">The PropertySpec to locate in the PropertySpecCollection.</param> /// <returns>The zero-based categoriesIndex of the first occurrence of value within the entire PropertySpecCollection, /// if found; otherwise, -1.</returns> public int IndexOf(PropertySpec value) { return innerArray.IndexOf(value); }
/// <summary> /// Inserts a PropertySpec object into the PropertySpecCollection at the specified categoriesIndex. /// </summary> /// <param name="categoriesIndex">The zero-based categoriesIndex at which value should be inserted.</param> /// <param name="value">The PropertySpec to insert.</param> public void Insert(int index, PropertySpec value) { innerArray.Insert(index, value); }
/// <summary> /// Copies the entire PropertySpecCollection to a compatible one-dimensional Array, starting at the /// beginning of the target array. /// </summary> /// <param name="array">The one-dimensional Array that is the destination of the elements copied /// from PropertySpecCollection. The Array must have zero-based indexing.</param> public void CopyTo(PropertySpec[] array) { innerArray.CopyTo(array); }
/// <summary> /// Copies the PropertySpecCollection or a portion of it to a one-dimensional array. /// </summary> /// <param name="array">The one-dimensional Array that is the destination of the elements copied /// from the collection.</param> /// <param name="categoriesIndex">The zero-based categoriesIndex in array at which copying begins.</param> public void CopyTo(PropertySpec[] array, int index) { innerArray.CopyTo(array, index); }
/// <summary> /// Determines whether a PropertySpec is in the PropertySpecCollection. /// </summary> /// <param name="item">The PropertySpec to locate in the PropertySpecCollection. The element to locate /// can be a null reference (Nothing in Visual Basic).</param> /// <returns>true if item is found in the PropertySpecCollection; otherwise, false.</returns> public bool Contains(PropertySpec item) { return innerArray.Contains(item); }
/// <summary> /// Adds the elements of an array of PropertySpec objects to the end of the PropertySpecCollection. /// </summary> /// <param name="array">The PropertySpec array whose elements should be added to the end of the /// PropertySpecCollection.</param> public void AddRange(PropertySpec[] array) { innerArray.AddRange(array); }
/// <summary> /// Adds a PropertySpec to the end of the PropertySpecCollection. /// </summary> /// <param name="value">The PropertySpec to be added to the end of the PropertySpecCollection.</param> /// <returns>The PropertySpecCollection categoriesIndex at which the value has been added.</returns> public int Add(PropertySpec value) { int index = innerArray.Add(value); return index; }
/// <summary> /// Initializes a new instance of the PropertySpecEventArgs class. /// </summary> /// <param name="property">The PropertySpec that represents the property whose /// value is being requested or set.</param> /// <param name="val">The current value of the property.</param> public PropertySpecEventArgs(PropertySpec property, object val) { this.property = property; this.val = val; }
/// <summary> /// Fills propertgrid with the data of the selected hypothesis /// </summary> /// <param name="hypothesisId">Id of the hypothesis to take data from</param> private void FillPropertyGrid(int hypothesisId) { HypothesisStruct hypothesis = this.resultBrowser.GetHypothese(hypothesisId); PropertyTable table = new PropertyTable(); string antecedentText = string.Empty; string succedentText = string.Empty; #region Filling in name, antecedent, succedent, condition, first set, second set if ((this.taskType == "LISpMinerTasks.SDKLTask") || (this.taskType == "LISpMinerTasks.CFTask") || (this.taskType == "LISpMinerTasks.SDCFTask") || (this.taskType == "LISpMinerTasks.KLTask")) { antecedentText = resManager.GetString("RowAttribute"); } else { antecedentText = resManager.GetString("ColumnAntecedent"); } if ((this.taskType == "LISpMinerTasks.SDKLTask") || (this.taskType == "LISpMinerTasks.KLTask")) { succedentText = resManager.GetString("ColumnAttribute"); } else { if ((this.taskType == "LISpMinerTasks.CFTask") || (this.taskType == "LISpMinerTasks.SDCFTask")) { succedentText = ""; } else { succedentText = resManager.GetString("ColumnSuccedent"); } } //name PropertySpec hName = new PropertySpec( resManager.GetString("ColumnHypothesisName"), typeof(string), resManager.GetString("HypothesisData"), resManager.GetString("HypothesisData"), FerdaResult.GetHypothesisName(hypothesis) ); hName.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hName); table[resManager.GetString("ColumnHypothesisName")] = FerdaResult.GetHypothesisName(hypothesis); //antecedent PropertySpec hAntecedent = new PropertySpec( antecedentText, typeof(string), resManager.GetString("HypothesisData"), resManager.GetString("HypothesisData"), FerdaResult.GetAntecedentString(hypothesis) ); hAntecedent.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hAntecedent); table[antecedentText] = FerdaResult.GetAntecedentString(hypothesis); //succedent if (succedentText != String.Empty) { PropertySpec hSuccedent = new PropertySpec( succedentText, typeof(string), resManager.GetString("HypothesisData"), resManager.GetString("HypothesisData"), FerdaResult.GetSuccedentString(hypothesis) ); hSuccedent.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hSuccedent); table[succedentText] = FerdaResult.GetSuccedentString(hypothesis); } //condition PropertySpec hCondition = new PropertySpec( resManager.GetString("ColumnCondition"), typeof(string), resManager.GetString("HypothesisData"), resManager.GetString("HypothesisData"), FerdaResult.GetConditionString(hypothesis) ); hCondition.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hCondition); table[resManager.GetString("ColumnCondition")] = FerdaResult.GetConditionString(hypothesis); //first set string temp1 = FerdaResult.GetFirstSetString(hypothesis); if(!(temp1.CompareTo(String.Empty) == 0)) { PropertySpec hFirstSet = new PropertySpec( "1" + resManager.GetString("FirstSet"), typeof(string), resManager.GetString("HypothesisData"), resManager.GetString("HypothesisData"), temp1 ); hFirstSet.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hFirstSet); table["1" + resManager.GetString("FirstSet")] = temp1; } //second set temp1 = FerdaResult.GetSecondSetString(hypothesis); if (!(temp1.CompareTo(String.Empty) == 0)) { PropertySpec hSecondSet = new PropertySpec( "2" + resManager.GetString("SecondSet"), typeof(string), resManager.GetString("HypothesisData"), resManager.GetString("HypothesisData"), temp1 ); hSecondSet.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hSecondSet); table["2" + resManager.GetString("SecondSet")] = temp1; } #endregion #region Used quantifiers and their values //used quantifiers and their values List<string> names = this.resultBrowser.GetAllQuantifierNames(); double[] quantifiers = this.resultBrowser.ReadAllQuantifiersFromCache(hypothesisId, Convert.ToInt32(this.NumericUpDownDecimals.Value)); for (int i = 0; i < quantifiers.Length; i++) { PropertySpec hQuantifier = new PropertySpec( names[i], typeof(double), resManager.GetString("AppliedQuantifiers"), resManager.GetString("AppliedQuantifiers"), quantifiers[i] ); hQuantifier.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hQuantifier); table[names[i]] = quantifiers[i]; } #endregion #region Contingency tables int i1 = 1; int j1 = 1; if (FerdaResult.IsFFT(hypothesis)) { foreach (int[] row in hypothesis.quantifierSetting.firstContingencyTableRows) { foreach (int value in row) { string temp = String.Empty; switch (i1) { case 1: if (j1 == 1) { temp = "a"; } else { temp = "b"; } break; default: if (j1 == 1) { temp = "c"; } else { temp = "d"; } break; } PropertySpec hValue = new PropertySpec( temp, typeof(int), "1. " + resManager.GetString("ContingencyTable"), "1. " + resManager.GetString("ContingencyTable"), value ); hValue.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hValue); table[temp] = value; j1++; } j1 = 1; i1++; } i1 = 1; j1 = 1; foreach (int[] row in hypothesis.quantifierSetting.secondContingencyTableRows) { foreach (int value in row) { string temp = String.Empty; switch (i1) { case 1: if (j1 == 1) { temp = "a"; } else { temp = "b"; } break; default: if (j1 == 1) { temp = "c"; } else { temp = "d"; } break; } PropertySpec hValue = new PropertySpec( temp, typeof(int), "2. " + resManager.GetString("ContingencyTable"), "2. " + resManager.GetString("ContingencyTable"), value ); hValue.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hValue); table[temp] = value; j1++; } j1 = 1; i1++; } } else { foreach (int[] row in hypothesis.quantifierSetting.firstContingencyTableRows) { foreach (int value in row) { string antName = i1.ToString(); string sucName = j1.ToString(); if ((this.taskType == "LISpMinerTasks.SDKLTask") || (this.taskType == "LISpMinerTasks.KLTask")) { foreach (LiteralStruct literal in hypothesis.literals) { if (literal.cedentType == CedentEnum.Antecedent) { if (literal.categoriesNames.Length > (i1-1)) { antName = literal.categoriesNames[(i1-1)]; } break; } } foreach (LiteralStruct literal in hypothesis.literals) { if (literal.cedentType == CedentEnum.Succedent) { if (literal.categoriesNames.Length > (j1-1)) { sucName = literal.categoriesNames[(j1-1)]; } break; } } } else if ((this.taskType == "LISpMinerTasks.SDCFTask") || (this.taskType == "LISpMinerTasks.CFTask")) { foreach (LiteralStruct literal in hypothesis.literals) { if (literal.cedentType == CedentEnum.Antecedent) { if (literal.categoriesNames.Length > (j1-1)) { antName = literal.categoriesNames[(j1-1)]; } break; } } sucName = String.Empty; } if (sucName != String.Empty) { PropertySpec hValue = new PropertySpec( antName.ToString() + "-" + sucName.ToString(), typeof(int), "1. " + resManager.GetString("ContingencyTable"), "1. " + resManager.GetString("ContingencyTable"), value ); hValue.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hValue); table[antName.ToString() + "-" + sucName.ToString()] = value; } else { PropertySpec hValue = new PropertySpec( antName.ToString(), typeof(int), "1. " + resManager.GetString("ContingencyTable"), "1. " + resManager.GetString("ContingencyTable"), value ); hValue.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hValue); table[antName.ToString()] = value; } j1++; } j1 = 1; i1++; } i1 = 1; j1 = 1; foreach (int[] row in hypothesis.quantifierSetting.secondContingencyTableRows) { foreach (int value in row) { string antName = i1.ToString(); string sucName = j1.ToString(); if ((this.taskType == "LISpMinerTasks.SDKLTask") || (this.taskType == "LISpMinerTasks.KLTask")) { foreach (LiteralStruct literal in hypothesis.literals) { if (literal.cedentType == CedentEnum.Antecedent) { if (literal.categoriesNames.Length > (i1 - 1)) { antName = literal.categoriesNames[(i1 - 1)]; } break; } } foreach (LiteralStruct literal in hypothesis.literals) { if (literal.cedentType == CedentEnum.Succedent) { if (literal.categoriesNames.Length > (j1 - 1)) { sucName = literal.categoriesNames[(j1 - 1)]; } break; } } } else if ((this.taskType == "LISpMinerTasks.SDCFTask") || (this.taskType == "LISpMinerTasks.CFTask")) { foreach (LiteralStruct literal in hypothesis.literals) { if (literal.cedentType == CedentEnum.Antecedent) { if (literal.categoriesNames.Length > (j1 - 1)) { antName = literal.categoriesNames[(j1 - 1)]; } break; } } sucName = String.Empty; } if (sucName != String.Empty) { PropertySpec hValue = new PropertySpec( antName.ToString() + "-" + sucName.ToString(), typeof(int), "1. " + resManager.GetString("ContingencyTable"), "1. " + resManager.GetString("ContingencyTable"), value ); hValue.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hValue); table[antName.ToString() + "-" + sucName.ToString()] = value; } else { PropertySpec hValue = new PropertySpec( antName.ToString(), typeof(int), "2. " + resManager.GetString("ContingencyTable"), "2. " + resManager.GetString("ContingencyTable"), value ); hValue.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(hValue); table[antName.ToString()] = value; } j1++; } j1 = 1; i1++; } } #endregion #region Statistics functions foreach (CountedValues value in this.resultBrowser.ReadStatisticsFromCache(hypothesisId, Convert.ToInt32(this.NumericUpDownDecimals.Value))) { string temp = String.Empty; temp = value.Value.ToString(); PropertySpec statistics = new PropertySpec( value.Name, typeof(string), this.resManager.GetString("Statistics"), this.resManager.GetString("Statistics"), temp ); statistics.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; table.Properties.Add(statistics); table[value.Name] = temp; } #endregion this.displayer.Reset(); this.displayer.OtherObjectAdapt(table); }