Exemple #1
0
 public IDeque <T> DequeueLeft()
 {
     return((1 < myLeft.Capacity)
                         ? new Deque <T>(myLeft.DequeueLeft(), myMiddle, myRight, myLongCount - 1)
                         : (!myMiddle.IsEmpty)
                                 ? new Deque <T>(myMiddle.PeekLeft(), myMiddle.DequeueLeft(), myRight, myLongCount - 1)
                                 : (1 < myRight.Capacity)
                                         ? new Deque <T>(new One(myRight.PeekLeft()), myMiddle, myRight.DequeueLeft(), myLongCount - 1)
                                         : new SingleDequeue(myRight.PeekLeft()) as IDeque <T>
            );
 }
Exemple #2
0
 public IDeque <T> DequeueLeft()
 {
     if (Left.Size > 1)
     {
         return(new Deque <T>(Left.DequeueLeft(), Middle, Right));
     }
     if (!Middle.IsEmpty)
     {
         return(new Deque <T>(Middle.PeekLeft(), Middle.DequeueLeft(), Right));
     }
     if (Right.Size > 1)
     {
         return(new Deque <T>(new One(Right.PeekLeft()), Middle, Right.DequeueLeft()));
     }
     return(new SingleDeque(Right.PeekLeft()));
 }