/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
public void RemoveAt(int index) { Data = RootWrapper.RemoveAt(Data, index); }
public void Remove(int i) { Data = RootWrapper.Remove(Data, i); }
public void AddRange(int start, int count) { Data = RootWrapper.AddRange(Data, Enumerable.Range(start, count).ToArray()); Value += count; }
public void Insert(int index, int value) { Data = RootWrapper.Insert(Data, index, value); Value += 1; }
public void Add(int i) { Data = RootWrapper.Add(Data, i); Value += 1; }
public void Empty() { var immutable = ImmutableList <int> .Empty; Data = new RootWrapper <int>(immutable, "Empty"); }