Beispiel #1
0
        private static T Pop(ref SlimList <T> slimList, Int32 index)
        {
            var result = slimList[index];

            slimList.RemoveAt(index);
            return(result);
        }
Beispiel #2
0
 private static Boolean TryPeek(ref SlimList <T> slimList, out T value, Int32 index)
 {
     if (slimList.Count > 0)
     {
         return(TryResult(true, out value, slimList[index]));
     }
     else
     {
         return(TryResult(false, out value, default(T)));
     }
 }
Beispiel #3
0
 private T Dequeue(ref SlimList <T> a, ref SlimList <T> b)
 {
     if (a.Count > 0)
     {
         return(PopLast(ref a));
     }
     if (b.Count > 0)
     {
         return(PopFirst(ref b));
     }
     throw new EmptySlimDequeException();
 }
Beispiel #4
0
 private static Boolean TryPeekLast(ref SlimList <T> x, out T value) => TryPeek(ref x, out value, x.Count - 1);
Beispiel #5
0
 private static Boolean TryPeekFirst(ref SlimList <T> x, out T value) => TryPeek(ref x, out value, 0);
Beispiel #6
0
 private static T PopLast(ref SlimList <T> x) => Pop(ref x, x.Count - 1);
Beispiel #7
0
 private static T PopFirst(ref SlimList <T> x) => Pop(ref x, 0);