public IDeque <T> EnqueueRight(T value) { if (!Right.Full) { return(new Deque <T>(Left, Middle, Right.EnqueueRight(value))); } return(new Deque <T>( Left, Middle.EnqueueRight(Right.DequeueRight()), new Two(Right.PeekRight(), value))); }
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> ); }
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())); }