public IEnumerable <StringField> RangeGetField(SubjectGroup subjectGroup)
        {
            var subjectId = subjectGroup.Id.ToInt();

            return(RangeDictionary.ContainsKey(subjectId)
                ? RangeDictionary[subjectId]
                   .Select(x => new StringField(Labels.Range.ToString(), x.ToString(), Field.Store.YES))
                : new List <StringField>());
        }
        public string GetAt(string key)
        {
            if (RangeDictionary.ContainsKey(key) == false)
            {
                RangeDictionary.Add(key, "");
            }

            return(RangeDictionary[key]);
        }
 public string GetAt(int pos)
 {
     if (RangeDictionary.ContainsKey(ChoroplethConstants.legendTextControlPrefix + pos))
     {
         return(RangeDictionary[ChoroplethConstants.legendTextControlPrefix + pos]);
     }
     else
     {
         return("");
     }
 }
 public void Add(string key, string value)
 {
     if (RangeDictionary.ContainsKey(key))
     {
         RangeDictionary[key] = value;
     }
     else
     {
         RangeDictionary.Add(key, value);
     }
 }
        internal int GetClassLevelWithKey(string name)
        {
            int result = -1;

            if (RangeDictionary.ContainsKey(name) == false)
            {
                return(result);
            }

            string parse = name.Replace("rampStart", "").Replace("rampEnd", "");

            int.TryParse(parse, out result);

            return(result - 1);
        }
        internal ClassLimitType GetLimitTypeWithKey(string name)
        {
            ClassLimitType limitType = ClassLimitType.Indeterminate;

            if (RangeDictionary.ContainsKey(name) == false)
            {
                return(limitType);
            }

            if (name.Contains("Start"))
            {
                return(ClassLimitType.Start);
            }
            else
            {
                return(ClassLimitType.End);
            }
        }
Beispiel #7
0
        public static RangeDictionary <TKey, TValue> ToRangeDictionary <TSource, TKey, TValue>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TValue> valueSelector, IntervalMode intervalMode) where TKey : IComparable <TKey>
        {
            var result = new RangeDictionary <TKey, TValue>(intervalMode);

            foreach (var v in source)
            {
                var key = keySelector(v);
                if (!result.ContainsKey(key))
                {
                    result.Add(keySelector(v), valueSelector(v));
                }
                else
                {
                    result[key] = valueSelector(v);
                }
            }
            return(result);
        }
        public void 레인지딕셔너리는_IDictionary를_상속받습니다()
        {
            RangeDictionary <int, string> rangeDictionary = new RangeDictionary <int, string>();

            Assert.IsTrue(rangeDictionary.Add(1, 10, "1~10"));
            Assert.IsTrue(rangeDictionary.Add(11, 20, "11~20"));



            Dictionary <Range <int>, string> dictionary_Readonly = new Dictionary <Range <int>, string>(rangeDictionary, new Range <int> .Comparer());


            int iValue = 1;

            Assert.IsTrue(rangeDictionary.ContainsKey(iValue));

            // Todo 차후 해야함
            // Assert.IsTrue(dictionary_Readonly.ContainsKey(iValue));

            // Assert.AreEqual(rangeDictionary[iValue], dictionary_Readonly[new Range<int>(iValue)]);
            // Assert.AreEqual(rangeDictionary[iValue], dictionary_Readonly[iValue]);
        }