public void AddRange(BetterLinkedList <T> list) { end.SetNext(list.start); end = list.end; current = list.end; Count += list.Count; }
void TestForeach <T>(BetterLinkedList <T> list) { foreach (BetterLinkedListNode <T> cur in list) { // 说明:用于正确性测试;测试GC时需要注释 //Debug.Log("TestForeach:" + cur.Value.ToString()); } }
void TestGetEnumerator <T>(BetterLinkedList <T> list) { var item = list.GetEnumerator(); while (item.MoveNext()) { // 说明:用于正确性测试;测试GC时需要注释 //Debug.Log("TestGetEnumerator:" + (item.Current as BetterLinkedListNode<T>).Value.ToString()); } }
// Use this for initialization void Start() { mBetterLinkedList1 = new BetterLinkedList <int>(); mBetterLinkedList2 = new BetterLinkedList <string>(); mBetterLinkedList3 = new BetterLinkedList <CustomStruct>(); mBetterLinkedList4 = new BetterLinkedList <CustomClass>(); mBsb = new BetterStringBuilder(30, 0, BetterStringBuilderBufferType.None); for (int i = 0; i < 100; i++) { mTestString.Add("test" + i.ToString()); mTestCustomStruct.Add(new CustomStruct(i, mTestString[i])); mTestCustomClass.Add(new CustomClass(i, mTestString[i], mTestCustomStruct[i])); } }
void LogList <T>(BetterLinkedList <T> list) { // 说明:用于测试正确性 mBsb.Clear(); mBsb.AppendFormat("--------------------- {0}", typeof(T).Name); mBsb.AppendLine(); mBsb.AppendFormat("Count = {0}", list.Count); mBsb.AppendLine(); BetterLinkedListNode <T> node = list.First; while (node != null) { mBsb.Append(node.Value.ToString()); mBsb.AppendLine(); node = node.Next; } mBsb.AppendLine(); Debug.Log(mBsb.ToString()); }
public BetterLinkedList <Vector4> GetPooledLinkedListVector4(Vector4 a, Vector4 b, Vector4 c) { int size = poolingLinkedListVector4.Count; BetterLinkedList <Vector4> toBeReturned; if (size == 0) { toBeReturned = new BetterLinkedList <Vector4>(); } else { toBeReturned = poolingLinkedListVector4[size - 1]; poolingLinkedListVector4.RemoveAt(size - 1); } toBeReturned.Add(a); toBeReturned.Add(b); toBeReturned.Add(c); return(toBeReturned); }
void TestAddAfter <T>(BetterLinkedList <T> list, BetterLinkedListNode <T> node, BetterLinkedListNode <T> newNode) { list.AddAfter(node, newNode); }
void TestClear <T>(BetterLinkedList <T> list) { list.Clear(); }
BetterLinkedListNode <T> TestFind <T>(BetterLinkedList <T> list, T value) { BetterLinkedListNode <T> node = list.Find(value); return(node); }
void TestRemoveNode <T>(BetterLinkedList <T> list, BetterLinkedListNode <T> node) { list.Remove(node); }
void TestRemoveValue <T>(BetterLinkedList <T> list, T value) { list.Remove(value); }
void TestRemoveLast <T>(BetterLinkedList <T> list) { list.RemoveLast(); }
public void PoolList(BetterLinkedList <Vector4> dedList) { dedList.Clear(); poolingLinkedListVector4.Add(dedList); }
void TestAddLast <T>(BetterLinkedList <T> list, T item) { list.AddLast(item); }
void TestAddAfter <T>(BetterLinkedList <T> list, BetterLinkedListNode <T> node, T item) { list.AddAfter(node, item); }
void TestAddBefore <T>(BetterLinkedList <T> list, BetterLinkedListNode <T> node, BetterLinkedListNode <T> newNode) { list.AddBefore(node, newNode); }
void TestAddBefore <T>(BetterLinkedList <T> list, BetterLinkedListNode <T> node, T item) { list.AddBefore(node, item); }