public SegmentGroup(SegmentGroupType segmentGroupType) { this.segmentGroupType = segmentGroupType; int segmentsListSize; switch (segmentGroupType) { case SegmentGroupType.MarketSegType: segmentsListSize = (int)MarketSegType.NumTypes; break; case SegmentGroupType.QueryIntentType: segmentsListSize = (int)QueryIntentType.NumTypes; break; case SegmentGroupType.FileFormatType: segmentsListSize = (int)FileFormatType.NumTypes; break; case SegmentGroupType.PageLayoutType: segmentsListSize = (int)PageLayoutType.NumTypes; break; case SegmentGroupType.VisitType: segmentsListSize = (int)VisitType.NumTypes; break; default: segmentsListSize = -1; break; } for (int i = 0; i < segmentsListSize; ++i) { segmentsList.Add(new SegmentParameters()); } }
private int getIndexForSegment(SegmentGroupType segmentGroup, string segment) { int index = -1; switch (segmentGroup) { case SegmentGroupType.MarketSegType: MarketSegType marketSegType; try { marketSegType = (MarketSegType)Enum.Parse(typeof(MarketSegType), segment, true); } catch (Exception e) { throw new Exception(String.Format("Parse error: {0}, Cannot parse {1} into {2}", e.ToString(), segment, SegmentGroupType.MarketSegType.ToString())); } index = (int)marketSegType; break; case SegmentGroupType.QueryIntentType: QueryIntentType queryIntentType; try { queryIntentType = (QueryIntentType)Enum.Parse(typeof(QueryIntentType), segment, true); } catch (Exception e) { throw new Exception(String.Format("Parse error: {0}, Cannot parse {1} into {2}", e.ToString(), segment, SegmentGroupType.QueryIntentType.ToString())); } index = (int)queryIntentType; break; case SegmentGroupType.FileFormatType: FileFormatType fileFormatType; try { fileFormatType = (FileFormatType)Enum.Parse(typeof(FileFormatType), segment, true); } catch (Exception e) { throw new Exception(String.Format("Parse error: {0}, Cannot parse {1} into {2}", e.ToString(), segment, SegmentGroupType.FileFormatType.ToString())); } index = (int)fileFormatType; break; case SegmentGroupType.PageLayoutType: PageLayoutType pageLayoutType; try { pageLayoutType = (PageLayoutType)Enum.Parse(typeof(PageLayoutType), segment, true); } catch (Exception e) { throw new Exception(String.Format("Parse error: {0}, Cannot parse {1} into {2}", e.ToString(), segment, SegmentGroupType.PageLayoutType.ToString())); } index = (int)pageLayoutType; break; case SegmentGroupType.VisitType: VisitType visitType; try { visitType = (VisitType)Enum.Parse(typeof(VisitType), segment, true); } catch (Exception e) { throw new Exception(String.Format("Parse error: {0}, Cannot parse {1} into {2}", e.ToString(), segment, SegmentGroupType.VisitType.ToString())); } index = (int)visitType; break; default: break; } return index; }
public List<string> GetEnabledSegmentsInSegmentGroup(SegmentGroupType segmentGroup) { List<string> enabledSegments = new List<string>(); switch (segmentGroup) { case SegmentGroupType.MarketSegType: List<MarketSegType> enabledMarkets = getEnabledMarkets(); foreach (MarketSegType market in enabledMarkets) { enabledSegments.Add(market.ToString()); } break; case SegmentGroupType.QueryIntentType: List<QueryIntentType> enabledQueryIntents = getEnabledQueryIntents(); foreach (QueryIntentType qIntent in enabledQueryIntents) { enabledSegments.Add(qIntent.ToString()); } break; case SegmentGroupType.FileFormatType: List<FileFormatType> enabledFileFormats = getEnabledFileFormats(); foreach (FileFormatType fFormat in enabledFileFormats) { enabledSegments.Add(fFormat.ToString()); } break; case SegmentGroupType.PageLayoutType: List<PageLayoutType> enabledPageLayouts = getEnabledPageLayouts(); foreach (PageLayoutType pageLayout in enabledPageLayouts) { enabledSegments.Add(pageLayout.ToString()); } break; case SegmentGroupType.VisitType: List<VisitType> enabledVisitTypes = getEnabledVisitTypes(); foreach (VisitType vType in enabledVisitTypes) { enabledSegments.Add(vType.ToString()); } break; default: enabledSegments = null; break; } return enabledSegments; }
public List<int> GetEnabledSegmentsInSegmentGroupInt(SegmentGroupType segmentGroup) { List<int> enabledSegments = new List<int>(); switch (segmentGroup) { case SegmentGroupType.MarketSegType: List<MarketSegType> enabledMarkets = getEnabledMarkets(); foreach (MarketSegType market in enabledMarkets) { enabledSegments.Add((int)market); } break; case SegmentGroupType.QueryIntentType: List<QueryIntentType> enabledQueryIntents = getEnabledQueryIntents(); foreach (QueryIntentType qIntent in enabledQueryIntents) { enabledSegments.Add((int)qIntent); } break; case SegmentGroupType.FileFormatType: List<FileFormatType> enabledFileFormats = getEnabledFileFormats(); foreach (FileFormatType fFormat in enabledFileFormats) { enabledSegments.Add((int)fFormat); } break; case SegmentGroupType.PageLayoutType: List<PageLayoutType> enabledPageLayouts = getEnabledPageLayouts(); foreach (PageLayoutType pageLayout in enabledPageLayouts) { enabledSegments.Add((int)pageLayout); } break; case SegmentGroupType.VisitType: List<VisitType> enabledVisitTypes = getEnabledVisitTypes(); foreach (VisitType vType in enabledVisitTypes) { enabledSegments.Add((int)vType); } break; default: enabledSegments = null; break; } return enabledSegments; }
// Implementations of the interface methods /* * Getters */ public int getEnabledSegmentCount(SegmentGroupType segmentGroup) { int count = -1; switch (segmentGroup) { case SegmentGroupType.MarketSegType: count = getEnabledMarkets().Count; break; case SegmentGroupType.QueryIntentType: count = getEnabledQueryIntents().Count; break; case SegmentGroupType.FileFormatType: count = getEnabledFileFormats().Count; break; case SegmentGroupType.PageLayoutType: count = getEnabledPageLayouts().Count; break; case SegmentGroupType.VisitType: count = getEnabledVisitTypes().Count; break; default: break; } return count; }