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