예제 #1
0
        /// <summary>
        /// Create builder.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parent">The parent.</param>
        /// <returns></returns>
        public static RootWrapper <T> ToBuilder <T>(RootWrapper <T> parent)
        {
            var cur      = ((ImmutableList <T>)parent.Collection).ToBuilder();
            var instance = new RootWrapper <T>(cur, "ToBuilder");

            instance.CreateRoot(parent);

            return(instance);
        }
예제 #2
0
        /// <summary>
        /// Adds the range.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parent">The parent.</param>
        /// <param name="values">The values.</param>
        /// <returns></returns>
        public static RootWrapper <T> AddRange <T>(RootWrapper <T> parent, params T[] values)
        {
            string action   = string.Format("AddRange({0})", string.Join(",", values));
            var    cur      = ((IImmutableList <T>)parent.Collection).AddRange(values);
            var    instance = new RootWrapper <T>(cur, action);

            instance.CreateRoot(parent);

            return(instance);
        }
예제 #3
0
        /// <summary>
        /// Adds item.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parent">The parent.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static RootWrapper <T> Add <T>(RootWrapper <T> parent, T value)
        {
            string action   = string.Format("Add({0})", value);
            var    cur      = ((IImmutableList <T>)parent.Collection).Add(value);
            var    instance = new RootWrapper <T>(cur, action);

            instance.CreateRoot(parent);

            return(instance);
        }
예제 #4
0
        /// <summary>
        /// Removes the range.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parent">The parent.</param>
        /// <param name="index">The index.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        public static RootWrapper <T> RemoveRange <T>(RootWrapper <T> parent, int index, int count)
        {
            string action   = string.Format("RemoveRange({0}, {1})", index, count);
            var    cur      = ((IImmutableList <T>)parent.Collection).RemoveRange(index, count);
            var    instance = new RootWrapper <T>(cur, action);

            instance.CreateRoot(parent);

            return(instance);
        }
예제 #5
0
        /// <summary>
        /// Creates the range.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="values">The values.</param>
        /// <returns></returns>
        public static RootWrapper <T> CreateRange <T>(params T[] values)
        {
            string action   = string.Format("CreateRange({0})", string.Join(",", values));
            var    cur      = ImmutableList.CreateRange(values);
            var    instance = new RootWrapper <T>(cur, action);

            instance.CreateRoot(null);

            return(instance);
        }
예제 #6
0
        /// <summary>
        /// Inserts.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parent">The parent.</param>
        /// <param name="index">The index.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static RootWrapper <T> Insert <T>(RootWrapper <T> parent, int index, T value)
        {
            string action   = string.Format("Insert({0}, {1})", index, value);
            var    cur      = ((IImmutableList <T>)parent.Collection).Insert(index, value);
            var    instance = new RootWrapper <T>(cur, action);

            instance.CreateRoot(parent);

            return(instance);
        }
예제 #7
0
 public void RemoveAt(int index)
 {
     Data = RootWrapper.RemoveAt(Data, index);
 }
예제 #8
0
 public void Remove(int i)
 {
     Data = RootWrapper.Remove(Data, i);
 }
예제 #9
0
 public void AddRange(int start, int count)
 {
     Data   = RootWrapper.AddRange(Data, Enumerable.Range(start, count).ToArray());
     Value += count;
 }
예제 #10
0
 public void Insert(int index, int value)
 {
     Data   = RootWrapper.Insert(Data, index, value);
     Value += 1;
 }
예제 #11
0
 public void Add(int i)
 {
     Data   = RootWrapper.Add(Data, i);
     Value += 1;
 }
예제 #12
0
        public void Empty()
        {
            var immutable = ImmutableList <int> .Empty;

            Data = new RootWrapper <int>(immutable, "Empty");
        }