예제 #1
0
 public int Remove(BVToken value)
 {
     if (IsNumeric())
     {
         var qry = Properties.Where(dr => dr.Value == value);
         if (qry.Count() > 0)
         {
             int keyNumber    = int.Parse(qry.First().Key);
             int countRemoved = Properties.RemoveAll(dr => dr.Value == value);
             Properties.Where(dr => int.Parse(dr.Key) > keyNumber).ToList().ForEach(dr =>
             {
                 dr.Key = (int.Parse(dr.Key) - 1).ToString();
             });
             NumericMemo = true; // we're still numeric
             return(countRemoved);
         }
         NumericMemo = true; // we're still numeric
         return(0);
     }
     else
     {
         NumericMemo = null; // we don't know, we might have removed the thing that made us not numeric
         return(Properties.RemoveAll(dr => dr.Value == value));
     }
 }
예제 #2
0
        public void Add(BVToken token)
        {
            if (!IsNumeric())
            {
                throw new Exception("Collection is not array");
            }

            Properties.Add(new BVProperty(Properties.Count > 0 ? (Properties.Max(dr => int.Parse(dr.Key)) + 1).ToString() : "0", token));
        }
예제 #3
0
 public void Add(string key, BVToken token)
 {
     Properties.Add(new BVProperty(key, token));
     NumericMemo = null; // we don't know anymore
 }
예제 #4
0
 public BVProperty(string key, BVToken value)
 {
     this.Key   = key;
     this.Value = value;
 }