Esempio n. 1
0
        private void arrangeInterval()
        {
            int       idx  = 0;
            MInterval prev = null;

            foreach (MInterval iv in intervals)
            {
                if (idx >= 1)
                {
                    double from = CUtil.StringToDouble(iv.FromValue);
                    double to   = CUtil.StringToDouble(iv.ToValue);
                    double gap  = to - from;

                    iv.FromValue = prev.ToValue;

                    double nfrom = CUtil.StringToDouble(iv.FromValue);

                    if (nfrom >= to)
                    {
                        iv.ToValue = (nfrom + gap).ToString();
                    }
                }

                prev = iv;

                idx++;
            }
        }
Esempio n. 2
0
        private MInterval createNewInterval()
        {
            int       idx    = intervals.Count - 1;
            MInterval latest = intervals[idx];
            double    gap    = CUtil.StringToDouble(latest.ToValue) - CUtil.StringToDouble(latest.FromValue);

            MInterval v = new MInterval(new CTable(""));

            v.IsNotFirst = true;
            v.FromValue  = latest.ToValue;
            double nvalue = CUtil.StringToDouble(v.FromValue) + gap;

            v.ToValue = nvalue.ToString();

            return(v);
        }
Esempio n. 3
0
        public void DeserializeConfig(String cfgString)
        {
            if (cfgString.Equals(""))
            {
                return;
            }

            string[] words = cfgString.Split('|');

            if (words.Length < 5)
            {
                return;
            }

            //Name = words[0];
            Description   = words[1];
            SelectionType = CUtil.StringToInt(words[2]);
            StepScopeType = CUtil.StringToInt(words[3]);
            TierScopeType = CUtil.StringToInt(words[4]);

            MappingType = 1;
            if (words.Length >= 7)
            {
                MappingType = CUtil.StringToInt(words[6]);
            }

            String details = words[5];

            string[] rows = details.Split(';');

            intervals.Clear();
            if (!details.Equals(""))
            {
                foreach (string r in rows)
                {
                    string[] flds = r.Split(':');

                    MInterval vi = new MInterval(new CTable(""));
                    vi.FromValue   = flds[0];
                    vi.ToValue     = flds[1];
                    vi.ConfigValue = flds[2];

                    intervals.Add(vi);
                }
            }
        }
Esempio n. 4
0
        public void AddInterval()
        {
            MInterval v = null;

            if (intervals.Count <= 0)
            {
                v            = new MInterval(new CTable(""));
                v.IsNotFirst = false;
                v.FromValue  = "0";
                v.ToValue    = "10";
            }
            else
            {
                v = createNewInterval();
            }

            intervals.Add(v);
            arrangeInterval();
        }
Esempio n. 5
0
 public void RemoveInterval(MInterval vi)
 {
     intervals.Remove(vi);
     arrangeInterval();
 }