/// <summary> /// Clear set values /// </summary> public void RemoveSetValues() { this.Set = new SingleSet(new ArrayList()); }
/// <summary> /// Method to initialize listview using ice structures /// </summary> /// <param name="existingCategories">Categories to fill in FerdaSmartDataList</param> /// <returns>FerdaSmartDataList with categories</returns> private FerdaSmartDataList MyIceRun(Modules.CategoriesStruct existingCategories) { //here we need to fill our data structure with data from ice ArrayList allValues = new ArrayList(); if (this.distinctValues != null) { foreach (string value in this.distinctValues) { allValues.Add(value); } } FerdaSmartDataList returnList = new FerdaSmartDataList(allValues, new ArrayList()); foreach (DictionaryEntry myEnumCategorySeq in existingCategories.enums) { Category newMultiset = new Category(); newMultiset.CatType = CategoryType.Enumeration; newMultiset.Name = myEnumCategorySeq.Key.ToString(); ArrayList tempArray = new ArrayList(); String[] StringSeq = (String[])myEnumCategorySeq.Value; foreach (string entry in StringSeq) { tempArray.Add(entry); } SingleSet newSet = new SingleSet(tempArray); newMultiset.AddSingleSet(newSet); returnList.AddNewCategoryDirect(newMultiset); } foreach (DictionaryEntry myLongIntervalCategorySeq in existingCategories.longIntervals) { Category newMultiset = new Category(); newMultiset.CatType = CategoryType.Interval; newMultiset.Name = myLongIntervalCategorySeq.Key.ToString(); LongIntervalStruct[] myLongIntervalStructSeq = (LongIntervalStruct[])myLongIntervalCategorySeq.Value; foreach (LongIntervalStruct myLongIntervalStruct in myLongIntervalStructSeq) { IntervalBoundType ubt, lbt; if (myLongIntervalStruct.leftBoundType == BoundaryEnum.Infinity) { lbt = IntervalBoundType.Infinity; } else { if (myLongIntervalStruct.leftBoundType == BoundaryEnum.Round) { lbt = IntervalBoundType.Round; } else { lbt = IntervalBoundType.Sharp; } } if (myLongIntervalStruct.rightBoundType == BoundaryEnum.Infinity) { ubt = IntervalBoundType.Infinity; } else { if (myLongIntervalStruct.rightBoundType == BoundaryEnum.Round) { ubt = IntervalBoundType.Round; } else { ubt = IntervalBoundType.Sharp; } Interval newInterval = new Interval(IntervalType.Long); newInterval.lowerBound = myLongIntervalStruct.leftBound; newInterval.upperBound = myLongIntervalStruct.rightBound; newInterval.lowerBoundType = lbt; newInterval.upperBoundType = ubt; //Interval newInterval = new Interval((int)myLongIntervalStruct.leftBound, (int)myLongIntervalStruct.rightBound, lbt, ubt); // newInterval.intervalType = IntervalType.Long newMultiset.AddInterval(newInterval); } returnList.AddNewCategoryDirect(newMultiset); } } foreach (DictionaryEntry myFloatIntervalCategorySeq in existingCategories.floatIntervals) { Category newMultiset = new Category(); newMultiset.CatType = CategoryType.Interval; newMultiset.Name = myFloatIntervalCategorySeq.Key.ToString(); FloatIntervalStruct[] myFloatIntervalStructSeq = (FloatIntervalStruct[])myFloatIntervalCategorySeq.Value; foreach (FloatIntervalStruct myFloatIntervalStruct in myFloatIntervalStructSeq) { IntervalBoundType ubt, lbt; if (myFloatIntervalStruct.leftBoundType == BoundaryEnum.Infinity) { lbt = IntervalBoundType.Infinity; } else { if (myFloatIntervalStruct.leftBoundType == BoundaryEnum.Round) { lbt = IntervalBoundType.Round; } else { lbt = IntervalBoundType.Sharp; } } if (myFloatIntervalStruct.rightBoundType == BoundaryEnum.Infinity) { ubt = IntervalBoundType.Infinity; } else { if (myFloatIntervalStruct.rightBoundType == BoundaryEnum.Round) { ubt = IntervalBoundType.Round; } else { ubt = IntervalBoundType.Sharp; } Interval newInterval = new Interval(IntervalType.Float); newInterval.lowerBoundFl = myFloatIntervalStruct.leftBound; newInterval.upperBoundFl = myFloatIntervalStruct.rightBound; newInterval.lowerBoundType = lbt; newInterval.upperBoundType = ubt; // Interval newInterval = new Interval(myFloatIntervalStruct.leftBound, myFloatIntervalStruct.rightBound, lbt, ubt); newMultiset.AddInterval(newInterval); } returnList.AddNewCategoryDirect(newMultiset); } } return returnList; }
/// <summary> /// Adds a new enum to the category. /// </summary> /// <param name="singleSet">New set</param> public void AddSingleSet(SingleSet singleSet) { if (this.CatType.Equals(CategoryType.Enumeration)) { foreach (object value in singleSet.Values) { this.set.AddValue(value); } } else { throw new ArgumentException("Object is not a Set"); } }